From c22f3284a7a5edc2cd0a24d370c901437bdfca49 Mon Sep 17 00:00:00 2001 From: Michael Marineau Date: Sun, 19 Jan 2014 14:09:34 -0800 Subject: [PATCH] e2fsck: don't add a UUID on a mounted filesystem with csums 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 Signed-off-by: "Theodore Ts'o" --- e2fsck/super.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/e2fsck/super.c b/e2fsck/super.c index 736cfea..81503d4 100644 --- a/e2fsck/super.c +++ b/e2fsck/super.c @@ -722,8 +722,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); fs->flags |= EXT2_FLAG_DIRTY; -- 1.8.3.1