[Ocfs2-tools-devel] [PATCH 20/30] libocfs2: fix ocfs2_init_dir() to retain indexed flag

Mark Fasheh mfasheh at suse.com
Wed Apr 28 18:26:25 PDT 2010


We were re-using the out of date 'cached inode' later in the function after
ocfs2_dx_dir_build() (which updates and writes out the inode internally).

As a result, ocfs2_init_dir() was accidentally clearing
OCFS2_INDEXED_DIR_FL. Fix this by refreshing the cache after the call to
ocfs2_dx_dir_build().

Signed-off-by: Mark Fasheh <mfasheh at suse.com>
Cc: Joel Becker <joel.becker at oracle.com>
Cc: Sunil Mushran <sunil.mushran at oracle.com>
---
 libocfs2/expanddir.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/libocfs2/expanddir.c b/libocfs2/expanddir.c
index eb18260..a81cfbe 100644
--- a/libocfs2/expanddir.c
+++ b/libocfs2/expanddir.c
@@ -242,6 +242,15 @@ errcode_t ocfs2_init_dir(ocfs2_filesys *fs,
 		ret = ocfs2_dx_dir_build(fs, dir);
 		if (ret)
 			goto bail;
+
+		/*
+		 * Re-read the 'cached inode' as ocfs2_dx_dir_build()
+		 * may have written out changes which won't be
+		 * reflected in our copy.
+		 */
+		ret = ocfs2_read_cached_inode(fs, dir, &cinode);
+		if (ret)
+			goto bail;
 	}
 
 	/* set link count of the parent */
-- 
1.6.4.2




More information about the Ocfs2-tools-devel mailing list