]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
e2fsck: don't add a UUID on a mounted filesystem with csums
authorMichael Marineau <michael.marineau@coreos.com>
Sun, 19 Jan 2014 22:09:34 +0000 (14:09 -0800)
committerTheodore Ts'o <tytso@mit.edu>
Mon, 24 Feb 2014 00:21:33 +0000 (19:21 -0500)
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>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
e2fsck/super.c

index 736cfea6ab064819bcea8df2a06b2cd8eae68755..81503d4b9b70755cf1313dd86207d1800625e7a8 100644 (file)
@@ -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;