All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH, RFC 11/10] block: propagate BLKROSET to all partitions
@ 2020-11-06 14:08 ` Christoph Hellwig
  0 siblings, 0 replies; 12+ messages in thread
From: Christoph Hellwig @ 2020-11-06 14:08 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Ilya Dryomov, Song Liu, Miquel Raynal, Richard Weinberger,
	Vignesh Raghavendra, Stefan Haberland, Jan Hoeppner, linux-block,
	ceph-devel, linux-bcache, linux-raid, linux-mtd, linux-s390,
	martin.petersen


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@lst.de>
---
 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.28.0


^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2020-11-11 16:53 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-06 14:08 [PATCH, RFC 11/10] block: propagate BLKROSET to all partitions Christoph Hellwig
2020-11-06 14:08 ` Christoph Hellwig
2020-11-06 19:16 ` Stefan Haberland
2020-11-06 19:16   ` Stefan Haberland
2020-11-07  7:28 ` Coly Li
2020-11-07  7:28   ` Coly Li
2020-11-11  4:38 ` Martin K. Petersen
2020-11-11  4:38   ` Martin K. Petersen
2020-11-11  8:03   ` Christoph Hellwig
2020-11-11  8:03     ` Christoph Hellwig
2020-11-11 16:53     ` Martin K. Petersen
2020-11-11 16:53       ` Martin K. Petersen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.