forked from pool/ocfs2-tools
c8700c5230
OBS-URL: https://build.opensuse.org/package/show/network:ha-clustering:Factory/ocfs2-tools?expand=0&rev=8
64 lines
2.0 KiB
Diff
64 lines
2.0 KiB
Diff
From 2dff67994c3d6015b2b989d79a00c2cd10669ed0 Mon Sep 17 00:00:00 2001
|
|
From: Coly Li <coly.li@suse.de>
|
|
Date: Mon, 26 Apr 2010 22:37:59 +0800
|
|
Subject: [PATCH 29/30] dx_dirs: set OCFS2_INDEXED_DIR_FL after indexed tree gets built
|
|
|
|
In ocfs2_dx_dir_build(), current code set OCFS2_INDEXED_DIR_FL to
|
|
di->i_dyn_features before inserting dir entries into the indexed tree.
|
|
If there is any error during the insertion, the corresponded dirent will
|
|
be lost from the indexed tree. Though this error can be checked and
|
|
fixed in fsck.ocfs2, it should be fixed.
|
|
|
|
This patch modifies to set OCFS2_INDEXED_DIR_FL after
|
|
ocfs2_dir_iterate() returns successfully. If ocfs2_dir_iterate() returns
|
|
with error, ocfs2_dx_dir_build() will return error and stop to build the
|
|
indexed tree for a specific directory. In this case, no dirent will be
|
|
losted.
|
|
|
|
Thanks to Tao Ma to catch this.
|
|
|
|
Signed-off-by: Coly Li <coly.li@suse.de>
|
|
Cc: Mark Fasheh <mfasheh@suse.com>
|
|
Cc: Tao Ma <tao.ma@oracle.com>
|
|
---
|
|
libocfs2/dir_indexed.c | 9 +++++++--
|
|
1 files changed, 7 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/libocfs2/dir_indexed.c b/libocfs2/dir_indexed.c
|
|
index 08c43b7..eb872fd 100644
|
|
--- a/libocfs2/dir_indexed.c
|
|
+++ b/libocfs2/dir_indexed.c
|
|
@@ -1254,7 +1254,6 @@ errcode_t ocfs2_dx_dir_build(ocfs2_filesys *fs,
|
|
dx_root->dr_entries.de_count = ocfs2_dx_entries_per_root(fs->fs_blocksize);
|
|
|
|
di->i_dx_root = dr_blkno;
|
|
- di->i_dyn_features |= OCFS2_INDEXED_DIR_FL;
|
|
|
|
ret = ocfs2_write_dx_root(fs, dr_blkno, dx_buf);
|
|
if (ret)
|
|
@@ -1274,14 +1273,20 @@ errcode_t ocfs2_dx_dir_build(ocfs2_filesys *fs,
|
|
if (ret)
|
|
goto out;
|
|
|
|
- /* check quota for dx_leaf */
|
|
ret = ocfs2_read_dx_root(fs, dr_blkno, dx_buf);
|
|
if (ret)
|
|
goto out;
|
|
ret = ocfs2_read_inode(fs, dir, di_buf);
|
|
if (ret)
|
|
goto out;
|
|
+ /* set inode to use indexed-dirs */
|
|
+ di->i_dyn_features |= OCFS2_INDEXED_DIR_FL;
|
|
|
|
+ ret = ocfs2_write_inode(fs, dir, di_buf);
|
|
+ if(ret)
|
|
+ goto out;
|
|
+
|
|
+ /* check quota for dx_leaf */
|
|
change = ocfs2_clusters_to_bytes(fs,
|
|
dx_root->dr_clusters);
|
|
uid = di->i_uid;
|
|
--
|
|
1.7.0.2
|
|
|