From: Theodore Ts'o Date: Tue, 26 May 2015 02:18:43 +0000 (-0400) Subject: libext2fs: fix ext2fs_close() when MMP is not enabled X-Git-Tag: v1.43-WIP-2016-03-15~106 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=766c14289119c6ecc362e0e5093ca82a51b5e1ca;p=tools%2Fe2fsprogs.git libext2fs: fix ext2fs_close() when MMP is not enabled If MMP support is not configured, then ext2fs_mmp_stop() will always return the error EXT2_ET_OP_NOT_SUPPORTED. Unfortunately, ext2fs_close() and tune2fs call ext2fs_mmp_stop() unconditionally. So if the file system does not have MMP enabled, fix ext2fs_mmp_stop() to return success even if CONFIG_MMP is not enabled, so that ext2fs_close() and tune2fs doesn't fail for no good reason. Signed-off-by: Theodore Ts'o --- diff --git a/lib/ext2fs/mmp.c b/lib/ext2fs/mmp.c index afb825c..3947b1f 100644 --- a/lib/ext2fs/mmp.c +++ b/lib/ext2fs/mmp.c @@ -398,6 +398,10 @@ mmp_error: return retval; #else + if (!(fs->super->s_feature_incompat & EXT4_FEATURE_INCOMPAT_MMP) || + !(fs->flags & EXT2_FLAG_RW) || (fs->flags & EXT2_FLAG_SKIP_MMP)) + return 0; + return EXT2_ET_OP_NOT_SUPPORTED; #endif } @@ -440,6 +444,10 @@ errcode_t ext2fs_mmp_update2(ext2_filsys fs, int immediately) mmp_error: return retval; #else + if (!(fs->super->s_feature_incompat & EXT4_FEATURE_INCOMPAT_MMP) || + !(fs->flags & EXT2_FLAG_RW) || (fs->flags & EXT2_FLAG_SKIP_MMP)) + return 0; + return EXT2_ET_OP_NOT_SUPPORTED; #endif }