linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andreas Dilger <adilger@whamcloud.com>
To: tytso@mit.edu, linux-ext4@vger.kernel.org
Cc: Andreas Dilger <adilger@whamcloud.com>
Subject: [PATCH] e2fsck: allow checking on mounted root filesystem
Date: Wed, 30 May 2012 12:39:42 -0600	[thread overview]
Message-ID: <1338403182-2253-1-git-send-email-adilger@whamcloud.com> (raw)
In-Reply-To: <1337895296-16629-1-git-send-email-adilger@whamcloud.com>

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 <adilger@whamcloud.com>
---
 e2fsck/unix.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/e2fsck/unix.c b/e2fsck/unix.c
index 6161e46..1c1bae8 100644
--- a/e2fsck/unix.c
+++ b/e2fsck/unix.c
@@ -1221,8 +1221,11 @@ 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))
+			flags |= EXT2_FLAG_EXCLUSIVE;
+	}
 
 	retval = try_open_fs(ctx, flags, io_ptr, &fs);
 
-- 
1.7.3.4


  parent reply	other threads:[~2012-05-30 18:39 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-24 21:34 [PATCH] e2fsck: fix checks done for mounted vs. read-only Andreas Dilger
2012-05-28 14:51 ` Ted Ts'o
2012-05-30 17:57   ` Andreas Dilger
2012-05-30 18:39 ` Andreas Dilger [this message]
2012-05-30 22:55   ` [PATCH] e2fsck: allow checking on mounted root fs (v2) Andreas Dilger
2012-05-31 21:35     ` Ted Ts'o
2012-05-30 22:55   ` [PATCH] e2fsck: allow checking on mounted root filesystem Andreas Dilger

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=1338403182-2253-1-git-send-email-adilger@whamcloud.com \
    --to=adilger@whamcloud.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).