[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 34/78] block: propagate BLKROSET to all partitions
- To: Jens Axboe <axboe@xxxxxxxxx>
- From: Christoph Hellwig <hch@xxxxxx>
- Date: Mon, 16 Nov 2020 15:57:25 +0100
- Cc: Justin Sanders <justin@xxxxxxxxxx>, Josef Bacik <josef@xxxxxxxxxxxxxx>, Ilya Dryomov <idryomov@xxxxxxxxx>, Jack Wang <jinpu.wang@xxxxxxxxxxxxxxx>, "Michael S. Tsirkin" <mst@xxxxxxxxxx>, Jason Wang <jasowang@xxxxxxxxxx>, Paolo Bonzini <pbonzini@xxxxxxxxxx>, Stefan Hajnoczi <stefanha@xxxxxxxxxx>, Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Minchan Kim <minchan@xxxxxxxxxx>, Mike Snitzer <snitzer@xxxxxxxxxx>, Song Liu <song@xxxxxxxxxx>, "Martin K. Petersen" <martin.petersen@xxxxxxxxxx>, dm-devel@xxxxxxxxxx, linux-block@xxxxxxxxxxxxxxx, drbd-dev@xxxxxxxxxxxxxxxx, nbd@xxxxxxxxxxxxxxxx, ceph-devel@xxxxxxxxxxxxxxx, xen-devel@xxxxxxxxxxxxxxxxxxxx, linux-raid@xxxxxxxxxxxxxxx, linux-nvme@xxxxxxxxxxxxxxxxxxx, linux-scsi@xxxxxxxxxxxxxxx, linux-fsdevel@xxxxxxxxxxxxxxx
- Delivery-date: Mon, 16 Nov 2020 15:09:47 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
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@xxxxxx>
---
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;
}
--
2.29.2
|