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

Christoph Hellwig
2023-05-09T13:35:08Z

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.