Re: [PATCH] loop: block loop reconfiguration of offset/sizelimit on mounted device
From: Christoph Hellwig
Date: Mon Mar 30 2026 - 01:58:09 EST
On Mon, Mar 30, 2026 at 10:13:34AM +0530, Deepanshu Kartikey wrote:
> LOOP_SET_STATUS{64} allows changing lo_offset and lo_sizelimit while
> a filesystem is mounted on the loop device. This effectively mutates
> the data visible to the mounted filesystem, which is equivalent to
> writing directly to the block device.
Increasing the size certainly does not do that.
> Export bdev_writes_blocked() so it can be used from the loop driver.
I'm not sure exporting this is a good idea. Besides the growing the
device part above, if someone insist on changing the size, they could
do this just fine with a remove block device, so prohibiting it locally
just because we can seems odd. And exporting a helper with obscure
usage for a strange use case without documenting that is rarely a
good idea.
> -static bool bdev_writes_blocked(struct block_device *bdev)
> +bool bdev_writes_blocked(struct block_device *bdev)
> {
> return bdev->bd_writers < 0;
> }
> +EXPORT_SYMBOL_GPL(bdev_writes_blocked);
> +
>
> static void bdev_block_writes(struct block_device *bdev)
... and if we were to make it public it should be inline, and in a
separate patch.
And if not this would still add a spurious empty line.