Linux-Fsdevel Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: Andreas Dilger <adilger@dilger.ca>
Cc: Christoph Hellwig <hch@infradead.org>, Jan Kara <jack@suse.cz>,
	linux-fsdevel <linux-fsdevel@vger.kernel.org>,
	yebin <yebin10@huawei.com>,
	linux-block <linux-block@vger.kernel.org>,
	Jens Axboe <axboe@kernel.dk>
Subject: Re: [PATCH RFC 2/2] block: Do not discard buffers under a mounted filesystem
Date: Sat, 29 Aug 2020 07:40:41 +0100	[thread overview]
Message-ID: <20200829064041.GA23205@infradead.org> (raw)
In-Reply-To: <F9505A56-F07B-4308-BE42-F75ED76B4E3C@dilger.ca>

On Fri, Aug 28, 2020 at 02:21:29AM -0600, Andreas Dilger wrote:
> On Aug 25, 2020, at 6:16 AM, Christoph Hellwig <hch@infradead.org> wrote:
> > 
> > On Tue, Aug 25, 2020 at 02:05:54PM +0200, Jan Kara wrote:
> >> Discarding blocks and buffers under a mounted filesystem is hardly
> >> anything admin wants to do. Usually it will confuse the filesystem and
> >> sometimes the loss of buffer_head state (including b_private field) can
> >> even cause crashes like:
> > 
> > Doesn't work if the file system uses multiple devices.
> 
> It's not _worse_ than the current situation of allowing the complete
> destruction of the mounted filesystem.  It doesn't fix the problem
> for XFS with realtime devices, or ext4 with a separate journal device,
> but it fixes the problem for a majority of users with a single device
> filesystem.
> 
> While BLKFLSBUF causing a crash is annoying, BLKDISCARD/BLKSECDISCARD
> under a mounted filesystem is definitely dangerous and wrong.
> 
> What about checking for O_EXCL on the device, indicating that it is
> currently in use by some higher level?

That actually seems like a much better idea.

  reply	other threads:[~2020-08-29  6:40 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-25 12:05 [PATCH RFC 0/2] Block and buffer invalidation under a filesystem Jan Kara
2020-08-25 12:05 ` [PATCH RFC 1/2] fs: Don't invalidate page buffers in block_write_full_page() Jan Kara
2020-08-25 12:05 ` [PATCH RFC 2/2] block: Do not discard buffers under a mounted filesystem Jan Kara
2020-08-25 12:16   ` Christoph Hellwig
2020-08-25 14:10     ` Theodore Y. Ts'o
2020-08-25 15:12       ` Jan Kara
2020-08-25 18:41         ` Matthew Wilcox
2020-08-25 18:49           ` Jan Kara
2020-08-25 14:50     ` Jan Kara
2020-08-27  7:16       ` Christoph Hellwig
2020-08-27 21:39         ` Al Viro
2020-08-28  0:07           ` Dave Chinner
2020-08-28  8:10             ` Jan Kara
2020-08-28  8:21     ` Andreas Dilger
2020-08-29  6:40       ` Christoph Hellwig [this message]
2020-08-31  7:48         ` Jan Kara

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=20200829064041.GA23205@infradead.org \
    --to=hch@infradead.org \
    --cc=adilger@dilger.ca \
    --cc=axboe@kernel.dk \
    --cc=jack@suse.cz \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=yebin10@huawei.com \
    --subject='Re: [PATCH RFC 2/2] block: Do not discard buffers under a mounted filesystem' \
    /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

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).