Re: [PATCH 5/9] block: introduce holder ops

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

 



On Wed, May 10, 2023 at 08:19:58AM +1000, Dave Chinner wrote:
> On Tue, May 09, 2023 at 03:35:01PM +0200, Christoph Hellwig wrote:
> > On Fri, May 05, 2023 at 11:51:19AM -0700, Darrick J. Wong wrote:
> > > Fun question: What happens when the swap disk falls off the bus?
> > 
> > Your system is toast.
> > 
> > > > -	if (IS_ERR(blkdev_get_by_dev(bdev->bd_dev, mode | FMODE_EXCL, &bdev)))
> > > > +	if (IS_ERR(blkdev_get_by_dev(bdev->bd_dev, mode | FMODE_EXCL, &bdev,
> > > > +			NULL)))
> > > >  		return -EBUSY;
> > > >  	ret = set_blocksize(bdev, n);
> > > >  	blkdev_put(bdev, mode | FMODE_EXCL);
> > > 
> > > Somewhat related question: Should we allow userspace to initiate a fs
> > > shutdown through the block device?  Let's say you're preparing to yank
> > > /dev/sda and want to kill anything attached to it or its partitions?
> > > Without having to walk through however many mount namespaces there are
> > > to find the mountpoints?
> > 
> > That's kinda what we're doing here.  Or do you mean even more advanced
> > notice by having another callout before stopping I/O so that we could
> > write out all log buffers?  It's probably doable, but I'm not convinced
> > that this use case is worth maintaining and testing the kernel code for
> > it.
> 
> The userspace shutdown code already does this by default - it
> actually calls freeze_bdev() to cause the filesystem to be made
> consistent on the block device before it executes the shutdown.
> So, in effect, we already have the "shutdown before turning off
> block device" paths in the filesystems and extremely well tested.
> 
> Indeed, if the device is being removed, why not call freeze_bdev()
> before doing anything else? It guarantees that applications will be
> quiesced and the filesystem will stabilise and not try to change
> anything until the shutdown occurs when the device is pulled...

I think I want everything -- I want freeze_bdev on a device /before/ we
pull it out so that we can try to flush dirty everything to the disk; I
want that to work for the log/rt devices; and I want a final shutdown
notification when the kernel drops the bdev so that we can offline the
fs and shortcut/start returning EIO.

--D

> Cheers,
> 
> Dave.
> -- 
> Dave Chinner
> david@xxxxxxxxxxxxx



[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux