linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: tytso@mit.edu
Cc: linux-ext4@vger.kernel.org
Subject: [PATCH] tune2fs: don't change UUID on a mounted metadata_csum fs
Date: Tue, 29 Sep 2015 08:31:22 -0700	[thread overview]
Message-ID: <20150929153122.GJ10390@birch.djwong.org> (raw)

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);

             reply	other threads:[~2015-09-29 15:31 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-29 15:31 Darrick J. Wong [this message]
2015-09-29 22:46 ` [PATCH] tune2fs: don't change UUID on a mounted metadata_csum fs Theodore Ts'o
2015-09-30  1:21   ` Andreas Dilger
2015-09-30 16:11     ` Theodore Ts'o

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150929153122.GJ10390@birch.djwong.org \
    --to=darrick.wong@oracle.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=tytso@mit.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).