From: Michael Marineau <michael.marineau@coreos.com>
To: tytso@mit.edu
Cc: linux-ext4@vger.kernel.org,
Michael Marineau <michael.marineau@coreos.com>
Subject: [PATCH] e2fsck: skip fixing UUID on a mounted filesystem with csums
Date: Sun, 19 Jan 2014 14:09:34 -0800 [thread overview]
Message-ID: <1390169374-1775-1-git-send-email-michael.marineau@coreos.com> (raw)
This fix is similar to 66457fcb for tune2fs. When booting from a root
filesystem with an empty UUID which fsck fixes the following remount
step reliably fails, leaving the filesystem in an inconsistent state.
Like the tune2fs fix this patch resolves the issue by simply refusing to
update the UUID if the filesystem is mounted.
Signed-off-by: Michael Marineau <michael.marineau@coreos.com>
---
This patch is against master but is equally applicable to maint, it
applies to maint with 1 line of fuzz (ext2fs_init_csum_seed).
I've tested it on top of v1.42.9.
It may also be possible to fix this issue with a patch to ext4_remount
in the kernel but I have not investigated that.
e2fsck/super.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/e2fsck/super.c b/e2fsck/super.c
index 59c1f97..3c92df2 100644
--- a/e2fsck/super.c
+++ b/e2fsck/super.c
@@ -734,8 +734,11 @@ void check_super_block(e2fsck_t ctx)
#ifndef EXT2_SKIP_UUID
/*
* If the UUID field isn't assigned, assign it.
+ * Skip if checksums are enabled and the filesystem is mounted,
+ * if the id changes under the kernel remounting rw may fail.
*/
- if (!(ctx->options & E2F_OPT_READONLY) && uuid_is_null(sb->s_uuid)) {
+ if (!(ctx->options & E2F_OPT_READONLY) && uuid_is_null(sb->s_uuid) &&
+ (!csum_flag || !(ctx->mount_flags & EXT2_MF_MOUNTED))) {
if (fix_problem(ctx, PR_0_ADD_UUID, &pctx)) {
uuid_generate(sb->s_uuid);
ext2fs_init_csum_seed(fs);
--
1.8.3.2
next reply other threads:[~2014-01-19 22:09 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-19 22:09 Michael Marineau [this message]
2014-02-24 0:21 ` [PATCH] e2fsck: skip fixing UUID on a mounted filesystem with csums 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=1390169374-1775-1-git-send-email-michael.marineau@coreos.com \
--to=michael.marineau@coreos.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).