[PATCH, RFC 11/10] block: propagate BLKROSET to all partitions
Coly Li
colyli at suse.de
Sat Nov 7 02:28:15 EST 2020
On 2020/11/6 22:08, Christoph Hellwig wrote:
>
> When setting the whole device read-only (or clearing the read-only
> state), also update the policy for all partitions. The s390 dasd
> driver has awlways been doing this and it makes a lot of sense.
>
> Signed-off-by: Christoph Hellwig <hch at lst.de>
Acked-by: Coly Li <colyli at suse.de>
Thanks.
Coly Li
> ---
> block/ioctl.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/block/ioctl.c b/block/ioctl.c
> index 6b785181344fe1..22f394d118c302 100644
> --- a/block/ioctl.c
> +++ b/block/ioctl.c
> @@ -354,7 +354,10 @@ static int blkdev_roset(struct block_device *bdev, fmode_t mode,
> if (ret)
> return ret;
> }
> - bdev->bd_part->policy = n;
> + if (bdev_is_partition(bdev))
> + bdev->bd_part->policy = n;
> + else
> + set_disk_ro(bdev->bd_disk, n);
> return 0;
> }
>
>
More information about the linux-mtd
mailing list