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


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


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

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

Thread overview: 6+ 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 19:16 ` Stefan Haberland
2020-11-07  7:28 ` Coly Li
2020-11-11  4:38 ` Martin K. Petersen
2020-11-11  8:03   ` Christoph Hellwig
2020-11-11 16:53     ` Martin K. Petersen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).