From: Ted Ts'o <tytso@mit.edu>
To: Andreas Dilger <adilger@whamcloud.com>
Cc: linux-ext4@vger.kernel.org
Subject: Re: e2fsck: fix checks done for mounted vs. read-only
Date: Mon, 28 May 2012 10:51:00 -0400 [thread overview]
Message-ID: <20120528145100.GA21422@thunk.org> (raw)
In-Reply-To: <1337895296-16629-1-git-send-email-adilger@whamcloud.com>
On Thu, May 24, 2012 at 11:34:56AM -0000, Andreas Dilger wrote:
> Currently, if e2fsck is run without the "-n" flag (i.e. it
> might modify the filesystem), there is no guarantee that it will
> open the filesystem with the EXCLUSIVE flag (i.e. O_EXCL) to
> prevent the block device from being checked (in most cases this
> means mounted, but it could also be an MD/LVM member device).
>
> Conversely, if e2fsck is run with "-n" (i.e. read-only), and
> /etc/mtab or /proc/mounts does not report the block device as
> mounted then e2fsck thinks the filesystem is unmounted. In this
> case, e2fsck incorrectly sets the EXCLUSIVE flag, which causes
> the check to fail, even though e2fsck is running read-only.
>
> To fix this, do not open with EXCLUSIVE if it is a read-only check,
> and always open with EXCLUSIVE if the filesystem might be changed.
> This also prevents filesystem mounts while e2fsck is running.
>
> Also refuse allow e2fsck to run at all if the filesystem is BUSY.
> The e2fsck check_mount() was checking for MOUNTED, but not BUSY,
> and it should refuse to run outright if the block device is BUSY.
> The previous MOUNTED heuristics pre-date the O_EXCL reservation
> by the kernel, so there could be uncertainty due to stale /etc/mtab
> data, but with newer kernels a busy device should never be modified.
>
> Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Thanks, applied.
- Ted
next prev parent reply other threads:[~2012-05-28 14:51 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 [this message]
2012-05-30 17:57 ` Andreas Dilger
2012-05-30 18:39 ` [PATCH] e2fsck: allow checking on mounted root filesystem Andreas Dilger
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=20120528145100.GA21422@thunk.org \
--to=tytso@mit.edu \
--cc=adilger@whamcloud.com \
--cc=linux-ext4@vger.kernel.org \
/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).