[Ocfs2-tools-devel] [PATCH 2/4] tunefs.ocfs2: Skip add dir trailer in some cases.

Tao Ma tao.ma at oracle.com
Tue Sep 21 01:55:36 PDT 2010


We should skip inlined dir when either the dir is inlined
or it already has one(in case of metaecc enabled).

The old solution causes a segfault in tunefs_install_dir_trailer
because we don't setup our_tc while returning success in
tunefs_prepare_dir_trailer.

Signed-off-by: Tao Ma <tao.ma at oracle.com>
---
 tunefs.ocfs2/libocfs2ne.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/tunefs.ocfs2/libocfs2ne.c b/tunefs.ocfs2/libocfs2ne.c
index 26e368c..d1aecf4 100644
--- a/tunefs.ocfs2/libocfs2ne.c
+++ b/tunefs.ocfs2/libocfs2ne.c
@@ -1059,6 +1059,10 @@ errcode_t tunefs_install_dir_trailer(ocfs2_filesys *fs,
 	errcode_t ret = 0;
 	struct tunefs_trailer_context *our_tc = NULL;
 
+	if ((di->i_dyn_features & OCFS2_INLINE_DATA_FL) ||
+	    ocfs2_dir_has_trailer(fs, di))
+		goto out;
+
 	if (!tc) {
 		ret = tunefs_prepare_dir_trailer(fs, di, &our_tc);
 		if (ret)
-- 
1.7.1.GIT




More information about the Ocfs2-tools-devel mailing list