Re: [PATCH RFC 5/6] fs: introduce a shutdown_bdev super block operation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Jun 22, 2025 at 10:15:19PM -0700, Christoph Hellwig wrote:
> On Fri, Jun 20, 2025 at 05:36:52PM +0200, Jan Kara wrote:
> > On Fri 20-06-25 15:17:28, Qu Wenruo wrote:
> > > Currently we already have the super_operations::shutdown() callback,
> > > which is called when the block device of a filesystem is marked dead.
> > > 
> > > However this is mostly for single(ish) block device filesystems.
> > > 
> > > For multi-device filesystems, they may afford a missing device, thus may
> > > continue work without fully shutdown the filesystem.
> > > 
> > > So add a new super_operation::shutdown_bdev() callback, for mutli-device
> > > filesystems like btrfs and bcachefs.
> > > 
> > > For now the only user is fs_holder_ops::mark_dead(), which will call
> > > shutdown_bdev() if supported.
> > > If not supported then fallback to the original shutdown() callback.
> > > 
> > > Btrfs is going to add the usage of shutdown_bdev() soon.
> > > 
> > > Signed-off-by: Qu Wenruo <wqu@xxxxxxxx>
> > 
> > Thanks for the patch. I think that we could actually add 'bdev' that
> > triggered shutdown among arguments ->shutdown takes instead of introducing
> > a new handler.
> 
> I don't really think that's a good idea as-is.  The current ->shutdown
> callback is called ->shutdown because it is expected to shut the file
> system down.  That's why I suggested to Qu to add a new devloss callback,
> to describe that a device is lost.  In a file system with built-in
> redundancy that is not a shutdown.  So Qu, please add a devloss
> callback.  And maybe if we have no other good use for the shutdown
> callback we can remove it in favor of the devloss one.  But having
> something named shutdown take the block device and not always shutting
> the file system down is highly confusing.

I think we should add:

diff --git a/include/linux/fs.h b/include/linux/fs.h
index b085f161ed22..1d07f862a6a2 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -2368,6 +2368,7 @@ struct super_operations {
        long (*free_cached_objects)(struct super_block *,
                                    struct shrink_control *);
        void (*shutdown)(struct super_block *sb);
+       void (*drop_bdev)(struct super_block *sb, struct block_device *bdev /* , unsigned int flags/reason maybe too ? */);
 };

You might want to drop a block device independent of whether the device
was somehow lost. So I find that a bit more flexible.




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux