[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20231206175038.GJ509422@mit.edu>
Date: Wed, 6 Dec 2023 12:50:38 -0500
From: "Theodore Ts'o" <tytso@....edu>
To: Christoph Hellwig <hch@...radead.org>
Cc: Yu Kuai <yukuai1@...weicloud.com>, axboe@...nel.dk,
roger.pau@...rix.com, colyli@...e.de, kent.overstreet@...il.com,
joern@...ybastard.org, miquel.raynal@...tlin.com, richard@....at,
vigneshr@...com, sth@...ux.ibm.com, hoeppner@...ux.ibm.com,
hca@...ux.ibm.com, gor@...ux.ibm.com, agordeev@...ux.ibm.com,
jejb@...ux.ibm.com, martin.petersen@...cle.com, clm@...com,
josef@...icpanda.com, dsterba@...e.com, nico@...xnic.net,
xiang@...nel.org, chao@...nel.org, adilger.kernel@...ger.ca,
agruenba@...hat.com, jack@...e.com, konishi.ryusuke@...il.com,
willy@...radead.org, akpm@...ux-foundation.org, hare@...e.de,
p.raghav@...sung.com, linux-block@...r.kernel.org,
linux-kernel@...r.kernel.org, xen-devel@...ts.xenproject.org,
linux-bcache@...r.kernel.org, linux-mtd@...ts.infradead.org,
linux-s390@...r.kernel.org, linux-scsi@...r.kernel.org,
linux-bcachefs@...r.kernel.org, linux-btrfs@...r.kernel.org,
linux-erofs@...ts.ozlabs.org, linux-ext4@...r.kernel.org,
gfs2@...ts.linux.dev, linux-nilfs@...r.kernel.org,
yukuai3@...wei.com, yi.zhang@...wei.com, yangerkun@...wei.com
Subject: Re: [PATCH -next RFC 01/14] block: add some bdev apis
On Tue, Dec 05, 2023 at 10:14:00PM -0800, Christoph Hellwig wrote:
> > +/*
> > + * The del_gendisk() function uninitializes the disk-specific data
> > + * structures, including the bdi structure, without telling anyone
> > + * else. Once this happens, any attempt to call mark_buffer_dirty()
> > + * (for example, by ext4_commit_super), will cause a kernel OOPS.
> > + * This is a kludge to prevent these oops until we can put in a proper
> > + * hook in del_gendisk() to inform the VFS and file system layers.
> > + */
> > +int bdev_ejected(struct block_device *bdev)
> > +{
> > + struct backing_dev_info *bdi = inode_to_bdi(bdev->bd_inode);
> > +
> > + return bdi->dev == NULL;
> > +}
> > +EXPORT_SYMBOL_GPL(bdev_ejected);
>
> And this code in ext4 should just go away entirely. The bdi should
> always be valid for a live bdev for years.
This was added because pulling a mounted a USB thumb drive (or a HDD
drops off the SATA bus) while the file system is mounted and actively
in use, would result in a kernel OOPS. If that's no longer true,
that's great, but it would be good to test to make sure this is the
case....
If we really want to remove it, I'd suggest doing this as a separate
commit, so that after we see syzbot reports, or users complaining
about kernel crashes, we can revert the removal if necessary.
Cheers,
- Ted
Powered by blists - more mailing lists