From: Andreas Dilger Date: Wed, 30 May 2012 18:16:53 +0000 (-0600) Subject: e2fsck: allow checking on mounted root filesystem X-Git-Tag: v1.42.3.wc3~4 X-Git-Url: https://git.whamcloud.com/gitweb?a=commitdiff_plain;h=4d9ab375b7e972a63b26914ec1d3a3fb3a00aef6;p=tools%2Fe2fsprogs.git e2fsck: allow checking on mounted root filesystem Commit 732e26b98e5c79a4298dbe341f43b54b354bb241 added checks to prevent e2fsck from being run in filesystem-modifying mode against a mounted or otherwise busy device, due to several bug reports of users doing this even with the verbose warnings in check_mount(). However, it also prevented e2fsck from checking a mounted root filesystem, which will prevent the node from booting. Once again allow e2fsck to run against the mounted root filesystem. Signed-off-by: Andreas Dilger --- diff --git a/e2fsck/unix.c b/e2fsck/unix.c index 3be3fdf..f42dc83 100644 --- a/e2fsck/unix.c +++ b/e2fsck/unix.c @@ -1430,8 +1430,12 @@ restart: &old_bitmaps); if (!old_bitmaps) flags |= EXT2_FLAG_64BITS; - if ((ctx->options & E2F_OPT_READONLY) == 0) - flags |= EXT2_FLAG_RW | EXT2_FLAG_EXCLUSIVE; + if ((ctx->options & E2F_OPT_READONLY) == 0) { + flags |= EXT2_FLAG_RW; + if (!(ctx->mount_flags & EXT2_MF_ISROOT && + ctx->mount_flags & EXT2_MF_READONLY)) + flags |= EXT2_FLAG_EXCLUSIVE; + } retval = try_open_fs(ctx, flags, io_ptr, &fs);