linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] tune2fs: don't change UUID on a mounted metadata_csum fs
@ 2015-09-29 15:31 Darrick J. Wong
  2015-09-29 22:46 ` Theodore Ts'o
  0 siblings, 1 reply; 4+ messages in thread
From: Darrick J. Wong @ 2015-09-29 15:31 UTC (permalink / raw)
  To: tytso; +Cc: linux-ext4

It's not safe to change the UUID on a mounted filesystem when the
metadata_csum feature is enabled because there's (currently) no
way to update the kernel's CRC seeds, which precompute the UUID
component of the checksum for all metadata blocks.  Not to mention
that we'd have to rewrite /all/ metadata blocks, and any kernel disk
accesses will race with tune2fs, thus destroying the filesystem.

Note that it's fine to do the online UUID update if *only* group
descriptor checksums are enabled.

This is a regression introduced by 2334bd3a ("tune2fs: allow changing
the UUID mounted file systems with the -f option") which does not
seem to have been reviewed on the mailing list.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 misc/tune2fs.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/misc/tune2fs.c b/misc/tune2fs.c
index 2f27d6f..ad833de 100644
--- a/misc/tune2fs.c
+++ b/misc/tune2fs.c
@@ -2960,7 +2960,9 @@ retry_open:
 			 * Changing the UUID requires rewriting all metadata,
 			 * which can race with a mounted fs.  Don't allow that.
 			 */
-			if ((mount_flags & EXT2_MF_MOUNTED) && !f_flag) {
+			if ((mount_flags & EXT2_MF_MOUNTED) && (!f_flag ||
+			     EXT2_HAS_RO_COMPAT_FEATURE(fs->super,
+				       EXT4_FEATURE_RO_COMPAT_METADATA_CSUM))) {
 				fputs(_("The UUID may only be "
 					"changed when the filesystem is "
 					"unmounted.\n"), stderr);

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-09-30 16:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-29 15:31 [PATCH] tune2fs: don't change UUID on a mounted metadata_csum fs Darrick J. Wong
2015-09-29 22:46 ` Theodore Ts'o
2015-09-30  1:21   ` Andreas Dilger
2015-09-30 16:11     ` Theodore Ts'o

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).