From: Darrick J. Wong Date: Tue, 4 Nov 2014 16:52:26 +0000 (-0500) Subject: tune2fs: don't change metadata_csum on a mounted fs X-Git-Tag: v1.43-WIP-2015-05-18~141 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a4b528692ed7c2d7bdeb1313cfaef3a14f5267a0;p=thirdparty%2Fe2fsprogs.git tune2fs: don't change metadata_csum on a mounted fs Don't let users change metadata_csum on a mounted filesystem because there's no way to tell the kernel to turn on the feature; there's no way to prevent the kernel from rewriting on-disk structures while tune2fs is also rewriting them; and there's no way to tell the kernel to reload them after tune2fs is finished. Signed-off-by: Darrick J. Wong Signed-off-by: Theodore Ts'o --- diff --git a/misc/tune2fs.c b/misc/tune2fs.c index ecbdea06f..7fee870de 100644 --- a/misc/tune2fs.c +++ b/misc/tune2fs.c @@ -1110,6 +1110,9 @@ mmp_error: EXT4_FEATURE_RO_COMPAT_METADATA_CSUM)) { if (check_fsck_needed(fs)) exit(1); + if (mount_flags & EXT2_MF_MOUNTED) + fputs(_("Cannot enable metadata_csum on a mounted " + "filesystem!\n"), stderr); rewrite_checksums = 1; /* metadata_csum supersedes uninit_bg */ fs->super->s_feature_ro_compat &= @@ -1132,6 +1135,9 @@ mmp_error: EXT4_FEATURE_RO_COMPAT_METADATA_CSUM)) { if (check_fsck_needed(fs)) exit(1); + if (mount_flags & EXT2_MF_MOUNTED) + fputs(_("Cannot disable metadata_csum on a mounted " + "filesystem!\n"), stderr); rewrite_checksums = 1; /* * If we're turning off metadata_csum and not turning on