From: Christoph Hellwig <hch@lst.de>
To: Jens Axboe <axboe@kernel.dk>
Cc: Ilya Dryomov <idryomov@gmail.com>, Song Liu <song@kernel.org>,
Miquel Raynal <miquel.raynal@bootlin.com>,
Richard Weinberger <richard@nod.at>,
Vignesh Raghavendra <vigneshr@ti.com>,
Stefan Haberland <sth@linux.ibm.com>,
Jan Hoeppner <hoeppner@linux.ibm.com>,
linux-block@vger.kernel.org, ceph-devel@vger.kernel.org,
linux-bcache@vger.kernel.org, linux-raid@vger.kernel.org,
linux-mtd@lists.infradead.org, linux-s390@vger.kernel.org,
martin.petersen@oracle.com
Subject: [PATCH, RFC 11/10] block: propagate BLKROSET to all partitions
Date: Fri, 6 Nov 2020 15:08:17 +0100 [thread overview]
Message-ID: <20201106140817.GA23557@lst.de> (raw)
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
next reply other threads:[~2020-11-06 14:08 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-06 14:08 Christoph Hellwig [this message]
2020-11-06 19:16 ` [PATCH, RFC 11/10] block: propagate BLKROSET to all partitions 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201106140817.GA23557@lst.de \
--to=hch@lst.de \
--cc=axboe@kernel.dk \
--cc=ceph-devel@vger.kernel.org \
--cc=hoeppner@linux.ibm.com \
--cc=idryomov@gmail.com \
--cc=linux-bcache@vger.kernel.org \
--cc=linux-block@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=linux-raid@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=miquel.raynal@bootlin.com \
--cc=richard@nod.at \
--cc=song@kernel.org \
--cc=sth@linux.ibm.com \
--cc=vigneshr@ti.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).