linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Theodore Ts'o <tytso@mit.edu>
To: Ext4 Developers List <linux-ext4@vger.kernel.org>
Cc: sandeen@redhat.com, Theodore Ts'o <tytso@mit.edu>
Subject: [PATCH] e2fsck: check a file system mounted read-only if forced
Date: Sun, 29 Jul 2012 00:19:57 -0400	[thread overview]
Message-ID: <1343535597-18983-1-git-send-email-tytso@mit.edu> (raw)
In-Reply-To: <1343535209-18588-1-git-send-email-tytso@mit.edu>

Previously e2fsck would only allow a mounted file system to be checked
if it was the root file system and it was mounted read-only.  Now
allow any file system mounted read-only if the -f option is specified.

This makes it easier to test how e2fsck handles checking file systems
which are mounted without having to test on the root file system.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
---
 e2fsck/unix.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/e2fsck/unix.c b/e2fsck/unix.c
index f71a125..da41f69 100644
--- a/e2fsck/unix.c
+++ b/e2fsck/unix.c
@@ -225,7 +225,9 @@ static void check_mount(e2fsck_t ctx)
 	     !(ctx->options & E2F_OPT_WRITECHECK)))
 		return;
 
-	if ((ctx->options & E2F_OPT_READONLY) &&
+	if (((ctx->options & E2F_OPT_READONLY) ||
+	     ((ctx->options & E2F_OPT_FORCE) &&
+	      (ctx->mount_flags & EXT2_MF_READONLY))) &&
 	    !(ctx->options & E2F_OPT_WRITECHECK)) {
 		log_out(ctx, _("Warning!  %s is %s.\n"),
 			ctx->filesystem_name,
@@ -1226,6 +1228,9 @@ restart:
 		if (!(ctx->mount_flags & EXT2_MF_ISROOT &&
 		      ctx->mount_flags & EXT2_MF_READONLY))
 			flags |= EXT2_FLAG_EXCLUSIVE;
+		if ((ctx->mount_flags & EXT2_MF_READONLY) &&
+		    (ctx->options & E2F_OPT_FORCE))
+			flags &= ~EXT2_FLAG_EXCLUSIVE;
 	}
 
 	retval = try_open_fs(ctx, flags, io_ptr, &fs);
-- 
1.7.12.rc0.22.gcdd159b


      reply	other threads:[~2012-07-29  4:20 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-20 23:13 How should e2fsck clear s_errno/j_errno on an ro mount? Eric Sandeen
2012-07-21  0:39 ` Theodore Ts'o
2012-07-23 16:28   ` Eric Sandeen
2012-07-23 19:14     ` Theodore Ts'o
2012-07-23 20:21       ` Eric Sandeen
2012-07-29  3:51         ` Theodore Ts'o
2012-07-29  3:52           ` [PATCH] ext4: make sure the journal sb is written in ext4_clear_journal_err() Theodore Ts'o
2012-07-29  4:13           ` [PATCH] Revert "e2fsck: Skip journal checks if the fs is mounted and doesn't need recovery" Theodore Ts'o
2012-07-29  4:19             ` Theodore Ts'o [this message]

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=1343535597-18983-1-git-send-email-tytso@mit.edu \
    --to=tytso@mit.edu \
    --cc=linux-ext4@vger.kernel.org \
    --cc=sandeen@redhat.com \
    /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).