[Ocfs2-tools-devel] tunefs.ocfs2: Don't set incompat flags unless we're really changing slots

Mark Fasheh mark.fasheh at oracle.com
Fri Sep 21 14:52:17 PDT 2007


opts.num_slots is initialized to zero, which is always less than max_slots
on a valid ocfs2 file system. If tunefs.ocfs2 is called at all for anything,
even without "-N" the test for setting the removing-slots incompat flag
succeeds because it's not explicitely checking for zero.

This means that simple operations like changing mount type leave the
incompat bit set in the super block, rendering the file system unmountable
until fsck.ocfs2 is run.

Signed-off-by: Mark Fasheh <mark.fasheh at oracle.com>
---
 tunefs.ocfs2/tunefs.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/tunefs.ocfs2/tunefs.c b/tunefs.ocfs2/tunefs.c
index 4bb9f82..fbdb9e3 100644
--- a/tunefs.ocfs2/tunefs.c
+++ b/tunefs.ocfs2/tunefs.c
@@ -1452,7 +1452,8 @@ int main(int argc, char **argv)
 	}
 
 	/* Set resize incompat flag on superblock */
-	if (opts.num_blocks || opts.num_slots < max_slots) {
+	if (opts.num_blocks ||
+	    (opts.num_slots && opts.num_slots < max_slots)) {
 		if (opts.num_blocks)
 			OCFS2_RAW_SB(fs->fs_super)->s_feature_incompat |=
 				OCFS2_FEATURE_INCOMPAT_RESIZE_INPROG;
-- 
1.5.0.6




More information about the Ocfs2-tools-devel mailing list