From: Hannes Reinecke <hare@suse.de>
To: Christoph Hellwig <hch@lst.de>, Jens Axboe <axboe@kernel.dk>
Cc: "Martin K . Petersen" <martin.petersen@oracle.com>,
Oleksii Kurochko <olkuroch@cisco.com>,
Sagi Grimberg <sagi@grimberg.me>,
Mike Snitzer <snitzer@redhat.com>,
Ilya Dryomov <idryomov@gmail.com>,
Dongsheng Yang <dongsheng.yang@easystack.cn>,
ceph-devel@vger.kernel.org, dm-devel@redhat.com,
linux-block@vger.kernel.org, linux-nvme@lists.infradead.org
Subject: Re: [PATCH 1/4] block: add a hard-readonly flag to struct gendisk
Date: Mon, 30 Nov 2020 08:55:54 +0100 [thread overview]
Message-ID: <d28dc6f5-bae1-ddfa-8874-9c22235a69f3@suse.de> (raw)
In-Reply-To: <20201129181926.897775-2-hch@lst.de>
On 11/29/20 7:19 PM, Christoph Hellwig wrote:
> Commit 20bd1d026aac ("scsi: sd: Keep disk read-only when re-reading
> partition") addressed a long-standing problem with user read-only
> policy being overridden as a result of a device-initiated revalidate.
> The commit has since been reverted due to a regression that left some
> USB devices read-only indefinitely.
>
> To fix the underlying problems with revalidate we need to keep track
> of hardware state and user policy separately.
>
> The gendisk has been updated to reflect the current hardware state set
> by the device driver. This is done to allow returning the device to
> the hardware state once the user clears the BLKROSET flag.
>
> The resulting semantics are as follows:
>
> - If BLKROSET is used to set a whole-disk device read-only, any
> partitions will end up in a read-only state until the user
> explicitly clears the flag.
>
> - If BLKROSET sets a given partition read-only, that partition will
> remain read-only even if the underlying storage stack initiates a
> revalidate. However, the BLKRRPART ioctl will cause the partition
> table to be dropped and any user policy on partitions will be lost.
>
> - If BLKROSET has not been set, both the whole disk device and any
> partitions will reflect the current write-protect state of the
> underlying device.
>
> Based on a patch from Martin K. Petersen <martin.petersen@oracle.com>.
>
> Reported-by: Oleksii Kurochko <olkuroch@cisco.com>
> Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=201221
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
> block/blk-core.c | 2 +-
> block/genhd.c | 34 +++++++++++++++++++---------------
> block/partitions/core.c | 3 +--
> include/linux/genhd.h | 6 ++++--
> 4 files changed, 25 insertions(+), 20 deletions(-)
>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Cheers,
Hannes
--
Dr. Hannes Reinecke Kernel Storage Architect
hare@suse.de +49 911 74053 688
SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg
HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer
next prev parent reply other threads:[~2020-11-30 7:57 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-29 18:19 split hard read-only vs read-only policy v2 Christoph Hellwig
2020-11-29 18:19 ` [PATCH 1/4] block: add a hard-readonly flag to struct gendisk Christoph Hellwig
2020-11-30 1:23 ` Alex Elder
2020-11-30 7:55 ` Hannes Reinecke [this message]
2020-12-03 4:04 ` Martin K. Petersen
2020-12-03 8:53 ` Christoph Hellwig
2020-12-03 14:01 ` Martin K. Petersen
2020-11-29 18:19 ` [PATCH 2/4] rbd: remove the ->set_read_only method Christoph Hellwig
2020-11-30 7:56 ` Hannes Reinecke
2020-11-29 18:19 ` [PATCH 3/4] nvme: allow revalidate to set a namespace read-only Christoph Hellwig
2020-11-29 21:13 ` Chaitanya Kulkarni
2020-11-30 7:57 ` Hannes Reinecke
2020-11-29 18:19 ` [PATCH 4/4] dm: use bdev_read_only to check if a device is read-only Christoph Hellwig
2020-11-30 7:58 ` Hannes Reinecke
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=d28dc6f5-bae1-ddfa-8874-9c22235a69f3@suse.de \
--to=hare@suse.de \
--cc=axboe@kernel.dk \
--cc=ceph-devel@vger.kernel.org \
--cc=dm-devel@redhat.com \
--cc=dongsheng.yang@easystack.cn \
--cc=hch@lst.de \
--cc=idryomov@gmail.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=martin.petersen@oracle.com \
--cc=olkuroch@cisco.com \
--cc=sagi@grimberg.me \
--cc=snitzer@redhat.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).