All of lore.kernel.org
 help / color / mirror / Atom feed
* split hard read-only vs read-only policy v2
@ 2020-12-07 13:19 ` Christoph Hellwig
  0 siblings, 0 replies; 90+ messages in thread
From: Christoph Hellwig @ 2020-12-07 13:19 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Martin K . Petersen, Oleksii Kurochko, Sagi Grimberg,
	Mike Snitzer, Ilya Dryomov, Dongsheng Yang, ceph-devel, dm-devel,
	linux-block, linux-nvme

Hi Jens,

this series resurrects a patch from Martin to properly split the flag
indicating a disk has been set read-only by the hardware vs the userspace
policy set through the BLKROSET ioctl.

Note that the last patch only applies to for-next and not to
for-5.11/block.  I can hold it back for the first NVMe pull request after
Linus pulled the block tree.

A git tree is available here:

    git://git.infradead.org/users/hch/block.git block-hard-ro

Gitweb:

    http://git.infradead.org/users/hch/block.git/shortlog/refs/heads/block-hard-ro

Changes since v2:
 - fix a few typos
 - add a patch to propagate the read-only status from the whole device to
   partitions
 - add a patch to remove a pointless check from bdev_read_only

Changes since v1:
 - don't propagate the policy flag from the whole disk to partitions
 - rebased on top of the merge block_device and hd_struct series

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

* split hard read-only vs read-only policy v2
@ 2020-12-07 13:19 ` Christoph Hellwig
  0 siblings, 0 replies; 90+ messages in thread
From: Christoph Hellwig @ 2020-12-07 13:19 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Sagi Grimberg, Mike Snitzer, Oleksii Kurochko, Dongsheng Yang,
	linux-block, dm-devel, linux-nvme, Martin K . Petersen,
	Ilya Dryomov, ceph-devel

Hi Jens,

this series resurrects a patch from Martin to properly split the flag
indicating a disk has been set read-only by the hardware vs the userspace
policy set through the BLKROSET ioctl.

Note that the last patch only applies to for-next and not to
for-5.11/block.  I can hold it back for the first NVMe pull request after
Linus pulled the block tree.

A git tree is available here:

    git://git.infradead.org/users/hch/block.git block-hard-ro

Gitweb:

    http://git.infradead.org/users/hch/block.git/shortlog/refs/heads/block-hard-ro

Changes since v2:
 - fix a few typos
 - add a patch to propagate the read-only status from the whole device to
   partitions
 - add a patch to remove a pointless check from bdev_read_only

Changes since v1:
 - don't propagate the policy flag from the whole disk to partitions
 - rebased on top of the merge block_device and hd_struct series

_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

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

* [dm-devel] split hard read-only vs read-only policy v2
@ 2020-12-07 13:19 ` Christoph Hellwig
  0 siblings, 0 replies; 90+ messages in thread
From: Christoph Hellwig @ 2020-12-07 13:19 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Sagi Grimberg, Mike Snitzer, Oleksii Kurochko, Dongsheng Yang,
	linux-block, dm-devel, linux-nvme, Martin K . Petersen,
	Ilya Dryomov, ceph-devel

Hi Jens,

this series resurrects a patch from Martin to properly split the flag
indicating a disk has been set read-only by the hardware vs the userspace
policy set through the BLKROSET ioctl.

Note that the last patch only applies to for-next and not to
for-5.11/block.  I can hold it back for the first NVMe pull request after
Linus pulled the block tree.

A git tree is available here:

    git://git.infradead.org/users/hch/block.git block-hard-ro

Gitweb:

    http://git.infradead.org/users/hch/block.git/shortlog/refs/heads/block-hard-ro

Changes since v2:
 - fix a few typos
 - add a patch to propagate the read-only status from the whole device to
   partitions
 - add a patch to remove a pointless check from bdev_read_only

Changes since v1:
 - don't propagate the policy flag from the whole disk to partitions
 - rebased on top of the merge block_device and hd_struct series

--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel


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

* [PATCH 1/6] dm: use bdev_read_only to check if a device is read-only
  2020-12-07 13:19 ` Christoph Hellwig
  (?)
@ 2020-12-07 13:19   ` Christoph Hellwig
  -1 siblings, 0 replies; 90+ messages in thread
From: Christoph Hellwig @ 2020-12-07 13:19 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Martin K . Petersen, Oleksii Kurochko, Sagi Grimberg,
	Mike Snitzer, Ilya Dryomov, Dongsheng Yang, ceph-devel, dm-devel,
	linux-block, linux-nvme, Hannes Reinecke

dm-thin and dm-cache also work on partitions, so use the proper
interface to check if the device is read-only.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Hannes Reinecke <hare@suse.de>
---
 drivers/md/dm-cache-metadata.c | 2 +-
 drivers/md/dm-thin-metadata.c  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/md/dm-cache-metadata.c b/drivers/md/dm-cache-metadata.c
index af6d4f898e4c1d..89a73204dbf47f 100644
--- a/drivers/md/dm-cache-metadata.c
+++ b/drivers/md/dm-cache-metadata.c
@@ -449,7 +449,7 @@ static int __check_incompat_features(struct cache_disk_superblock *disk_super,
 	/*
 	 * Check for read-only metadata to skip the following RDWR checks.
 	 */
-	if (get_disk_ro(cmd->bdev->bd_disk))
+	if (bdev_read_only(cmd->bdev))
 		return 0;
 
 	features = le32_to_cpu(disk_super->compat_ro_flags) & ~DM_CACHE_FEATURE_COMPAT_RO_SUPP;
diff --git a/drivers/md/dm-thin-metadata.c b/drivers/md/dm-thin-metadata.c
index 6ebb2127f3e2e0..e75b20480e460e 100644
--- a/drivers/md/dm-thin-metadata.c
+++ b/drivers/md/dm-thin-metadata.c
@@ -636,7 +636,7 @@ static int __check_incompat_features(struct thin_disk_superblock *disk_super,
 	/*
 	 * Check for read-only metadata to skip the following RDWR checks.
 	 */
-	if (get_disk_ro(pmd->bdev->bd_disk))
+	if (bdev_read_only(pmd->bdev))
 		return 0;
 
 	features = le32_to_cpu(disk_super->compat_ro_flags) & ~THIN_FEATURE_COMPAT_RO_SUPP;
-- 
2.29.2


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

* [PATCH 1/6] dm: use bdev_read_only to check if a device is read-only
@ 2020-12-07 13:19   ` Christoph Hellwig
  0 siblings, 0 replies; 90+ messages in thread
From: Christoph Hellwig @ 2020-12-07 13:19 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Sagi Grimberg, Mike Snitzer, Oleksii Kurochko, Dongsheng Yang,
	linux-block, dm-devel, linux-nvme, Martin K . Petersen,
	Ilya Dryomov, ceph-devel, Hannes Reinecke

dm-thin and dm-cache also work on partitions, so use the proper
interface to check if the device is read-only.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Hannes Reinecke <hare@suse.de>
---
 drivers/md/dm-cache-metadata.c | 2 +-
 drivers/md/dm-thin-metadata.c  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/md/dm-cache-metadata.c b/drivers/md/dm-cache-metadata.c
index af6d4f898e4c1d..89a73204dbf47f 100644
--- a/drivers/md/dm-cache-metadata.c
+++ b/drivers/md/dm-cache-metadata.c
@@ -449,7 +449,7 @@ static int __check_incompat_features(struct cache_disk_superblock *disk_super,
 	/*
 	 * Check for read-only metadata to skip the following RDWR checks.
 	 */
-	if (get_disk_ro(cmd->bdev->bd_disk))
+	if (bdev_read_only(cmd->bdev))
 		return 0;
 
 	features = le32_to_cpu(disk_super->compat_ro_flags) & ~DM_CACHE_FEATURE_COMPAT_RO_SUPP;
diff --git a/drivers/md/dm-thin-metadata.c b/drivers/md/dm-thin-metadata.c
index 6ebb2127f3e2e0..e75b20480e460e 100644
--- a/drivers/md/dm-thin-metadata.c
+++ b/drivers/md/dm-thin-metadata.c
@@ -636,7 +636,7 @@ static int __check_incompat_features(struct thin_disk_superblock *disk_super,
 	/*
 	 * Check for read-only metadata to skip the following RDWR checks.
 	 */
-	if (get_disk_ro(pmd->bdev->bd_disk))
+	if (bdev_read_only(pmd->bdev))
 		return 0;
 
 	features = le32_to_cpu(disk_super->compat_ro_flags) & ~THIN_FEATURE_COMPAT_RO_SUPP;
-- 
2.29.2


_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

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

* [dm-devel] [PATCH 1/6] dm: use bdev_read_only to check if a device is read-only
@ 2020-12-07 13:19   ` Christoph Hellwig
  0 siblings, 0 replies; 90+ messages in thread
From: Christoph Hellwig @ 2020-12-07 13:19 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Sagi Grimberg, Mike Snitzer, Oleksii Kurochko, Dongsheng Yang,
	linux-block, dm-devel, linux-nvme, Martin K . Petersen,
	Ilya Dryomov, ceph-devel

dm-thin and dm-cache also work on partitions, so use the proper
interface to check if the device is read-only.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Hannes Reinecke <hare@suse.de>
---
 drivers/md/dm-cache-metadata.c | 2 +-
 drivers/md/dm-thin-metadata.c  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/md/dm-cache-metadata.c b/drivers/md/dm-cache-metadata.c
index af6d4f898e4c1d..89a73204dbf47f 100644
--- a/drivers/md/dm-cache-metadata.c
+++ b/drivers/md/dm-cache-metadata.c
@@ -449,7 +449,7 @@ static int __check_incompat_features(struct cache_disk_superblock *disk_super,
 	/*
 	 * Check for read-only metadata to skip the following RDWR checks.
 	 */
-	if (get_disk_ro(cmd->bdev->bd_disk))
+	if (bdev_read_only(cmd->bdev))
 		return 0;
 
 	features = le32_to_cpu(disk_super->compat_ro_flags) & ~DM_CACHE_FEATURE_COMPAT_RO_SUPP;
diff --git a/drivers/md/dm-thin-metadata.c b/drivers/md/dm-thin-metadata.c
index 6ebb2127f3e2e0..e75b20480e460e 100644
--- a/drivers/md/dm-thin-metadata.c
+++ b/drivers/md/dm-thin-metadata.c
@@ -636,7 +636,7 @@ static int __check_incompat_features(struct thin_disk_superblock *disk_super,
 	/*
 	 * Check for read-only metadata to skip the following RDWR checks.
 	 */
-	if (get_disk_ro(pmd->bdev->bd_disk))
+	if (bdev_read_only(pmd->bdev))
 		return 0;
 
 	features = le32_to_cpu(disk_super->compat_ro_flags) & ~THIN_FEATURE_COMPAT_RO_SUPP;
-- 
2.29.2

--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel


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

* [PATCH 2/6] block: remove the NULL bdev check in bdev_read_only
  2020-12-07 13:19 ` Christoph Hellwig
  (?)
@ 2020-12-07 13:19   ` Christoph Hellwig
  -1 siblings, 0 replies; 90+ messages in thread
From: Christoph Hellwig @ 2020-12-07 13:19 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Martin K . Petersen, Oleksii Kurochko, Sagi Grimberg,
	Mike Snitzer, Ilya Dryomov, Dongsheng Yang, ceph-devel, dm-devel,
	linux-block, linux-nvme

Only a single caller can end up in bdev_read_only, so move the check there.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 block/genhd.c | 3 ---
 fs/super.c    | 3 ++-
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/block/genhd.c b/block/genhd.c
index 09ff6cef028729..c87013879b8650 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -1445,11 +1445,8 @@ EXPORT_SYMBOL(set_disk_ro);
 
 int bdev_read_only(struct block_device *bdev)
 {
-	if (!bdev)
-		return 0;
 	return bdev->bd_read_only;
 }
-
 EXPORT_SYMBOL(bdev_read_only);
 
 /*
diff --git a/fs/super.c b/fs/super.c
index 2c6cdea2ab2d9e..5a1f384ffc74f6 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -865,7 +865,8 @@ int reconfigure_super(struct fs_context *fc)
 
 	if (fc->sb_flags_mask & SB_RDONLY) {
 #ifdef CONFIG_BLOCK
-		if (!(fc->sb_flags & SB_RDONLY) && bdev_read_only(sb->s_bdev))
+		if (!(fc->sb_flags & SB_RDONLY) && sb->s_bdev &&
+		    bdev_read_only(sb->s_bdev))
 			return -EACCES;
 #endif
 
-- 
2.29.2


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

* [PATCH 2/6] block: remove the NULL bdev check in bdev_read_only
@ 2020-12-07 13:19   ` Christoph Hellwig
  0 siblings, 0 replies; 90+ messages in thread
From: Christoph Hellwig @ 2020-12-07 13:19 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Sagi Grimberg, Mike Snitzer, Oleksii Kurochko, Dongsheng Yang,
	linux-block, dm-devel, linux-nvme, Martin K . Petersen,
	Ilya Dryomov, ceph-devel

Only a single caller can end up in bdev_read_only, so move the check there.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 block/genhd.c | 3 ---
 fs/super.c    | 3 ++-
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/block/genhd.c b/block/genhd.c
index 09ff6cef028729..c87013879b8650 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -1445,11 +1445,8 @@ EXPORT_SYMBOL(set_disk_ro);
 
 int bdev_read_only(struct block_device *bdev)
 {
-	if (!bdev)
-		return 0;
 	return bdev->bd_read_only;
 }
-
 EXPORT_SYMBOL(bdev_read_only);
 
 /*
diff --git a/fs/super.c b/fs/super.c
index 2c6cdea2ab2d9e..5a1f384ffc74f6 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -865,7 +865,8 @@ int reconfigure_super(struct fs_context *fc)
 
 	if (fc->sb_flags_mask & SB_RDONLY) {
 #ifdef CONFIG_BLOCK
-		if (!(fc->sb_flags & SB_RDONLY) && bdev_read_only(sb->s_bdev))
+		if (!(fc->sb_flags & SB_RDONLY) && sb->s_bdev &&
+		    bdev_read_only(sb->s_bdev))
 			return -EACCES;
 #endif
 
-- 
2.29.2


_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

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

* [dm-devel] [PATCH 2/6] block: remove the NULL bdev check in bdev_read_only
@ 2020-12-07 13:19   ` Christoph Hellwig
  0 siblings, 0 replies; 90+ messages in thread
From: Christoph Hellwig @ 2020-12-07 13:19 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Sagi Grimberg, Mike Snitzer, Oleksii Kurochko, Dongsheng Yang,
	linux-block, dm-devel, linux-nvme, Martin K . Petersen,
	Ilya Dryomov, ceph-devel

Only a single caller can end up in bdev_read_only, so move the check there.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 block/genhd.c | 3 ---
 fs/super.c    | 3 ++-
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/block/genhd.c b/block/genhd.c
index 09ff6cef028729..c87013879b8650 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -1445,11 +1445,8 @@ EXPORT_SYMBOL(set_disk_ro);
 
 int bdev_read_only(struct block_device *bdev)
 {
-	if (!bdev)
-		return 0;
 	return bdev->bd_read_only;
 }
-
 EXPORT_SYMBOL(bdev_read_only);
 
 /*
diff --git a/fs/super.c b/fs/super.c
index 2c6cdea2ab2d9e..5a1f384ffc74f6 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -865,7 +865,8 @@ int reconfigure_super(struct fs_context *fc)
 
 	if (fc->sb_flags_mask & SB_RDONLY) {
 #ifdef CONFIG_BLOCK
-		if (!(fc->sb_flags & SB_RDONLY) && bdev_read_only(sb->s_bdev))
+		if (!(fc->sb_flags & SB_RDONLY) && sb->s_bdev &&
+		    bdev_read_only(sb->s_bdev))
 			return -EACCES;
 #endif
 
-- 
2.29.2

--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel


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

* [PATCH 3/6] block: add a hard-readonly flag to struct gendisk
  2020-12-07 13:19 ` Christoph Hellwig
  (?)
@ 2020-12-07 13:19   ` Christoph Hellwig
  -1 siblings, 0 replies; 90+ messages in thread
From: Christoph Hellwig @ 2020-12-07 13:19 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Martin K . Petersen, Oleksii Kurochko, Sagi Grimberg,
	Mike Snitzer, Ilya Dryomov, Dongsheng Yang, ceph-devel, dm-devel,
	linux-block, linux-nvme, Hannes Reinecke

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 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>
Reviewed-by: Hannes Reinecke <hare@suse.de>
---
 block/blk-core.c        |  2 +-
 block/genhd.c           | 33 +++++++++++++++++++--------------
 block/partitions/core.c |  3 +--
 include/linux/genhd.h   |  6 ++++--
 4 files changed, 25 insertions(+), 19 deletions(-)

diff --git a/block/blk-core.c b/block/blk-core.c
index ad041e903b0a8f..ecd68415c6acad 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -693,7 +693,7 @@ static inline bool should_fail_request(struct block_device *part,
 
 static inline bool bio_check_ro(struct bio *bio)
 {
-	if (op_is_write(bio_op(bio)) && bio->bi_bdev->bd_read_only) {
+	if (op_is_write(bio_op(bio)) && bdev_read_only(bio->bi_bdev))
 		char b[BDEVNAME_SIZE];
 
 		if (op_is_flush(bio->bi_opf) && !bio_sectors(bio))
diff --git a/block/genhd.c b/block/genhd.c
index c87013879b8650..878f94727aaa96 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -1425,27 +1425,32 @@ static void set_disk_ro_uevent(struct gendisk *gd, int ro)
 	kobject_uevent_env(&disk_to_dev(gd)->kobj, KOBJ_CHANGE, envp);
 }
 
-void set_disk_ro(struct gendisk *disk, int flag)
+/**
+ * set_disk_ro - set a gendisk read-only
+ * @disk:	gendisk to operate on
+ * @ready_only:	%true to set the disk read-only, %false set the disk read/write
+ *
+ * This function is used to indicate whether a given disk device should have its
+ * read-only flag set. set_disk_ro() is typically used by device drivers to
+ * indicate whether the underlying physical device is write-protected.
+ */
+void set_disk_ro(struct gendisk *disk, bool read_only)
 {
-	struct disk_part_iter piter;
-	struct block_device *part;
-
-	if (disk->part0->bd_read_only != flag) {
-		set_disk_ro_uevent(disk, flag);
-		disk->part0->bd_read_only = flag;
+	if (read_only) {
+		if (test_and_set_bit(GD_READ_ONLY, &disk->state))
+			return;
+	} else {
+		if (!test_and_clear_bit(GD_READ_ONLY, &disk->state))
+			return;
 	}
-
-	disk_part_iter_init(&piter, disk, DISK_PITER_INCL_EMPTY);
-	while ((part = disk_part_iter_next(&piter)))
-		part->bd_read_only = flag;
-	disk_part_iter_exit(&piter);
+	set_disk_ro_uevent(disk, read_only);
 }
-
 EXPORT_SYMBOL(set_disk_ro);
 
 int bdev_read_only(struct block_device *bdev)
 {
-	return bdev->bd_read_only;
+	return bdev->bd_read_only ||
+		test_bit(GD_READ_ONLY, &bdev->bd_disk->state);
 }
 EXPORT_SYMBOL(bdev_read_only);
 
diff --git a/block/partitions/core.c b/block/partitions/core.c
index c88f03ddaefe29..278e2419b163bb 100644
--- a/block/partitions/core.c
+++ b/block/partitions/core.c
@@ -194,7 +194,7 @@ static ssize_t part_start_show(struct device *dev,
 static ssize_t part_ro_show(struct device *dev,
 			    struct device_attribute *attr, char *buf)
 {
-	return sprintf(buf, "%d\n", dev_to_bdev(dev)->bd_read_only);
+	return sprintf(buf, "%d\n", bdev_read_only(dev_to_bdev(dev)));
 }
 
 static ssize_t part_alignment_offset_show(struct device *dev,
@@ -348,7 +348,6 @@ static struct block_device *add_partition(struct gendisk *disk, int partno,
 
 	bdev->bd_start_sect = start;
 	bdev_set_nr_sectors(bdev, len);
-	bdev->bd_read_only = get_disk_ro(disk);
 
 	if (info) {
 		err = -ENOMEM;
diff --git a/include/linux/genhd.h b/include/linux/genhd.h
index e8821bfe07b955..f364619092cca0 100644
--- a/include/linux/genhd.h
+++ b/include/linux/genhd.h
@@ -152,6 +152,7 @@ struct gendisk {
 	int flags;
 	unsigned long state;
 #define GD_NEED_PART_SCAN		0
+#define GD_READ_ONLY			1
 	struct kobject *slave_dir;
 
 	struct timer_rand_state *random;
@@ -238,11 +239,12 @@ static inline void add_disk_no_queue_reg(struct gendisk *disk)
 extern void del_gendisk(struct gendisk *gp);
 extern struct block_device *bdget_disk(struct gendisk *disk, int partno);
 
-extern void set_disk_ro(struct gendisk *disk, int flag);
+void set_disk_ro(struct gendisk *disk, bool read_only);
 
 static inline int get_disk_ro(struct gendisk *disk)
 {
-	return disk->part0->bd_read_only;
+	return disk->part0->bd_read_only ||
+		test_bit(GD_READ_ONLY, &disk->state);
 }
 
 extern void disk_block_events(struct gendisk *disk);
-- 
2.29.2


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

* [PATCH 3/6] block: add a hard-readonly flag to struct gendisk
@ 2020-12-07 13:19   ` Christoph Hellwig
  0 siblings, 0 replies; 90+ messages in thread
From: Christoph Hellwig @ 2020-12-07 13:19 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Sagi Grimberg, Mike Snitzer, Oleksii Kurochko, Dongsheng Yang,
	linux-block, dm-devel, linux-nvme, Martin K . Petersen,
	Ilya Dryomov, ceph-devel, Hannes Reinecke

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 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>
Reviewed-by: Hannes Reinecke <hare@suse.de>
---
 block/blk-core.c        |  2 +-
 block/genhd.c           | 33 +++++++++++++++++++--------------
 block/partitions/core.c |  3 +--
 include/linux/genhd.h   |  6 ++++--
 4 files changed, 25 insertions(+), 19 deletions(-)

diff --git a/block/blk-core.c b/block/blk-core.c
index ad041e903b0a8f..ecd68415c6acad 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -693,7 +693,7 @@ static inline bool should_fail_request(struct block_device *part,
 
 static inline bool bio_check_ro(struct bio *bio)
 {
-	if (op_is_write(bio_op(bio)) && bio->bi_bdev->bd_read_only) {
+	if (op_is_write(bio_op(bio)) && bdev_read_only(bio->bi_bdev))
 		char b[BDEVNAME_SIZE];
 
 		if (op_is_flush(bio->bi_opf) && !bio_sectors(bio))
diff --git a/block/genhd.c b/block/genhd.c
index c87013879b8650..878f94727aaa96 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -1425,27 +1425,32 @@ static void set_disk_ro_uevent(struct gendisk *gd, int ro)
 	kobject_uevent_env(&disk_to_dev(gd)->kobj, KOBJ_CHANGE, envp);
 }
 
-void set_disk_ro(struct gendisk *disk, int flag)
+/**
+ * set_disk_ro - set a gendisk read-only
+ * @disk:	gendisk to operate on
+ * @ready_only:	%true to set the disk read-only, %false set the disk read/write
+ *
+ * This function is used to indicate whether a given disk device should have its
+ * read-only flag set. set_disk_ro() is typically used by device drivers to
+ * indicate whether the underlying physical device is write-protected.
+ */
+void set_disk_ro(struct gendisk *disk, bool read_only)
 {
-	struct disk_part_iter piter;
-	struct block_device *part;
-
-	if (disk->part0->bd_read_only != flag) {
-		set_disk_ro_uevent(disk, flag);
-		disk->part0->bd_read_only = flag;
+	if (read_only) {
+		if (test_and_set_bit(GD_READ_ONLY, &disk->state))
+			return;
+	} else {
+		if (!test_and_clear_bit(GD_READ_ONLY, &disk->state))
+			return;
 	}
-
-	disk_part_iter_init(&piter, disk, DISK_PITER_INCL_EMPTY);
-	while ((part = disk_part_iter_next(&piter)))
-		part->bd_read_only = flag;
-	disk_part_iter_exit(&piter);
+	set_disk_ro_uevent(disk, read_only);
 }
-
 EXPORT_SYMBOL(set_disk_ro);
 
 int bdev_read_only(struct block_device *bdev)
 {
-	return bdev->bd_read_only;
+	return bdev->bd_read_only ||
+		test_bit(GD_READ_ONLY, &bdev->bd_disk->state);
 }
 EXPORT_SYMBOL(bdev_read_only);
 
diff --git a/block/partitions/core.c b/block/partitions/core.c
index c88f03ddaefe29..278e2419b163bb 100644
--- a/block/partitions/core.c
+++ b/block/partitions/core.c
@@ -194,7 +194,7 @@ static ssize_t part_start_show(struct device *dev,
 static ssize_t part_ro_show(struct device *dev,
 			    struct device_attribute *attr, char *buf)
 {
-	return sprintf(buf, "%d\n", dev_to_bdev(dev)->bd_read_only);
+	return sprintf(buf, "%d\n", bdev_read_only(dev_to_bdev(dev)));
 }
 
 static ssize_t part_alignment_offset_show(struct device *dev,
@@ -348,7 +348,6 @@ static struct block_device *add_partition(struct gendisk *disk, int partno,
 
 	bdev->bd_start_sect = start;
 	bdev_set_nr_sectors(bdev, len);
-	bdev->bd_read_only = get_disk_ro(disk);
 
 	if (info) {
 		err = -ENOMEM;
diff --git a/include/linux/genhd.h b/include/linux/genhd.h
index e8821bfe07b955..f364619092cca0 100644
--- a/include/linux/genhd.h
+++ b/include/linux/genhd.h
@@ -152,6 +152,7 @@ struct gendisk {
 	int flags;
 	unsigned long state;
 #define GD_NEED_PART_SCAN		0
+#define GD_READ_ONLY			1
 	struct kobject *slave_dir;
 
 	struct timer_rand_state *random;
@@ -238,11 +239,12 @@ static inline void add_disk_no_queue_reg(struct gendisk *disk)
 extern void del_gendisk(struct gendisk *gp);
 extern struct block_device *bdget_disk(struct gendisk *disk, int partno);
 
-extern void set_disk_ro(struct gendisk *disk, int flag);
+void set_disk_ro(struct gendisk *disk, bool read_only);
 
 static inline int get_disk_ro(struct gendisk *disk)
 {
-	return disk->part0->bd_read_only;
+	return disk->part0->bd_read_only ||
+		test_bit(GD_READ_ONLY, &disk->state);
 }
 
 extern void disk_block_events(struct gendisk *disk);
-- 
2.29.2


_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

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

* [dm-devel] [PATCH 3/6] block: add a hard-readonly flag to struct gendisk
@ 2020-12-07 13:19   ` Christoph Hellwig
  0 siblings, 0 replies; 90+ messages in thread
From: Christoph Hellwig @ 2020-12-07 13:19 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Sagi Grimberg, Mike Snitzer, Oleksii Kurochko, Dongsheng Yang,
	linux-block, dm-devel, linux-nvme, Martin K . Petersen,
	Ilya Dryomov, ceph-devel

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 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>
Reviewed-by: Hannes Reinecke <hare@suse.de>
---
 block/blk-core.c        |  2 +-
 block/genhd.c           | 33 +++++++++++++++++++--------------
 block/partitions/core.c |  3 +--
 include/linux/genhd.h   |  6 ++++--
 4 files changed, 25 insertions(+), 19 deletions(-)

diff --git a/block/blk-core.c b/block/blk-core.c
index ad041e903b0a8f..ecd68415c6acad 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -693,7 +693,7 @@ static inline bool should_fail_request(struct block_device *part,
 
 static inline bool bio_check_ro(struct bio *bio)
 {
-	if (op_is_write(bio_op(bio)) && bio->bi_bdev->bd_read_only) {
+	if (op_is_write(bio_op(bio)) && bdev_read_only(bio->bi_bdev))
 		char b[BDEVNAME_SIZE];
 
 		if (op_is_flush(bio->bi_opf) && !bio_sectors(bio))
diff --git a/block/genhd.c b/block/genhd.c
index c87013879b8650..878f94727aaa96 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -1425,27 +1425,32 @@ static void set_disk_ro_uevent(struct gendisk *gd, int ro)
 	kobject_uevent_env(&disk_to_dev(gd)->kobj, KOBJ_CHANGE, envp);
 }
 
-void set_disk_ro(struct gendisk *disk, int flag)
+/**
+ * set_disk_ro - set a gendisk read-only
+ * @disk:	gendisk to operate on
+ * @ready_only:	%true to set the disk read-only, %false set the disk read/write
+ *
+ * This function is used to indicate whether a given disk device should have its
+ * read-only flag set. set_disk_ro() is typically used by device drivers to
+ * indicate whether the underlying physical device is write-protected.
+ */
+void set_disk_ro(struct gendisk *disk, bool read_only)
 {
-	struct disk_part_iter piter;
-	struct block_device *part;
-
-	if (disk->part0->bd_read_only != flag) {
-		set_disk_ro_uevent(disk, flag);
-		disk->part0->bd_read_only = flag;
+	if (read_only) {
+		if (test_and_set_bit(GD_READ_ONLY, &disk->state))
+			return;
+	} else {
+		if (!test_and_clear_bit(GD_READ_ONLY, &disk->state))
+			return;
 	}
-
-	disk_part_iter_init(&piter, disk, DISK_PITER_INCL_EMPTY);
-	while ((part = disk_part_iter_next(&piter)))
-		part->bd_read_only = flag;
-	disk_part_iter_exit(&piter);
+	set_disk_ro_uevent(disk, read_only);
 }
-
 EXPORT_SYMBOL(set_disk_ro);
 
 int bdev_read_only(struct block_device *bdev)
 {
-	return bdev->bd_read_only;
+	return bdev->bd_read_only ||
+		test_bit(GD_READ_ONLY, &bdev->bd_disk->state);
 }
 EXPORT_SYMBOL(bdev_read_only);
 
diff --git a/block/partitions/core.c b/block/partitions/core.c
index c88f03ddaefe29..278e2419b163bb 100644
--- a/block/partitions/core.c
+++ b/block/partitions/core.c
@@ -194,7 +194,7 @@ static ssize_t part_start_show(struct device *dev,
 static ssize_t part_ro_show(struct device *dev,
 			    struct device_attribute *attr, char *buf)
 {
-	return sprintf(buf, "%d\n", dev_to_bdev(dev)->bd_read_only);
+	return sprintf(buf, "%d\n", bdev_read_only(dev_to_bdev(dev)));
 }
 
 static ssize_t part_alignment_offset_show(struct device *dev,
@@ -348,7 +348,6 @@ static struct block_device *add_partition(struct gendisk *disk, int partno,
 
 	bdev->bd_start_sect = start;
 	bdev_set_nr_sectors(bdev, len);
-	bdev->bd_read_only = get_disk_ro(disk);
 
 	if (info) {
 		err = -ENOMEM;
diff --git a/include/linux/genhd.h b/include/linux/genhd.h
index e8821bfe07b955..f364619092cca0 100644
--- a/include/linux/genhd.h
+++ b/include/linux/genhd.h
@@ -152,6 +152,7 @@ struct gendisk {
 	int flags;
 	unsigned long state;
 #define GD_NEED_PART_SCAN		0
+#define GD_READ_ONLY			1
 	struct kobject *slave_dir;
 
 	struct timer_rand_state *random;
@@ -238,11 +239,12 @@ static inline void add_disk_no_queue_reg(struct gendisk *disk)
 extern void del_gendisk(struct gendisk *gp);
 extern struct block_device *bdget_disk(struct gendisk *disk, int partno);
 
-extern void set_disk_ro(struct gendisk *disk, int flag);
+void set_disk_ro(struct gendisk *disk, bool read_only);
 
 static inline int get_disk_ro(struct gendisk *disk)
 {
-	return disk->part0->bd_read_only;
+	return disk->part0->bd_read_only ||
+		test_bit(GD_READ_ONLY, &disk->state);
 }
 
 extern void disk_block_events(struct gendisk *disk);
-- 
2.29.2

--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel


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

* [PATCH 4/6] block: propagate BLKROSET on the whole device to all partitions
  2020-12-07 13:19 ` Christoph Hellwig
  (?)
@ 2020-12-07 13:19   ` Christoph Hellwig
  -1 siblings, 0 replies; 90+ messages in thread
From: Christoph Hellwig @ 2020-12-07 13:19 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Martin K . Petersen, Oleksii Kurochko, Sagi Grimberg,
	Mike Snitzer, Ilya Dryomov, Dongsheng Yang, ceph-devel, dm-devel,
	linux-block, linux-nvme

Change the policy so that a BLKROSET on the whole device also affects
partitions.  To quote Martin K. Petersen:

It's very common for database folks to twiddle the read-only state of
block devices and partitions. I know that our users will find it very
counter-intuitive that setting /dev/sda read-only won't prevent writes
to /dev/sda1.

The existing behavior is inconsistent in the sense that doing:

permits writes. But:

<something triggers revalidate>

doesn't.

And a subsequent:

doesn't work either since sda1's read-only policy has been inherited
from the whole-disk device.

You need to do:

after setting the whole-disk device rw to effectuate the same change on
the partitions, otherwise they are stuck being read-only indefinitely.

However, setting the read-only policy on a partition does *not* require
the revalidate step. As a matter of fact, doing the revalidate will blow
away the policy setting you just made.

So the user needs to take different actions depending on whether they
are trying to read-protect a whole-disk device or a partition. Despite
using the same ioctl. That is really confusing.

I have lost count how many times our customers have had data clobbered
because of ambiguity of the existing whole-disk device policy. The
current behavior violates the principle of least surprise by letting the
user think they write protected the whole disk when they actually
didn't.

Suggested-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 block/genhd.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/block/genhd.c b/block/genhd.c
index 878f94727aaa96..c214fcd25a05c9 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -1449,8 +1449,7 @@ EXPORT_SYMBOL(set_disk_ro);
 
 int bdev_read_only(struct block_device *bdev)
 {
-	return bdev->bd_read_only ||
-		test_bit(GD_READ_ONLY, &bdev->bd_disk->state);
+	return bdev->bd_read_only || get_disk_ro(bdev->bd_disk);
 }
 EXPORT_SYMBOL(bdev_read_only);
 
-- 
2.29.2


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

* [PATCH 4/6] block: propagate BLKROSET on the whole device to all partitions
@ 2020-12-07 13:19   ` Christoph Hellwig
  0 siblings, 0 replies; 90+ messages in thread
From: Christoph Hellwig @ 2020-12-07 13:19 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Sagi Grimberg, Mike Snitzer, Oleksii Kurochko, Dongsheng Yang,
	linux-block, dm-devel, linux-nvme, Martin K . Petersen,
	Ilya Dryomov, ceph-devel

Change the policy so that a BLKROSET on the whole device also affects
partitions.  To quote Martin K. Petersen:

It's very common for database folks to twiddle the read-only state of
block devices and partitions. I know that our users will find it very
counter-intuitive that setting /dev/sda read-only won't prevent writes
to /dev/sda1.

The existing behavior is inconsistent in the sense that doing:

permits writes. But:

<something triggers revalidate>

doesn't.

And a subsequent:

doesn't work either since sda1's read-only policy has been inherited
from the whole-disk device.

You need to do:

after setting the whole-disk device rw to effectuate the same change on
the partitions, otherwise they are stuck being read-only indefinitely.

However, setting the read-only policy on a partition does *not* require
the revalidate step. As a matter of fact, doing the revalidate will blow
away the policy setting you just made.

So the user needs to take different actions depending on whether they
are trying to read-protect a whole-disk device or a partition. Despite
using the same ioctl. That is really confusing.

I have lost count how many times our customers have had data clobbered
because of ambiguity of the existing whole-disk device policy. The
current behavior violates the principle of least surprise by letting the
user think they write protected the whole disk when they actually
didn't.

Suggested-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 block/genhd.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/block/genhd.c b/block/genhd.c
index 878f94727aaa96..c214fcd25a05c9 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -1449,8 +1449,7 @@ EXPORT_SYMBOL(set_disk_ro);
 
 int bdev_read_only(struct block_device *bdev)
 {
-	return bdev->bd_read_only ||
-		test_bit(GD_READ_ONLY, &bdev->bd_disk->state);
+	return bdev->bd_read_only || get_disk_ro(bdev->bd_disk);
 }
 EXPORT_SYMBOL(bdev_read_only);
 
-- 
2.29.2


_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

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

* [dm-devel] [PATCH 4/6] block: propagate BLKROSET on the whole device to all partitions
@ 2020-12-07 13:19   ` Christoph Hellwig
  0 siblings, 0 replies; 90+ messages in thread
From: Christoph Hellwig @ 2020-12-07 13:19 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Sagi Grimberg, Mike Snitzer, Oleksii Kurochko, Dongsheng Yang,
	linux-block, dm-devel, linux-nvme, Martin K . Petersen,
	Ilya Dryomov, ceph-devel

Change the policy so that a BLKROSET on the whole device also affects
partitions.  To quote Martin K. Petersen:

It's very common for database folks to twiddle the read-only state of
block devices and partitions. I know that our users will find it very
counter-intuitive that setting /dev/sda read-only won't prevent writes
to /dev/sda1.

The existing behavior is inconsistent in the sense that doing:

permits writes. But:

<something triggers revalidate>

doesn't.

And a subsequent:

doesn't work either since sda1's read-only policy has been inherited
from the whole-disk device.

You need to do:

after setting the whole-disk device rw to effectuate the same change on
the partitions, otherwise they are stuck being read-only indefinitely.

However, setting the read-only policy on a partition does *not* require
the revalidate step. As a matter of fact, doing the revalidate will blow
away the policy setting you just made.

So the user needs to take different actions depending on whether they
are trying to read-protect a whole-disk device or a partition. Despite
using the same ioctl. That is really confusing.

I have lost count how many times our customers have had data clobbered
because of ambiguity of the existing whole-disk device policy. The
current behavior violates the principle of least surprise by letting the
user think they write protected the whole disk when they actually
didn't.

Suggested-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 block/genhd.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/block/genhd.c b/block/genhd.c
index 878f94727aaa96..c214fcd25a05c9 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -1449,8 +1449,7 @@ EXPORT_SYMBOL(set_disk_ro);
 
 int bdev_read_only(struct block_device *bdev)
 {
-	return bdev->bd_read_only ||
-		test_bit(GD_READ_ONLY, &bdev->bd_disk->state);
+	return bdev->bd_read_only || get_disk_ro(bdev->bd_disk);
 }
 EXPORT_SYMBOL(bdev_read_only);
 
-- 
2.29.2

--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel


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

* [PATCH 5/6] rbd: remove the ->set_read_only method
  2020-12-07 13:19 ` Christoph Hellwig
  (?)
@ 2020-12-07 13:19   ` Christoph Hellwig
  -1 siblings, 0 replies; 90+ messages in thread
From: Christoph Hellwig @ 2020-12-07 13:19 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Martin K . Petersen, Oleksii Kurochko, Sagi Grimberg,
	Mike Snitzer, Ilya Dryomov, Dongsheng Yang, ceph-devel, dm-devel,
	linux-block, linux-nvme, Hannes Reinecke

Now that the hardware read-only state can't be changed by the BLKROSET
ioctl, the code in this method is not required anymore.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Hannes Reinecke <hare@suse.de>
---
 drivers/block/rbd.c | 19 -------------------
 1 file changed, 19 deletions(-)

diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index 2ed79b09439a82..2c64ca15ca079f 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -692,29 +692,10 @@ static void rbd_release(struct gendisk *disk, fmode_t mode)
 	put_device(&rbd_dev->dev);
 }
 
-static int rbd_set_read_only(struct block_device *bdev, bool ro)
-{
-	struct rbd_device *rbd_dev = bdev->bd_disk->private_data;
-
-	/*
-	 * Both images mapped read-only and snapshots can't be marked
-	 * read-write.
-	 */
-	if (!ro) {
-		if (rbd_is_ro(rbd_dev))
-			return -EROFS;
-
-		rbd_assert(!rbd_is_snap(rbd_dev));
-	}
-
-	return 0;
-}
-
 static const struct block_device_operations rbd_bd_ops = {
 	.owner			= THIS_MODULE,
 	.open			= rbd_open,
 	.release		= rbd_release,
-	.set_read_only		= rbd_set_read_only,
 };
 
 /*
-- 
2.29.2


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

* [PATCH 5/6] rbd: remove the ->set_read_only method
@ 2020-12-07 13:19   ` Christoph Hellwig
  0 siblings, 0 replies; 90+ messages in thread
From: Christoph Hellwig @ 2020-12-07 13:19 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Sagi Grimberg, Mike Snitzer, Oleksii Kurochko, Dongsheng Yang,
	linux-block, dm-devel, linux-nvme, Martin K . Petersen,
	Ilya Dryomov, ceph-devel, Hannes Reinecke

Now that the hardware read-only state can't be changed by the BLKROSET
ioctl, the code in this method is not required anymore.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Hannes Reinecke <hare@suse.de>
---
 drivers/block/rbd.c | 19 -------------------
 1 file changed, 19 deletions(-)

diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index 2ed79b09439a82..2c64ca15ca079f 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -692,29 +692,10 @@ static void rbd_release(struct gendisk *disk, fmode_t mode)
 	put_device(&rbd_dev->dev);
 }
 
-static int rbd_set_read_only(struct block_device *bdev, bool ro)
-{
-	struct rbd_device *rbd_dev = bdev->bd_disk->private_data;
-
-	/*
-	 * Both images mapped read-only and snapshots can't be marked
-	 * read-write.
-	 */
-	if (!ro) {
-		if (rbd_is_ro(rbd_dev))
-			return -EROFS;
-
-		rbd_assert(!rbd_is_snap(rbd_dev));
-	}
-
-	return 0;
-}
-
 static const struct block_device_operations rbd_bd_ops = {
 	.owner			= THIS_MODULE,
 	.open			= rbd_open,
 	.release		= rbd_release,
-	.set_read_only		= rbd_set_read_only,
 };
 
 /*
-- 
2.29.2


_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

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

* [dm-devel] [PATCH 5/6] rbd: remove the ->set_read_only method
@ 2020-12-07 13:19   ` Christoph Hellwig
  0 siblings, 0 replies; 90+ messages in thread
From: Christoph Hellwig @ 2020-12-07 13:19 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Sagi Grimberg, Mike Snitzer, Oleksii Kurochko, Dongsheng Yang,
	linux-block, dm-devel, linux-nvme, Martin K . Petersen,
	Ilya Dryomov, ceph-devel

Now that the hardware read-only state can't be changed by the BLKROSET
ioctl, the code in this method is not required anymore.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Hannes Reinecke <hare@suse.de>
---
 drivers/block/rbd.c | 19 -------------------
 1 file changed, 19 deletions(-)

diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index 2ed79b09439a82..2c64ca15ca079f 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -692,29 +692,10 @@ static void rbd_release(struct gendisk *disk, fmode_t mode)
 	put_device(&rbd_dev->dev);
 }
 
-static int rbd_set_read_only(struct block_device *bdev, bool ro)
-{
-	struct rbd_device *rbd_dev = bdev->bd_disk->private_data;
-
-	/*
-	 * Both images mapped read-only and snapshots can't be marked
-	 * read-write.
-	 */
-	if (!ro) {
-		if (rbd_is_ro(rbd_dev))
-			return -EROFS;
-
-		rbd_assert(!rbd_is_snap(rbd_dev));
-	}
-
-	return 0;
-}
-
 static const struct block_device_operations rbd_bd_ops = {
 	.owner			= THIS_MODULE,
 	.open			= rbd_open,
 	.release		= rbd_release,
-	.set_read_only		= rbd_set_read_only,
 };
 
 /*
-- 
2.29.2

--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel


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

* [PATCH 6/6] nvme: allow revalidate to set a namespace read-only
  2020-12-07 13:19 ` Christoph Hellwig
  (?)
@ 2020-12-07 13:19   ` Christoph Hellwig
  -1 siblings, 0 replies; 90+ messages in thread
From: Christoph Hellwig @ 2020-12-07 13:19 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Martin K . Petersen, Oleksii Kurochko, Sagi Grimberg,
	Mike Snitzer, Ilya Dryomov, Dongsheng Yang, ceph-devel, dm-devel,
	linux-block, linux-nvme

Unconditionally call set_disk_ro now that it only updates the hardware
state.  This allows to properly set up the Linux devices read-only when
the controller turns a previously writable namespace read-only.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/nvme/host/core.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 24d7f64f14cb15..18cbf92fc4f957 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -2114,9 +2114,8 @@ static void nvme_update_disk_info(struct gendisk *disk,
 	nvme_config_discard(disk, ns);
 	nvme_config_write_zeroes(disk, ns);
 
-	if ((id->nsattr & NVME_NS_ATTR_RO) ||
-	    test_bit(NVME_NS_FORCE_RO, &ns->flags))
-		set_disk_ro(disk, true);
+	set_disk_ro(disk, (id->nsattr & NVME_NS_ATTR_RO) ||
+		test_bit(NVME_NS_FORCE_RO, &ns->flags));
 }
 
 static inline bool nvme_first_scan(struct gendisk *disk)
-- 
2.29.2


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

* [PATCH 6/6] nvme: allow revalidate to set a namespace read-only
@ 2020-12-07 13:19   ` Christoph Hellwig
  0 siblings, 0 replies; 90+ messages in thread
From: Christoph Hellwig @ 2020-12-07 13:19 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Sagi Grimberg, Mike Snitzer, Oleksii Kurochko, Dongsheng Yang,
	linux-block, dm-devel, linux-nvme, Martin K . Petersen,
	Ilya Dryomov, ceph-devel

Unconditionally call set_disk_ro now that it only updates the hardware
state.  This allows to properly set up the Linux devices read-only when
the controller turns a previously writable namespace read-only.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/nvme/host/core.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 24d7f64f14cb15..18cbf92fc4f957 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -2114,9 +2114,8 @@ static void nvme_update_disk_info(struct gendisk *disk,
 	nvme_config_discard(disk, ns);
 	nvme_config_write_zeroes(disk, ns);
 
-	if ((id->nsattr & NVME_NS_ATTR_RO) ||
-	    test_bit(NVME_NS_FORCE_RO, &ns->flags))
-		set_disk_ro(disk, true);
+	set_disk_ro(disk, (id->nsattr & NVME_NS_ATTR_RO) ||
+		test_bit(NVME_NS_FORCE_RO, &ns->flags));
 }
 
 static inline bool nvme_first_scan(struct gendisk *disk)
-- 
2.29.2


_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

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

* [dm-devel] [PATCH 6/6] nvme: allow revalidate to set a namespace read-only
@ 2020-12-07 13:19   ` Christoph Hellwig
  0 siblings, 0 replies; 90+ messages in thread
From: Christoph Hellwig @ 2020-12-07 13:19 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Sagi Grimberg, Mike Snitzer, Oleksii Kurochko, Dongsheng Yang,
	linux-block, dm-devel, linux-nvme, Martin K . Petersen,
	Ilya Dryomov, ceph-devel

Unconditionally call set_disk_ro now that it only updates the hardware
state.  This allows to properly set up the Linux devices read-only when
the controller turns a previously writable namespace read-only.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/nvme/host/core.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 24d7f64f14cb15..18cbf92fc4f957 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -2114,9 +2114,8 @@ static void nvme_update_disk_info(struct gendisk *disk,
 	nvme_config_discard(disk, ns);
 	nvme_config_write_zeroes(disk, ns);
 
-	if ((id->nsattr & NVME_NS_ATTR_RO) ||
-	    test_bit(NVME_NS_FORCE_RO, &ns->flags))
-		set_disk_ro(disk, true);
+	set_disk_ro(disk, (id->nsattr & NVME_NS_ATTR_RO) ||
+		test_bit(NVME_NS_FORCE_RO, &ns->flags));
 }
 
 static inline bool nvme_first_scan(struct gendisk *disk)
-- 
2.29.2

--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel


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

* Re: [PATCH 5/6] rbd: remove the ->set_read_only method
  2020-12-07 13:19   ` Christoph Hellwig
  (?)
@ 2020-12-07 14:57     ` Ilya Dryomov
  -1 siblings, 0 replies; 90+ messages in thread
From: Ilya Dryomov @ 2020-12-07 14:57 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Jens Axboe, Martin K . Petersen, Oleksii Kurochko, Sagi Grimberg,
	Mike Snitzer, Dongsheng Yang, Ceph Development, dm-devel,
	linux-block, linux-nvme, Hannes Reinecke

On Mon, Dec 7, 2020 at 2:21 PM Christoph Hellwig <hch@lst.de> wrote:
>
> Now that the hardware read-only state can't be changed by the BLKROSET
> ioctl, the code in this method is not required anymore.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> Reviewed-by: Hannes Reinecke <hare@suse.de>
> ---
>  drivers/block/rbd.c | 19 -------------------
>  1 file changed, 19 deletions(-)
>
> diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
> index 2ed79b09439a82..2c64ca15ca079f 100644
> --- a/drivers/block/rbd.c
> +++ b/drivers/block/rbd.c
> @@ -692,29 +692,10 @@ static void rbd_release(struct gendisk *disk, fmode_t mode)
>         put_device(&rbd_dev->dev);
>  }
>
> -static int rbd_set_read_only(struct block_device *bdev, bool ro)
> -{
> -       struct rbd_device *rbd_dev = bdev->bd_disk->private_data;
> -
> -       /*
> -        * Both images mapped read-only and snapshots can't be marked
> -        * read-write.
> -        */
> -       if (!ro) {
> -               if (rbd_is_ro(rbd_dev))
> -                       return -EROFS;
> -
> -               rbd_assert(!rbd_is_snap(rbd_dev));
> -       }
> -
> -       return 0;
> -}
> -
>  static const struct block_device_operations rbd_bd_ops = {
>         .owner                  = THIS_MODULE,
>         .open                   = rbd_open,
>         .release                = rbd_release,
> -       .set_read_only          = rbd_set_read_only,
>  };
>
>  /*
> --
> 2.29.2
>

If nothing can mess with read-only state after set_disk_ro(disk, true),
looks good.

Acked-by: Ilya Dryomov <idryomov@gmail.com>

Thanks,

                Ilya

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

* Re: [PATCH 5/6] rbd: remove the ->set_read_only method
@ 2020-12-07 14:57     ` Ilya Dryomov
  0 siblings, 0 replies; 90+ messages in thread
From: Ilya Dryomov @ 2020-12-07 14:57 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Jens Axboe, Sagi Grimberg, Mike Snitzer, Oleksii Kurochko,
	Dongsheng Yang, linux-block, dm-devel, linux-nvme,
	Martin K . Petersen, Ceph Development, Hannes Reinecke

On Mon, Dec 7, 2020 at 2:21 PM Christoph Hellwig <hch@lst.de> wrote:
>
> Now that the hardware read-only state can't be changed by the BLKROSET
> ioctl, the code in this method is not required anymore.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> Reviewed-by: Hannes Reinecke <hare@suse.de>
> ---
>  drivers/block/rbd.c | 19 -------------------
>  1 file changed, 19 deletions(-)
>
> diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
> index 2ed79b09439a82..2c64ca15ca079f 100644
> --- a/drivers/block/rbd.c
> +++ b/drivers/block/rbd.c
> @@ -692,29 +692,10 @@ static void rbd_release(struct gendisk *disk, fmode_t mode)
>         put_device(&rbd_dev->dev);
>  }
>
> -static int rbd_set_read_only(struct block_device *bdev, bool ro)
> -{
> -       struct rbd_device *rbd_dev = bdev->bd_disk->private_data;
> -
> -       /*
> -        * Both images mapped read-only and snapshots can't be marked
> -        * read-write.
> -        */
> -       if (!ro) {
> -               if (rbd_is_ro(rbd_dev))
> -                       return -EROFS;
> -
> -               rbd_assert(!rbd_is_snap(rbd_dev));
> -       }
> -
> -       return 0;
> -}
> -
>  static const struct block_device_operations rbd_bd_ops = {
>         .owner                  = THIS_MODULE,
>         .open                   = rbd_open,
>         .release                = rbd_release,
> -       .set_read_only          = rbd_set_read_only,
>  };
>
>  /*
> --
> 2.29.2
>

If nothing can mess with read-only state after set_disk_ro(disk, true),
looks good.

Acked-by: Ilya Dryomov <idryomov@gmail.com>

Thanks,

                Ilya

_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

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

* Re: [dm-devel] [PATCH 5/6] rbd: remove the ->set_read_only method
@ 2020-12-07 14:57     ` Ilya Dryomov
  0 siblings, 0 replies; 90+ messages in thread
From: Ilya Dryomov @ 2020-12-07 14:57 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Jens Axboe, Sagi Grimberg, Mike Snitzer, Oleksii Kurochko,
	Dongsheng Yang, linux-block, dm-devel, linux-nvme,
	Martin K . Petersen, Ceph Development

On Mon, Dec 7, 2020 at 2:21 PM Christoph Hellwig <hch@lst.de> wrote:
>
> Now that the hardware read-only state can't be changed by the BLKROSET
> ioctl, the code in this method is not required anymore.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> Reviewed-by: Hannes Reinecke <hare@suse.de>
> ---
>  drivers/block/rbd.c | 19 -------------------
>  1 file changed, 19 deletions(-)
>
> diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
> index 2ed79b09439a82..2c64ca15ca079f 100644
> --- a/drivers/block/rbd.c
> +++ b/drivers/block/rbd.c
> @@ -692,29 +692,10 @@ static void rbd_release(struct gendisk *disk, fmode_t mode)
>         put_device(&rbd_dev->dev);
>  }
>
> -static int rbd_set_read_only(struct block_device *bdev, bool ro)
> -{
> -       struct rbd_device *rbd_dev = bdev->bd_disk->private_data;
> -
> -       /*
> -        * Both images mapped read-only and snapshots can't be marked
> -        * read-write.
> -        */
> -       if (!ro) {
> -               if (rbd_is_ro(rbd_dev))
> -                       return -EROFS;
> -
> -               rbd_assert(!rbd_is_snap(rbd_dev));
> -       }
> -
> -       return 0;
> -}
> -
>  static const struct block_device_operations rbd_bd_ops = {
>         .owner                  = THIS_MODULE,
>         .open                   = rbd_open,
>         .release                = rbd_release,
> -       .set_read_only          = rbd_set_read_only,
>  };
>
>  /*
> --
> 2.29.2
>

If nothing can mess with read-only state after set_disk_ro(disk, true),
looks good.

Acked-by: Ilya Dryomov <idryomov@gmail.com>

Thanks,

                Ilya

--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel


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

* Re: [PATCH 6/6] nvme: allow revalidate to set a namespace read-only
  2020-12-07 13:19   ` Christoph Hellwig
  (?)
@ 2020-12-07 18:13     ` Keith Busch
  -1 siblings, 0 replies; 90+ messages in thread
From: Keith Busch @ 2020-12-07 18:13 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Jens Axboe, Sagi Grimberg, Mike Snitzer, Oleksii Kurochko,
	Dongsheng Yang, linux-block, dm-devel, linux-nvme,
	Martin K . Petersen, Ilya Dryomov, ceph-devel

On Mon, Dec 07, 2020 at 02:19:18PM +0100, Christoph Hellwig wrote:
> Unconditionally call set_disk_ro now that it only updates the hardware
> state.  This allows to properly set up the Linux devices read-only when
> the controller turns a previously writable namespace read-only.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Looks good.

Reviewed-by: Keith Busch <kbusch@kernel.org>

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

* Re: [PATCH 6/6] nvme: allow revalidate to set a namespace read-only
@ 2020-12-07 18:13     ` Keith Busch
  0 siblings, 0 replies; 90+ messages in thread
From: Keith Busch @ 2020-12-07 18:13 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Jens Axboe, Sagi Grimberg, Mike Snitzer, Oleksii Kurochko,
	Dongsheng Yang, linux-block, dm-devel, linux-nvme,
	Martin K . Petersen, Ilya Dryomov, ceph-devel

On Mon, Dec 07, 2020 at 02:19:18PM +0100, Christoph Hellwig wrote:
> Unconditionally call set_disk_ro now that it only updates the hardware
> state.  This allows to properly set up the Linux devices read-only when
> the controller turns a previously writable namespace read-only.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Looks good.

Reviewed-by: Keith Busch <kbusch@kernel.org>

_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

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

* Re: [dm-devel] [PATCH 6/6] nvme: allow revalidate to set a namespace read-only
@ 2020-12-07 18:13     ` Keith Busch
  0 siblings, 0 replies; 90+ messages in thread
From: Keith Busch @ 2020-12-07 18:13 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Jens Axboe, Sagi Grimberg, Mike Snitzer, Oleksii Kurochko,
	Dongsheng Yang, linux-block, dm-devel, linux-nvme,
	Martin K . Petersen, Ilya Dryomov, ceph-devel

On Mon, Dec 07, 2020 at 02:19:18PM +0100, Christoph Hellwig wrote:
> Unconditionally call set_disk_ro now that it only updates the hardware
> state.  This allows to properly set up the Linux devices read-only when
> the controller turns a previously writable namespace read-only.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Looks good.

Reviewed-by: Keith Busch <kbusch@kernel.org>

--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel


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

* Re: [PATCH 1/6] dm: use bdev_read_only to check if a device is read-only
  2020-12-07 13:19   ` Christoph Hellwig
  (?)
@ 2020-12-08  5:23     ` Martin K. Petersen
  -1 siblings, 0 replies; 90+ messages in thread
From: Martin K. Petersen @ 2020-12-08  5:23 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Jens Axboe, Martin K . Petersen, Oleksii Kurochko, Sagi Grimberg,
	Mike Snitzer, Ilya Dryomov, Dongsheng Yang, ceph-devel, dm-devel,
	linux-block, linux-nvme, Hannes Reinecke


Christoph,

> dm-thin and dm-cache also work on partitions, so use the proper
> interface to check if the device is read-only.

Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>

-- 
Martin K. Petersen	Oracle Linux Engineering

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

* Re: [PATCH 1/6] dm: use bdev_read_only to check if a device is read-only
@ 2020-12-08  5:23     ` Martin K. Petersen
  0 siblings, 0 replies; 90+ messages in thread
From: Martin K. Petersen @ 2020-12-08  5:23 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Jens Axboe, Sagi Grimberg, Mike Snitzer, Oleksii Kurochko,
	Dongsheng Yang, linux-block, dm-devel, linux-nvme,
	Martin K . Petersen, Ilya Dryomov, ceph-devel, Hannes Reinecke


Christoph,

> dm-thin and dm-cache also work on partitions, so use the proper
> interface to check if the device is read-only.

Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>

-- 
Martin K. Petersen	Oracle Linux Engineering

_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

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

* Re: [dm-devel] [PATCH 1/6] dm: use bdev_read_only to check if a device is read-only
@ 2020-12-08  5:23     ` Martin K. Petersen
  0 siblings, 0 replies; 90+ messages in thread
From: Martin K. Petersen @ 2020-12-08  5:23 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Jens Axboe, Sagi Grimberg, Mike Snitzer, Oleksii Kurochko,
	Dongsheng Yang, linux-block, dm-devel, linux-nvme,
	Martin K . Petersen, Ilya Dryomov, ceph-devel


Christoph,

> dm-thin and dm-cache also work on partitions, so use the proper
> interface to check if the device is read-only.

Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>

-- 
Martin K. Petersen	Oracle Linux Engineering

--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel


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

* Re: [PATCH 2/6] block: remove the NULL bdev check in bdev_read_only
  2020-12-07 13:19   ` Christoph Hellwig
  (?)
@ 2020-12-08  5:23     ` Martin K. Petersen
  -1 siblings, 0 replies; 90+ messages in thread
From: Martin K. Petersen @ 2020-12-08  5:23 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Jens Axboe, Martin K . Petersen, Oleksii Kurochko, Sagi Grimberg,
	Mike Snitzer, Ilya Dryomov, Dongsheng Yang, ceph-devel, dm-devel,
	linux-block, linux-nvme


Christoph,

> Only a single caller can end up in bdev_read_only, so move the check there.

Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>

-- 
Martin K. Petersen	Oracle Linux Engineering

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

* Re: [PATCH 2/6] block: remove the NULL bdev check in bdev_read_only
@ 2020-12-08  5:23     ` Martin K. Petersen
  0 siblings, 0 replies; 90+ messages in thread
From: Martin K. Petersen @ 2020-12-08  5:23 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Jens Axboe, Sagi Grimberg, Mike Snitzer, Oleksii Kurochko,
	Dongsheng Yang, linux-block, dm-devel, linux-nvme,
	Martin K . Petersen, Ilya Dryomov, ceph-devel


Christoph,

> Only a single caller can end up in bdev_read_only, so move the check there.

Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>

-- 
Martin K. Petersen	Oracle Linux Engineering

_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

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

* Re: [dm-devel] [PATCH 2/6] block: remove the NULL bdev check in bdev_read_only
@ 2020-12-08  5:23     ` Martin K. Petersen
  0 siblings, 0 replies; 90+ messages in thread
From: Martin K. Petersen @ 2020-12-08  5:23 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Jens Axboe, Sagi Grimberg, Mike Snitzer, Oleksii Kurochko,
	Dongsheng Yang, linux-block, dm-devel, linux-nvme,
	Martin K . Petersen, Ilya Dryomov, ceph-devel


Christoph,

> Only a single caller can end up in bdev_read_only, so move the check there.

Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>

-- 
Martin K. Petersen	Oracle Linux Engineering

--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel


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

* Re: [PATCH 3/6] block: add a hard-readonly flag to struct gendisk
  2020-12-07 13:19   ` Christoph Hellwig
  (?)
@ 2020-12-08  5:24     ` Martin K. Petersen
  -1 siblings, 0 replies; 90+ messages in thread
From: Martin K. Petersen @ 2020-12-08  5:24 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Jens Axboe, Martin K . Petersen, Oleksii Kurochko, Sagi Grimberg,
	Mike Snitzer, Ilya Dryomov, Dongsheng Yang, ceph-devel, dm-devel,
	linux-block, linux-nvme, Hannes Reinecke


Christoph,

> 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.

Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>

-- 
Martin K. Petersen	Oracle Linux Engineering

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

* Re: [PATCH 3/6] block: add a hard-readonly flag to struct gendisk
@ 2020-12-08  5:24     ` Martin K. Petersen
  0 siblings, 0 replies; 90+ messages in thread
From: Martin K. Petersen @ 2020-12-08  5:24 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Jens Axboe, Sagi Grimberg, Mike Snitzer, Oleksii Kurochko,
	Dongsheng Yang, linux-block, dm-devel, linux-nvme,
	Martin K . Petersen, Ilya Dryomov, ceph-devel, Hannes Reinecke


Christoph,

> 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.

Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>

-- 
Martin K. Petersen	Oracle Linux Engineering

_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

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

* Re: [dm-devel] [PATCH 3/6] block: add a hard-readonly flag to struct gendisk
@ 2020-12-08  5:24     ` Martin K. Petersen
  0 siblings, 0 replies; 90+ messages in thread
From: Martin K. Petersen @ 2020-12-08  5:24 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Jens Axboe, Sagi Grimberg, Mike Snitzer, Oleksii Kurochko,
	Dongsheng Yang, linux-block, dm-devel, linux-nvme,
	Martin K . Petersen, Ilya Dryomov, ceph-devel


Christoph,

> 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.

Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>

-- 
Martin K. Petersen	Oracle Linux Engineering

--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel


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

* Re: [PATCH 4/6] block: propagate BLKROSET on the whole device to all partitions
  2020-12-07 13:19   ` Christoph Hellwig
  (?)
@ 2020-12-08  5:27     ` Martin K. Petersen
  -1 siblings, 0 replies; 90+ messages in thread
From: Martin K. Petersen @ 2020-12-08  5:27 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Jens Axboe, Martin K . Petersen, Oleksii Kurochko, Sagi Grimberg,
	Mike Snitzer, Ilya Dryomov, Dongsheng Yang, ceph-devel, dm-devel,
	linux-block, linux-nvme


Christoph,

> The existing behavior is inconsistent in the sense that doing:
>
> permits writes. But:
>
> <something triggers revalidate>
>
> doesn't.
>
> And a subsequent:

Looks like the command line pieces got zapped from the commit
description.

In any case this fixes the issue for me. My read-only blktests succeed
with this change in place.

Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>

-- 
Martin K. Petersen	Oracle Linux Engineering

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

* Re: [PATCH 4/6] block: propagate BLKROSET on the whole device to all partitions
@ 2020-12-08  5:27     ` Martin K. Petersen
  0 siblings, 0 replies; 90+ messages in thread
From: Martin K. Petersen @ 2020-12-08  5:27 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Jens Axboe, Sagi Grimberg, Mike Snitzer, Oleksii Kurochko,
	Dongsheng Yang, linux-block, dm-devel, linux-nvme,
	Martin K . Petersen, Ilya Dryomov, ceph-devel


Christoph,

> The existing behavior is inconsistent in the sense that doing:
>
> permits writes. But:
>
> <something triggers revalidate>
>
> doesn't.
>
> And a subsequent:

Looks like the command line pieces got zapped from the commit
description.

In any case this fixes the issue for me. My read-only blktests succeed
with this change in place.

Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>

-- 
Martin K. Petersen	Oracle Linux Engineering

_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

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

* Re: [dm-devel] [PATCH 4/6] block: propagate BLKROSET on the whole device to all partitions
@ 2020-12-08  5:27     ` Martin K. Petersen
  0 siblings, 0 replies; 90+ messages in thread
From: Martin K. Petersen @ 2020-12-08  5:27 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Jens Axboe, Sagi Grimberg, Mike Snitzer, Oleksii Kurochko,
	Dongsheng Yang, linux-block, dm-devel, linux-nvme,
	Martin K . Petersen, Ilya Dryomov, ceph-devel


Christoph,

> The existing behavior is inconsistent in the sense that doing:
>
> permits writes. But:
>
> <something triggers revalidate>
>
> doesn't.
>
> And a subsequent:

Looks like the command line pieces got zapped from the commit
description.

In any case this fixes the issue for me. My read-only blktests succeed
with this change in place.

Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>

-- 
Martin K. Petersen	Oracle Linux Engineering

--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel


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

* Re: [PATCH 3/6] block: add a hard-readonly flag to struct gendisk
  2020-12-07 13:19   ` Christoph Hellwig
  (?)
@ 2020-12-08  5:28     ` Martin K. Petersen
  -1 siblings, 0 replies; 90+ messages in thread
From: Martin K. Petersen @ 2020-12-08  5:28 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Jens Axboe, Martin K . Petersen, Oleksii Kurochko, Sagi Grimberg,
	Mike Snitzer, Ilya Dryomov, Dongsheng Yang, ceph-devel, dm-devel,
	linux-block, linux-nvme, Hannes Reinecke


Christoph,

> diff --git a/block/blk-core.c b/block/blk-core.c
> index ad041e903b0a8f..ecd68415c6acad 100644
> --- a/block/blk-core.c
> +++ b/block/blk-core.c
> @@ -693,7 +693,7 @@ static inline bool should_fail_request(struct block_device *part,
>  
>  static inline bool bio_check_ro(struct bio *bio)
>  {
> -	if (op_is_write(bio_op(bio)) && bio->bi_bdev->bd_read_only) {
> +	if (op_is_write(bio_op(bio)) && bdev_read_only(bio->bi_bdev))

Build failure, opening brace is missing ^^^^^

>  		char b[BDEVNAME_SIZE];
>  
>  		if (op_is_flush(bio->bi_opf) && !bio_sectors(bio))

-- 
Martin K. Petersen	Oracle Linux Engineering

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

* Re: [PATCH 3/6] block: add a hard-readonly flag to struct gendisk
@ 2020-12-08  5:28     ` Martin K. Petersen
  0 siblings, 0 replies; 90+ messages in thread
From: Martin K. Petersen @ 2020-12-08  5:28 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Jens Axboe, Sagi Grimberg, Mike Snitzer, Oleksii Kurochko,
	Dongsheng Yang, linux-block, dm-devel, linux-nvme,
	Martin K . Petersen, Ilya Dryomov, ceph-devel, Hannes Reinecke


Christoph,

> diff --git a/block/blk-core.c b/block/blk-core.c
> index ad041e903b0a8f..ecd68415c6acad 100644
> --- a/block/blk-core.c
> +++ b/block/blk-core.c
> @@ -693,7 +693,7 @@ static inline bool should_fail_request(struct block_device *part,
>  
>  static inline bool bio_check_ro(struct bio *bio)
>  {
> -	if (op_is_write(bio_op(bio)) && bio->bi_bdev->bd_read_only) {
> +	if (op_is_write(bio_op(bio)) && bdev_read_only(bio->bi_bdev))

Build failure, opening brace is missing ^^^^^

>  		char b[BDEVNAME_SIZE];
>  
>  		if (op_is_flush(bio->bi_opf) && !bio_sectors(bio))

-- 
Martin K. Petersen	Oracle Linux Engineering

_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

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

* Re: [dm-devel] [PATCH 3/6] block: add a hard-readonly flag to struct gendisk
@ 2020-12-08  5:28     ` Martin K. Petersen
  0 siblings, 0 replies; 90+ messages in thread
From: Martin K. Petersen @ 2020-12-08  5:28 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Jens Axboe, Sagi Grimberg, Mike Snitzer, Oleksii Kurochko,
	Dongsheng Yang, linux-block, dm-devel, linux-nvme,
	Martin K . Petersen, Ilya Dryomov, ceph-devel


Christoph,

> diff --git a/block/blk-core.c b/block/blk-core.c
> index ad041e903b0a8f..ecd68415c6acad 100644
> --- a/block/blk-core.c
> +++ b/block/blk-core.c
> @@ -693,7 +693,7 @@ static inline bool should_fail_request(struct block_device *part,
>  
>  static inline bool bio_check_ro(struct bio *bio)
>  {
> -	if (op_is_write(bio_op(bio)) && bio->bi_bdev->bd_read_only) {
> +	if (op_is_write(bio_op(bio)) && bdev_read_only(bio->bi_bdev))

Build failure, opening brace is missing ^^^^^

>  		char b[BDEVNAME_SIZE];
>  
>  		if (op_is_flush(bio->bi_opf) && !bio_sectors(bio))

-- 
Martin K. Petersen	Oracle Linux Engineering

--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel


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

* Re: [PATCH 6/6] nvme: allow revalidate to set a namespace read-only
  2020-12-07 13:19   ` Christoph Hellwig
  (?)
@ 2020-12-08  5:29     ` Martin K. Petersen
  -1 siblings, 0 replies; 90+ messages in thread
From: Martin K. Petersen @ 2020-12-08  5:29 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Jens Axboe, Martin K . Petersen, Oleksii Kurochko, Sagi Grimberg,
	Mike Snitzer, Ilya Dryomov, Dongsheng Yang, ceph-devel, dm-devel,
	linux-block, linux-nvme


Christoph,

> Unconditionally call set_disk_ro now that it only updates the hardware
> state.  This allows to properly set up the Linux devices read-only when
> the controller turns a previously writable namespace read-only.

Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>

-- 
Martin K. Petersen	Oracle Linux Engineering

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

* Re: [PATCH 6/6] nvme: allow revalidate to set a namespace read-only
@ 2020-12-08  5:29     ` Martin K. Petersen
  0 siblings, 0 replies; 90+ messages in thread
From: Martin K. Petersen @ 2020-12-08  5:29 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Jens Axboe, Sagi Grimberg, Mike Snitzer, Oleksii Kurochko,
	Dongsheng Yang, linux-block, dm-devel, linux-nvme,
	Martin K . Petersen, Ilya Dryomov, ceph-devel


Christoph,

> Unconditionally call set_disk_ro now that it only updates the hardware
> state.  This allows to properly set up the Linux devices read-only when
> the controller turns a previously writable namespace read-only.

Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>

-- 
Martin K. Petersen	Oracle Linux Engineering

_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

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

* Re: [dm-devel] [PATCH 6/6] nvme: allow revalidate to set a namespace read-only
@ 2020-12-08  5:29     ` Martin K. Petersen
  0 siblings, 0 replies; 90+ messages in thread
From: Martin K. Petersen @ 2020-12-08  5:29 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Jens Axboe, Sagi Grimberg, Mike Snitzer, Oleksii Kurochko,
	Dongsheng Yang, linux-block, dm-devel, linux-nvme,
	Martin K . Petersen, Ilya Dryomov, ceph-devel


Christoph,

> Unconditionally call set_disk_ro now that it only updates the hardware
> state.  This allows to properly set up the Linux devices read-only when
> the controller turns a previously writable namespace read-only.

Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>

-- 
Martin K. Petersen	Oracle Linux Engineering

--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel


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

* Re: [PATCH 5/6] rbd: remove the ->set_read_only method
  2020-12-07 13:19   ` Christoph Hellwig
  (?)
@ 2020-12-08  5:30     ` Martin K. Petersen
  -1 siblings, 0 replies; 90+ messages in thread
From: Martin K. Petersen @ 2020-12-08  5:30 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Jens Axboe, Martin K . Petersen, Oleksii Kurochko, Sagi Grimberg,
	Mike Snitzer, Ilya Dryomov, Dongsheng Yang, ceph-devel, dm-devel,
	linux-block, linux-nvme, Hannes Reinecke


Christoph,

> Now that the hardware read-only state can't be changed by the BLKROSET
> ioctl, the code in this method is not required anymore.

Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>

-- 
Martin K. Petersen	Oracle Linux Engineering

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

* Re: [PATCH 5/6] rbd: remove the ->set_read_only method
@ 2020-12-08  5:30     ` Martin K. Petersen
  0 siblings, 0 replies; 90+ messages in thread
From: Martin K. Petersen @ 2020-12-08  5:30 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Jens Axboe, Sagi Grimberg, Mike Snitzer, Oleksii Kurochko,
	Dongsheng Yang, linux-block, dm-devel, linux-nvme,
	Martin K . Petersen, Ilya Dryomov, ceph-devel, Hannes Reinecke


Christoph,

> Now that the hardware read-only state can't be changed by the BLKROSET
> ioctl, the code in this method is not required anymore.

Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>

-- 
Martin K. Petersen	Oracle Linux Engineering

_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

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

* Re: [dm-devel] [PATCH 5/6] rbd: remove the ->set_read_only method
@ 2020-12-08  5:30     ` Martin K. Petersen
  0 siblings, 0 replies; 90+ messages in thread
From: Martin K. Petersen @ 2020-12-08  5:30 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Jens Axboe, Sagi Grimberg, Mike Snitzer, Oleksii Kurochko,
	Dongsheng Yang, linux-block, dm-devel, linux-nvme,
	Martin K . Petersen, Ilya Dryomov, ceph-devel


Christoph,

> Now that the hardware read-only state can't be changed by the BLKROSET
> ioctl, the code in this method is not required anymore.

Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>

-- 
Martin K. Petersen	Oracle Linux Engineering

--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel


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

* Re: [PATCH 4/6] block: propagate BLKROSET on the whole device to all partitions
  2020-12-08  5:27     ` Martin K. Petersen
  (?)
@ 2020-12-08  9:25       ` Christoph Hellwig
  -1 siblings, 0 replies; 90+ messages in thread
From: Christoph Hellwig @ 2020-12-08  9:25 UTC (permalink / raw)
  To: Martin K. Petersen
  Cc: Christoph Hellwig, Jens Axboe, Oleksii Kurochko, Sagi Grimberg,
	Mike Snitzer, Ilya Dryomov, Dongsheng Yang, ceph-devel, dm-devel,
	linux-block, linux-nvme

On Tue, Dec 08, 2020 at 12:27:41AM -0500, Martin K. Petersen wrote:
> 
> Christoph,
> 
> > The existing behavior is inconsistent in the sense that doing:
> >
> > permits writes. But:
> >
> > <something triggers revalidate>
> >
> > doesn't.
> >
> > And a subsequent:
> 
> Looks like the command line pieces got zapped from the commit
> description.

Yeah.  It seems like git commit just removed them after I pasted them,
weird.

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

* Re: [PATCH 4/6] block: propagate BLKROSET on the whole device to all partitions
@ 2020-12-08  9:25       ` Christoph Hellwig
  0 siblings, 0 replies; 90+ messages in thread
From: Christoph Hellwig @ 2020-12-08  9:25 UTC (permalink / raw)
  To: Martin K. Petersen
  Cc: Jens Axboe, Sagi Grimberg, Mike Snitzer, Oleksii Kurochko,
	ceph-devel, Dongsheng Yang, linux-block, dm-devel, linux-nvme,
	Ilya Dryomov, Christoph Hellwig

On Tue, Dec 08, 2020 at 12:27:41AM -0500, Martin K. Petersen wrote:
> 
> Christoph,
> 
> > The existing behavior is inconsistent in the sense that doing:
> >
> > permits writes. But:
> >
> > <something triggers revalidate>
> >
> > doesn't.
> >
> > And a subsequent:
> 
> Looks like the command line pieces got zapped from the commit
> description.

Yeah.  It seems like git commit just removed them after I pasted them,
weird.

_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

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

* Re: [dm-devel] [PATCH 4/6] block: propagate BLKROSET on the whole device to all partitions
@ 2020-12-08  9:25       ` Christoph Hellwig
  0 siblings, 0 replies; 90+ messages in thread
From: Christoph Hellwig @ 2020-12-08  9:25 UTC (permalink / raw)
  To: Martin K. Petersen
  Cc: Jens Axboe, Sagi Grimberg, Mike Snitzer, Oleksii Kurochko,
	ceph-devel, Dongsheng Yang, linux-block, dm-devel, linux-nvme,
	Ilya Dryomov, Christoph Hellwig

On Tue, Dec 08, 2020 at 12:27:41AM -0500, Martin K. Petersen wrote:
> 
> Christoph,
> 
> > The existing behavior is inconsistent in the sense that doing:
> >
> > permits writes. But:
> >
> > <something triggers revalidate>
> >
> > doesn't.
> >
> > And a subsequent:
> 
> Looks like the command line pieces got zapped from the commit
> description.

Yeah.  It seems like git commit just removed them after I pasted them,
weird.

--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel


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

* Re: [PATCH 1/6] dm: use bdev_read_only to check if a device is read-only
  2020-12-07 13:19   ` Christoph Hellwig
  (?)
@ 2020-12-08  9:59     ` Ming Lei
  -1 siblings, 0 replies; 90+ messages in thread
From: Ming Lei @ 2020-12-08  9:59 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Jens Axboe, Martin K . Petersen, Oleksii Kurochko, Sagi Grimberg,
	Mike Snitzer, Ilya Dryomov, Dongsheng Yang, ceph-devel, dm-devel,
	linux-block, linux-nvme, Hannes Reinecke

On Mon, Dec 07, 2020 at 02:19:13PM +0100, Christoph Hellwig wrote:
> dm-thin and dm-cache also work on partitions, so use the proper
> interface to check if the device is read-only.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> Reviewed-by: Hannes Reinecke <hare@suse.de>
> ---
>  drivers/md/dm-cache-metadata.c | 2 +-
>  drivers/md/dm-thin-metadata.c  | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/md/dm-cache-metadata.c b/drivers/md/dm-cache-metadata.c
> index af6d4f898e4c1d..89a73204dbf47f 100644
> --- a/drivers/md/dm-cache-metadata.c
> +++ b/drivers/md/dm-cache-metadata.c
> @@ -449,7 +449,7 @@ static int __check_incompat_features(struct cache_disk_superblock *disk_super,
>  	/*
>  	 * Check for read-only metadata to skip the following RDWR checks.
>  	 */
> -	if (get_disk_ro(cmd->bdev->bd_disk))
> +	if (bdev_read_only(cmd->bdev))
>  		return 0;
>  
>  	features = le32_to_cpu(disk_super->compat_ro_flags) & ~DM_CACHE_FEATURE_COMPAT_RO_SUPP;
> diff --git a/drivers/md/dm-thin-metadata.c b/drivers/md/dm-thin-metadata.c
> index 6ebb2127f3e2e0..e75b20480e460e 100644
> --- a/drivers/md/dm-thin-metadata.c
> +++ b/drivers/md/dm-thin-metadata.c
> @@ -636,7 +636,7 @@ static int __check_incompat_features(struct thin_disk_superblock *disk_super,
>  	/*
>  	 * Check for read-only metadata to skip the following RDWR checks.
>  	 */
> -	if (get_disk_ro(pmd->bdev->bd_disk))
> +	if (bdev_read_only(pmd->bdev))
>  		return 0;
>  
>  	features = le32_to_cpu(disk_super->compat_ro_flags) & ~THIN_FEATURE_COMPAT_RO_SUPP;
> -- 
> 2.29.2
> 

Reviewed-by: Ming Lei <ming.lei@redhat.com>

-- 
Ming


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

* Re: [PATCH 1/6] dm: use bdev_read_only to check if a device is read-only
@ 2020-12-08  9:59     ` Ming Lei
  0 siblings, 0 replies; 90+ messages in thread
From: Ming Lei @ 2020-12-08  9:59 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Jens Axboe, Sagi Grimberg, Mike Snitzer, Oleksii Kurochko,
	Dongsheng Yang, linux-block, dm-devel, linux-nvme,
	Martin K . Petersen, Ilya Dryomov, ceph-devel, Hannes Reinecke

On Mon, Dec 07, 2020 at 02:19:13PM +0100, Christoph Hellwig wrote:
> dm-thin and dm-cache also work on partitions, so use the proper
> interface to check if the device is read-only.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> Reviewed-by: Hannes Reinecke <hare@suse.de>
> ---
>  drivers/md/dm-cache-metadata.c | 2 +-
>  drivers/md/dm-thin-metadata.c  | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/md/dm-cache-metadata.c b/drivers/md/dm-cache-metadata.c
> index af6d4f898e4c1d..89a73204dbf47f 100644
> --- a/drivers/md/dm-cache-metadata.c
> +++ b/drivers/md/dm-cache-metadata.c
> @@ -449,7 +449,7 @@ static int __check_incompat_features(struct cache_disk_superblock *disk_super,
>  	/*
>  	 * Check for read-only metadata to skip the following RDWR checks.
>  	 */
> -	if (get_disk_ro(cmd->bdev->bd_disk))
> +	if (bdev_read_only(cmd->bdev))
>  		return 0;
>  
>  	features = le32_to_cpu(disk_super->compat_ro_flags) & ~DM_CACHE_FEATURE_COMPAT_RO_SUPP;
> diff --git a/drivers/md/dm-thin-metadata.c b/drivers/md/dm-thin-metadata.c
> index 6ebb2127f3e2e0..e75b20480e460e 100644
> --- a/drivers/md/dm-thin-metadata.c
> +++ b/drivers/md/dm-thin-metadata.c
> @@ -636,7 +636,7 @@ static int __check_incompat_features(struct thin_disk_superblock *disk_super,
>  	/*
>  	 * Check for read-only metadata to skip the following RDWR checks.
>  	 */
> -	if (get_disk_ro(pmd->bdev->bd_disk))
> +	if (bdev_read_only(pmd->bdev))
>  		return 0;
>  
>  	features = le32_to_cpu(disk_super->compat_ro_flags) & ~THIN_FEATURE_COMPAT_RO_SUPP;
> -- 
> 2.29.2
> 

Reviewed-by: Ming Lei <ming.lei@redhat.com>

-- 
Ming


_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

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

* Re: [dm-devel] [PATCH 1/6] dm: use bdev_read_only to check if a device is read-only
@ 2020-12-08  9:59     ` Ming Lei
  0 siblings, 0 replies; 90+ messages in thread
From: Ming Lei @ 2020-12-08  9:59 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Jens Axboe, Sagi Grimberg, Mike Snitzer, Oleksii Kurochko,
	Dongsheng Yang, linux-block, dm-devel, linux-nvme,
	Martin K . Petersen, Ilya Dryomov, ceph-devel

On Mon, Dec 07, 2020 at 02:19:13PM +0100, Christoph Hellwig wrote:
> dm-thin and dm-cache also work on partitions, so use the proper
> interface to check if the device is read-only.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> Reviewed-by: Hannes Reinecke <hare@suse.de>
> ---
>  drivers/md/dm-cache-metadata.c | 2 +-
>  drivers/md/dm-thin-metadata.c  | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/md/dm-cache-metadata.c b/drivers/md/dm-cache-metadata.c
> index af6d4f898e4c1d..89a73204dbf47f 100644
> --- a/drivers/md/dm-cache-metadata.c
> +++ b/drivers/md/dm-cache-metadata.c
> @@ -449,7 +449,7 @@ static int __check_incompat_features(struct cache_disk_superblock *disk_super,
>  	/*
>  	 * Check for read-only metadata to skip the following RDWR checks.
>  	 */
> -	if (get_disk_ro(cmd->bdev->bd_disk))
> +	if (bdev_read_only(cmd->bdev))
>  		return 0;
>  
>  	features = le32_to_cpu(disk_super->compat_ro_flags) & ~DM_CACHE_FEATURE_COMPAT_RO_SUPP;
> diff --git a/drivers/md/dm-thin-metadata.c b/drivers/md/dm-thin-metadata.c
> index 6ebb2127f3e2e0..e75b20480e460e 100644
> --- a/drivers/md/dm-thin-metadata.c
> +++ b/drivers/md/dm-thin-metadata.c
> @@ -636,7 +636,7 @@ static int __check_incompat_features(struct thin_disk_superblock *disk_super,
>  	/*
>  	 * Check for read-only metadata to skip the following RDWR checks.
>  	 */
> -	if (get_disk_ro(pmd->bdev->bd_disk))
> +	if (bdev_read_only(pmd->bdev))
>  		return 0;
>  
>  	features = le32_to_cpu(disk_super->compat_ro_flags) & ~THIN_FEATURE_COMPAT_RO_SUPP;
> -- 
> 2.29.2
> 

Reviewed-by: Ming Lei <ming.lei@redhat.com>

-- 
Ming

--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel


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

* Re: [PATCH 2/6] block: remove the NULL bdev check in bdev_read_only
  2020-12-07 13:19   ` Christoph Hellwig
  (?)
@ 2020-12-08 10:06     ` Ming Lei
  -1 siblings, 0 replies; 90+ messages in thread
From: Ming Lei @ 2020-12-08 10:06 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Jens Axboe, Martin K . Petersen, Oleksii Kurochko, Sagi Grimberg,
	Mike Snitzer, Ilya Dryomov, Dongsheng Yang, ceph-devel, dm-devel,
	linux-block, linux-nvme

On Mon, Dec 07, 2020 at 02:19:14PM +0100, Christoph Hellwig wrote:
> Only a single caller can end up in bdev_read_only, so move the check there.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  block/genhd.c | 3 ---
>  fs/super.c    | 3 ++-
>  2 files changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/block/genhd.c b/block/genhd.c
> index 09ff6cef028729..c87013879b8650 100644
> --- a/block/genhd.c
> +++ b/block/genhd.c
> @@ -1445,11 +1445,8 @@ EXPORT_SYMBOL(set_disk_ro);
>  
>  int bdev_read_only(struct block_device *bdev)
>  {
> -	if (!bdev)
> -		return 0;
>  	return bdev->bd_read_only;
>  }
> -
>  EXPORT_SYMBOL(bdev_read_only);
>  
>  /*
> diff --git a/fs/super.c b/fs/super.c
> index 2c6cdea2ab2d9e..5a1f384ffc74f6 100644
> --- a/fs/super.c
> +++ b/fs/super.c
> @@ -865,7 +865,8 @@ int reconfigure_super(struct fs_context *fc)
>  
>  	if (fc->sb_flags_mask & SB_RDONLY) {
>  #ifdef CONFIG_BLOCK
> -		if (!(fc->sb_flags & SB_RDONLY) && bdev_read_only(sb->s_bdev))
> +		if (!(fc->sb_flags & SB_RDONLY) && sb->s_bdev &&
> +		    bdev_read_only(sb->s_bdev))
>  			return -EACCES;
>  #endif
>  
> -- 
> 2.29.2
> 

Reviewed-by: Ming Lei <ming.lei@redhat.com>

-- 
Ming


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

* Re: [PATCH 2/6] block: remove the NULL bdev check in bdev_read_only
@ 2020-12-08 10:06     ` Ming Lei
  0 siblings, 0 replies; 90+ messages in thread
From: Ming Lei @ 2020-12-08 10:06 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Jens Axboe, Sagi Grimberg, Mike Snitzer, Oleksii Kurochko,
	Dongsheng Yang, linux-block, dm-devel, linux-nvme,
	Martin K . Petersen, Ilya Dryomov, ceph-devel

On Mon, Dec 07, 2020 at 02:19:14PM +0100, Christoph Hellwig wrote:
> Only a single caller can end up in bdev_read_only, so move the check there.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  block/genhd.c | 3 ---
>  fs/super.c    | 3 ++-
>  2 files changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/block/genhd.c b/block/genhd.c
> index 09ff6cef028729..c87013879b8650 100644
> --- a/block/genhd.c
> +++ b/block/genhd.c
> @@ -1445,11 +1445,8 @@ EXPORT_SYMBOL(set_disk_ro);
>  
>  int bdev_read_only(struct block_device *bdev)
>  {
> -	if (!bdev)
> -		return 0;
>  	return bdev->bd_read_only;
>  }
> -
>  EXPORT_SYMBOL(bdev_read_only);
>  
>  /*
> diff --git a/fs/super.c b/fs/super.c
> index 2c6cdea2ab2d9e..5a1f384ffc74f6 100644
> --- a/fs/super.c
> +++ b/fs/super.c
> @@ -865,7 +865,8 @@ int reconfigure_super(struct fs_context *fc)
>  
>  	if (fc->sb_flags_mask & SB_RDONLY) {
>  #ifdef CONFIG_BLOCK
> -		if (!(fc->sb_flags & SB_RDONLY) && bdev_read_only(sb->s_bdev))
> +		if (!(fc->sb_flags & SB_RDONLY) && sb->s_bdev &&
> +		    bdev_read_only(sb->s_bdev))
>  			return -EACCES;
>  #endif
>  
> -- 
> 2.29.2
> 

Reviewed-by: Ming Lei <ming.lei@redhat.com>

-- 
Ming


_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

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

* Re: [dm-devel] [PATCH 2/6] block: remove the NULL bdev check in bdev_read_only
@ 2020-12-08 10:06     ` Ming Lei
  0 siblings, 0 replies; 90+ messages in thread
From: Ming Lei @ 2020-12-08 10:06 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Jens Axboe, Sagi Grimberg, Mike Snitzer, Oleksii Kurochko,
	Dongsheng Yang, linux-block, dm-devel, linux-nvme,
	Martin K . Petersen, Ilya Dryomov, ceph-devel

On Mon, Dec 07, 2020 at 02:19:14PM +0100, Christoph Hellwig wrote:
> Only a single caller can end up in bdev_read_only, so move the check there.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  block/genhd.c | 3 ---
>  fs/super.c    | 3 ++-
>  2 files changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/block/genhd.c b/block/genhd.c
> index 09ff6cef028729..c87013879b8650 100644
> --- a/block/genhd.c
> +++ b/block/genhd.c
> @@ -1445,11 +1445,8 @@ EXPORT_SYMBOL(set_disk_ro);
>  
>  int bdev_read_only(struct block_device *bdev)
>  {
> -	if (!bdev)
> -		return 0;
>  	return bdev->bd_read_only;
>  }
> -
>  EXPORT_SYMBOL(bdev_read_only);
>  
>  /*
> diff --git a/fs/super.c b/fs/super.c
> index 2c6cdea2ab2d9e..5a1f384ffc74f6 100644
> --- a/fs/super.c
> +++ b/fs/super.c
> @@ -865,7 +865,8 @@ int reconfigure_super(struct fs_context *fc)
>  
>  	if (fc->sb_flags_mask & SB_RDONLY) {
>  #ifdef CONFIG_BLOCK
> -		if (!(fc->sb_flags & SB_RDONLY) && bdev_read_only(sb->s_bdev))
> +		if (!(fc->sb_flags & SB_RDONLY) && sb->s_bdev &&
> +		    bdev_read_only(sb->s_bdev))
>  			return -EACCES;
>  #endif
>  
> -- 
> 2.29.2
> 

Reviewed-by: Ming Lei <ming.lei@redhat.com>

-- 
Ming

--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel


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

* Re: [PATCH 3/6] block: add a hard-readonly flag to struct gendisk
  2020-12-07 13:19   ` Christoph Hellwig
  (?)
@ 2020-12-08 10:22     ` Ming Lei
  -1 siblings, 0 replies; 90+ messages in thread
From: Ming Lei @ 2020-12-08 10:22 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Jens Axboe, Martin K . Petersen, Oleksii Kurochko, Sagi Grimberg,
	Mike Snitzer, Ilya Dryomov, Dongsheng Yang, ceph-devel, dm-devel,
	linux-block, linux-nvme, Hannes Reinecke

On Mon, Dec 07, 2020 at 02:19:15PM +0100, 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 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>
> Reviewed-by: Hannes Reinecke <hare@suse.de>
> ---
>  block/blk-core.c        |  2 +-
>  block/genhd.c           | 33 +++++++++++++++++++--------------
>  block/partitions/core.c |  3 +--
>  include/linux/genhd.h   |  6 ++++--
>  4 files changed, 25 insertions(+), 19 deletions(-)
> 
> diff --git a/block/blk-core.c b/block/blk-core.c
> index ad041e903b0a8f..ecd68415c6acad 100644
> --- a/block/blk-core.c
> +++ b/block/blk-core.c
> @@ -693,7 +693,7 @@ static inline bool should_fail_request(struct block_device *part,
>  
>  static inline bool bio_check_ro(struct bio *bio)
>  {
> -	if (op_is_write(bio_op(bio)) && bio->bi_bdev->bd_read_only) {
> +	if (op_is_write(bio_op(bio)) && bdev_read_only(bio->bi_bdev))
>  		char b[BDEVNAME_SIZE];
>  
>  		if (op_is_flush(bio->bi_opf) && !bio_sectors(bio))
> diff --git a/block/genhd.c b/block/genhd.c
> index c87013879b8650..878f94727aaa96 100644
> --- a/block/genhd.c
> +++ b/block/genhd.c
> @@ -1425,27 +1425,32 @@ static void set_disk_ro_uevent(struct gendisk *gd, int ro)
>  	kobject_uevent_env(&disk_to_dev(gd)->kobj, KOBJ_CHANGE, envp);
>  }
>  
> -void set_disk_ro(struct gendisk *disk, int flag)
> +/**
> + * set_disk_ro - set a gendisk read-only
> + * @disk:	gendisk to operate on
> + * @ready_only:	%true to set the disk read-only, %false set the disk read/write
> + *
> + * This function is used to indicate whether a given disk device should have its
> + * read-only flag set. set_disk_ro() is typically used by device drivers to
> + * indicate whether the underlying physical device is write-protected.
> + */
> +void set_disk_ro(struct gendisk *disk, bool read_only)
>  {
> -	struct disk_part_iter piter;
> -	struct block_device *part;
> -
> -	if (disk->part0->bd_read_only != flag) {
> -		set_disk_ro_uevent(disk, flag);
> -		disk->part0->bd_read_only = flag;
> +	if (read_only) {
> +		if (test_and_set_bit(GD_READ_ONLY, &disk->state))
> +			return;
> +	} else {
> +		if (!test_and_clear_bit(GD_READ_ONLY, &disk->state))
> +			return;
>  	}
> -
> -	disk_part_iter_init(&piter, disk, DISK_PITER_INCL_EMPTY);
> -	while ((part = disk_part_iter_next(&piter)))
> -		part->bd_read_only = flag;
> -	disk_part_iter_exit(&piter);
> +	set_disk_ro_uevent(disk, read_only);
>  }
> -
>  EXPORT_SYMBOL(set_disk_ro);
>  
>  int bdev_read_only(struct block_device *bdev)
>  {
> -	return bdev->bd_read_only;
> +	return bdev->bd_read_only ||
> +		test_bit(GD_READ_ONLY, &bdev->bd_disk->state);
>  }
>  EXPORT_SYMBOL(bdev_read_only);

Maybe one inline version can be added for fast path(bio_check_ro()), and the approach
is good:

Reviewed-by: Ming Lei <ming.lei@redhat.com>

-- 
Ming


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

* Re: [PATCH 3/6] block: add a hard-readonly flag to struct gendisk
@ 2020-12-08 10:22     ` Ming Lei
  0 siblings, 0 replies; 90+ messages in thread
From: Ming Lei @ 2020-12-08 10:22 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Jens Axboe, Sagi Grimberg, Mike Snitzer, Oleksii Kurochko,
	Dongsheng Yang, linux-block, dm-devel, linux-nvme,
	Martin K . Petersen, Ilya Dryomov, ceph-devel, Hannes Reinecke

On Mon, Dec 07, 2020 at 02:19:15PM +0100, 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 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>
> Reviewed-by: Hannes Reinecke <hare@suse.de>
> ---
>  block/blk-core.c        |  2 +-
>  block/genhd.c           | 33 +++++++++++++++++++--------------
>  block/partitions/core.c |  3 +--
>  include/linux/genhd.h   |  6 ++++--
>  4 files changed, 25 insertions(+), 19 deletions(-)
> 
> diff --git a/block/blk-core.c b/block/blk-core.c
> index ad041e903b0a8f..ecd68415c6acad 100644
> --- a/block/blk-core.c
> +++ b/block/blk-core.c
> @@ -693,7 +693,7 @@ static inline bool should_fail_request(struct block_device *part,
>  
>  static inline bool bio_check_ro(struct bio *bio)
>  {
> -	if (op_is_write(bio_op(bio)) && bio->bi_bdev->bd_read_only) {
> +	if (op_is_write(bio_op(bio)) && bdev_read_only(bio->bi_bdev))
>  		char b[BDEVNAME_SIZE];
>  
>  		if (op_is_flush(bio->bi_opf) && !bio_sectors(bio))
> diff --git a/block/genhd.c b/block/genhd.c
> index c87013879b8650..878f94727aaa96 100644
> --- a/block/genhd.c
> +++ b/block/genhd.c
> @@ -1425,27 +1425,32 @@ static void set_disk_ro_uevent(struct gendisk *gd, int ro)
>  	kobject_uevent_env(&disk_to_dev(gd)->kobj, KOBJ_CHANGE, envp);
>  }
>  
> -void set_disk_ro(struct gendisk *disk, int flag)
> +/**
> + * set_disk_ro - set a gendisk read-only
> + * @disk:	gendisk to operate on
> + * @ready_only:	%true to set the disk read-only, %false set the disk read/write
> + *
> + * This function is used to indicate whether a given disk device should have its
> + * read-only flag set. set_disk_ro() is typically used by device drivers to
> + * indicate whether the underlying physical device is write-protected.
> + */
> +void set_disk_ro(struct gendisk *disk, bool read_only)
>  {
> -	struct disk_part_iter piter;
> -	struct block_device *part;
> -
> -	if (disk->part0->bd_read_only != flag) {
> -		set_disk_ro_uevent(disk, flag);
> -		disk->part0->bd_read_only = flag;
> +	if (read_only) {
> +		if (test_and_set_bit(GD_READ_ONLY, &disk->state))
> +			return;
> +	} else {
> +		if (!test_and_clear_bit(GD_READ_ONLY, &disk->state))
> +			return;
>  	}
> -
> -	disk_part_iter_init(&piter, disk, DISK_PITER_INCL_EMPTY);
> -	while ((part = disk_part_iter_next(&piter)))
> -		part->bd_read_only = flag;
> -	disk_part_iter_exit(&piter);
> +	set_disk_ro_uevent(disk, read_only);
>  }
> -
>  EXPORT_SYMBOL(set_disk_ro);
>  
>  int bdev_read_only(struct block_device *bdev)
>  {
> -	return bdev->bd_read_only;
> +	return bdev->bd_read_only ||
> +		test_bit(GD_READ_ONLY, &bdev->bd_disk->state);
>  }
>  EXPORT_SYMBOL(bdev_read_only);

Maybe one inline version can be added for fast path(bio_check_ro()), and the approach
is good:

Reviewed-by: Ming Lei <ming.lei@redhat.com>

-- 
Ming


_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

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

* Re: [dm-devel] [PATCH 3/6] block: add a hard-readonly flag to struct gendisk
@ 2020-12-08 10:22     ` Ming Lei
  0 siblings, 0 replies; 90+ messages in thread
From: Ming Lei @ 2020-12-08 10:22 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Jens Axboe, Sagi Grimberg, Mike Snitzer, Oleksii Kurochko,
	Dongsheng Yang, linux-block, dm-devel, linux-nvme,
	Martin K . Petersen, Ilya Dryomov, ceph-devel

On Mon, Dec 07, 2020 at 02:19:15PM +0100, 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 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>
> Reviewed-by: Hannes Reinecke <hare@suse.de>
> ---
>  block/blk-core.c        |  2 +-
>  block/genhd.c           | 33 +++++++++++++++++++--------------
>  block/partitions/core.c |  3 +--
>  include/linux/genhd.h   |  6 ++++--
>  4 files changed, 25 insertions(+), 19 deletions(-)
> 
> diff --git a/block/blk-core.c b/block/blk-core.c
> index ad041e903b0a8f..ecd68415c6acad 100644
> --- a/block/blk-core.c
> +++ b/block/blk-core.c
> @@ -693,7 +693,7 @@ static inline bool should_fail_request(struct block_device *part,
>  
>  static inline bool bio_check_ro(struct bio *bio)
>  {
> -	if (op_is_write(bio_op(bio)) && bio->bi_bdev->bd_read_only) {
> +	if (op_is_write(bio_op(bio)) && bdev_read_only(bio->bi_bdev))
>  		char b[BDEVNAME_SIZE];
>  
>  		if (op_is_flush(bio->bi_opf) && !bio_sectors(bio))
> diff --git a/block/genhd.c b/block/genhd.c
> index c87013879b8650..878f94727aaa96 100644
> --- a/block/genhd.c
> +++ b/block/genhd.c
> @@ -1425,27 +1425,32 @@ static void set_disk_ro_uevent(struct gendisk *gd, int ro)
>  	kobject_uevent_env(&disk_to_dev(gd)->kobj, KOBJ_CHANGE, envp);
>  }
>  
> -void set_disk_ro(struct gendisk *disk, int flag)
> +/**
> + * set_disk_ro - set a gendisk read-only
> + * @disk:	gendisk to operate on
> + * @ready_only:	%true to set the disk read-only, %false set the disk read/write
> + *
> + * This function is used to indicate whether a given disk device should have its
> + * read-only flag set. set_disk_ro() is typically used by device drivers to
> + * indicate whether the underlying physical device is write-protected.
> + */
> +void set_disk_ro(struct gendisk *disk, bool read_only)
>  {
> -	struct disk_part_iter piter;
> -	struct block_device *part;
> -
> -	if (disk->part0->bd_read_only != flag) {
> -		set_disk_ro_uevent(disk, flag);
> -		disk->part0->bd_read_only = flag;
> +	if (read_only) {
> +		if (test_and_set_bit(GD_READ_ONLY, &disk->state))
> +			return;
> +	} else {
> +		if (!test_and_clear_bit(GD_READ_ONLY, &disk->state))
> +			return;
>  	}
> -
> -	disk_part_iter_init(&piter, disk, DISK_PITER_INCL_EMPTY);
> -	while ((part = disk_part_iter_next(&piter)))
> -		part->bd_read_only = flag;
> -	disk_part_iter_exit(&piter);
> +	set_disk_ro_uevent(disk, read_only);
>  }
> -
>  EXPORT_SYMBOL(set_disk_ro);
>  
>  int bdev_read_only(struct block_device *bdev)
>  {
> -	return bdev->bd_read_only;
> +	return bdev->bd_read_only ||
> +		test_bit(GD_READ_ONLY, &bdev->bd_disk->state);
>  }
>  EXPORT_SYMBOL(bdev_read_only);

Maybe one inline version can be added for fast path(bio_check_ro()), and the approach
is good:

Reviewed-by: Ming Lei <ming.lei@redhat.com>

-- 
Ming

--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel


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

* Re: [PATCH 4/6] block: propagate BLKROSET on the whole device to all partitions
  2020-12-07 13:19   ` Christoph Hellwig
  (?)
@ 2020-12-08 10:29     ` Ming Lei
  -1 siblings, 0 replies; 90+ messages in thread
From: Ming Lei @ 2020-12-08 10:29 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Jens Axboe, Sagi Grimberg, Mike Snitzer, Oleksii Kurochko,
	Dongsheng Yang, linux-block, dm-devel, linux-nvme,
	Martin K . Petersen, Ilya Dryomov, ceph-devel

On Mon, Dec 07, 2020 at 02:19:16PM +0100, Christoph Hellwig wrote:
> Change the policy so that a BLKROSET on the whole device also affects
> partitions.  To quote Martin K. Petersen:
> 
> It's very common for database folks to twiddle the read-only state of
> block devices and partitions. I know that our users will find it very
> counter-intuitive that setting /dev/sda read-only won't prevent writes
> to /dev/sda1.
> 
> The existing behavior is inconsistent in the sense that doing:
> 
> permits writes. But:
> 
> <something triggers revalidate>
> 
> doesn't.
> 
> And a subsequent:
> 
> doesn't work either since sda1's read-only policy has been inherited
> from the whole-disk device.
> 
> You need to do:
> 
> after setting the whole-disk device rw to effectuate the same change on
> the partitions, otherwise they are stuck being read-only indefinitely.
> 
> However, setting the read-only policy on a partition does *not* require
> the revalidate step. As a matter of fact, doing the revalidate will blow
> away the policy setting you just made.
> 
> So the user needs to take different actions depending on whether they
> are trying to read-protect a whole-disk device or a partition. Despite
> using the same ioctl. That is really confusing.
> 
> I have lost count how many times our customers have had data clobbered
> because of ambiguity of the existing whole-disk device policy. The
> current behavior violates the principle of least surprise by letting the
> user think they write protected the whole disk when they actually
> didn't.
> 
> Suggested-by: Martin K. Petersen <martin.petersen@oracle.com>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  block/genhd.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/block/genhd.c b/block/genhd.c
> index 878f94727aaa96..c214fcd25a05c9 100644
> --- a/block/genhd.c
> +++ b/block/genhd.c
> @@ -1449,8 +1449,7 @@ EXPORT_SYMBOL(set_disk_ro);
>  
>  int bdev_read_only(struct block_device *bdev)
>  {
> -	return bdev->bd_read_only ||
> -		test_bit(GD_READ_ONLY, &bdev->bd_disk->state);
> +	return bdev->bd_read_only || get_disk_ro(bdev->bd_disk);
>  }
>  EXPORT_SYMBOL(bdev_read_only);

I think this patch should be folded into previous one, otherwise
bdev_read_only(part) may return false even though ioctl(BLKROSET)
has been done on the whole disk.

-- 
Ming


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

* Re: [PATCH 4/6] block: propagate BLKROSET on the whole device to all partitions
@ 2020-12-08 10:29     ` Ming Lei
  0 siblings, 0 replies; 90+ messages in thread
From: Ming Lei @ 2020-12-08 10:29 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Jens Axboe, Sagi Grimberg, Mike Snitzer, Oleksii Kurochko,
	Dongsheng Yang, linux-block, dm-devel, linux-nvme,
	Martin K . Petersen, Ilya Dryomov, ceph-devel

On Mon, Dec 07, 2020 at 02:19:16PM +0100, Christoph Hellwig wrote:
> Change the policy so that a BLKROSET on the whole device also affects
> partitions.  To quote Martin K. Petersen:
> 
> It's very common for database folks to twiddle the read-only state of
> block devices and partitions. I know that our users will find it very
> counter-intuitive that setting /dev/sda read-only won't prevent writes
> to /dev/sda1.
> 
> The existing behavior is inconsistent in the sense that doing:
> 
> permits writes. But:
> 
> <something triggers revalidate>
> 
> doesn't.
> 
> And a subsequent:
> 
> doesn't work either since sda1's read-only policy has been inherited
> from the whole-disk device.
> 
> You need to do:
> 
> after setting the whole-disk device rw to effectuate the same change on
> the partitions, otherwise they are stuck being read-only indefinitely.
> 
> However, setting the read-only policy on a partition does *not* require
> the revalidate step. As a matter of fact, doing the revalidate will blow
> away the policy setting you just made.
> 
> So the user needs to take different actions depending on whether they
> are trying to read-protect a whole-disk device or a partition. Despite
> using the same ioctl. That is really confusing.
> 
> I have lost count how many times our customers have had data clobbered
> because of ambiguity of the existing whole-disk device policy. The
> current behavior violates the principle of least surprise by letting the
> user think they write protected the whole disk when they actually
> didn't.
> 
> Suggested-by: Martin K. Petersen <martin.petersen@oracle.com>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  block/genhd.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/block/genhd.c b/block/genhd.c
> index 878f94727aaa96..c214fcd25a05c9 100644
> --- a/block/genhd.c
> +++ b/block/genhd.c
> @@ -1449,8 +1449,7 @@ EXPORT_SYMBOL(set_disk_ro);
>  
>  int bdev_read_only(struct block_device *bdev)
>  {
> -	return bdev->bd_read_only ||
> -		test_bit(GD_READ_ONLY, &bdev->bd_disk->state);
> +	return bdev->bd_read_only || get_disk_ro(bdev->bd_disk);
>  }
>  EXPORT_SYMBOL(bdev_read_only);

I think this patch should be folded into previous one, otherwise
bdev_read_only(part) may return false even though ioctl(BLKROSET)
has been done on the whole disk.

-- 
Ming


_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

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

* Re: [dm-devel] [PATCH 4/6] block: propagate BLKROSET on the whole device to all partitions
@ 2020-12-08 10:29     ` Ming Lei
  0 siblings, 0 replies; 90+ messages in thread
From: Ming Lei @ 2020-12-08 10:29 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Jens Axboe, Sagi Grimberg, Mike Snitzer, Oleksii Kurochko,
	Dongsheng Yang, linux-block, dm-devel, linux-nvme,
	Martin K . Petersen, Ilya Dryomov, ceph-devel

On Mon, Dec 07, 2020 at 02:19:16PM +0100, Christoph Hellwig wrote:
> Change the policy so that a BLKROSET on the whole device also affects
> partitions.  To quote Martin K. Petersen:
> 
> It's very common for database folks to twiddle the read-only state of
> block devices and partitions. I know that our users will find it very
> counter-intuitive that setting /dev/sda read-only won't prevent writes
> to /dev/sda1.
> 
> The existing behavior is inconsistent in the sense that doing:
> 
> permits writes. But:
> 
> <something triggers revalidate>
> 
> doesn't.
> 
> And a subsequent:
> 
> doesn't work either since sda1's read-only policy has been inherited
> from the whole-disk device.
> 
> You need to do:
> 
> after setting the whole-disk device rw to effectuate the same change on
> the partitions, otherwise they are stuck being read-only indefinitely.
> 
> However, setting the read-only policy on a partition does *not* require
> the revalidate step. As a matter of fact, doing the revalidate will blow
> away the policy setting you just made.
> 
> So the user needs to take different actions depending on whether they
> are trying to read-protect a whole-disk device or a partition. Despite
> using the same ioctl. That is really confusing.
> 
> I have lost count how many times our customers have had data clobbered
> because of ambiguity of the existing whole-disk device policy. The
> current behavior violates the principle of least surprise by letting the
> user think they write protected the whole disk when they actually
> didn't.
> 
> Suggested-by: Martin K. Petersen <martin.petersen@oracle.com>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  block/genhd.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/block/genhd.c b/block/genhd.c
> index 878f94727aaa96..c214fcd25a05c9 100644
> --- a/block/genhd.c
> +++ b/block/genhd.c
> @@ -1449,8 +1449,7 @@ EXPORT_SYMBOL(set_disk_ro);
>  
>  int bdev_read_only(struct block_device *bdev)
>  {
> -	return bdev->bd_read_only ||
> -		test_bit(GD_READ_ONLY, &bdev->bd_disk->state);
> +	return bdev->bd_read_only || get_disk_ro(bdev->bd_disk);
>  }
>  EXPORT_SYMBOL(bdev_read_only);

I think this patch should be folded into previous one, otherwise
bdev_read_only(part) may return false even though ioctl(BLKROSET)
has been done on the whole disk.

-- 
Ming

--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel


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

* Re: [PATCH 3/6] block: add a hard-readonly flag to struct gendisk
  2020-12-08 10:22     ` Ming Lei
  (?)
@ 2020-12-08 10:57       ` Christoph Hellwig
  -1 siblings, 0 replies; 90+ messages in thread
From: Christoph Hellwig @ 2020-12-08 10:57 UTC (permalink / raw)
  To: Ming Lei
  Cc: Christoph Hellwig, Jens Axboe, Martin K . Petersen,
	Oleksii Kurochko, Sagi Grimberg, Mike Snitzer, Ilya Dryomov,
	Dongsheng Yang, ceph-devel, dm-devel, linux-block, linux-nvme,
	Hannes Reinecke

On Tue, Dec 08, 2020 at 06:22:11PM +0800, Ming Lei wrote:
> >  int bdev_read_only(struct block_device *bdev)
> >  {
> > -	return bdev->bd_read_only;
> > +	return bdev->bd_read_only ||
> > +		test_bit(GD_READ_ONLY, &bdev->bd_disk->state);
> >  }
> >  EXPORT_SYMBOL(bdev_read_only);
> 
> Maybe one inline version can be added for fast path(bio_check_ro()), and the approach
> is good:

I thought of that, but our header mess means it would have to be a macro.
I have a plan to reorganize the headers in the not too far future, at which
point this should become an inline.


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

* Re: [PATCH 3/6] block: add a hard-readonly flag to struct gendisk
@ 2020-12-08 10:57       ` Christoph Hellwig
  0 siblings, 0 replies; 90+ messages in thread
From: Christoph Hellwig @ 2020-12-08 10:57 UTC (permalink / raw)
  To: Ming Lei
  Cc: Jens Axboe, Sagi Grimberg, Mike Snitzer, Oleksii Kurochko,
	ceph-devel, Dongsheng Yang, linux-block, dm-devel, linux-nvme,
	Martin K . Petersen, Ilya Dryomov, Christoph Hellwig,
	Hannes Reinecke

On Tue, Dec 08, 2020 at 06:22:11PM +0800, Ming Lei wrote:
> >  int bdev_read_only(struct block_device *bdev)
> >  {
> > -	return bdev->bd_read_only;
> > +	return bdev->bd_read_only ||
> > +		test_bit(GD_READ_ONLY, &bdev->bd_disk->state);
> >  }
> >  EXPORT_SYMBOL(bdev_read_only);
> 
> Maybe one inline version can be added for fast path(bio_check_ro()), and the approach
> is good:

I thought of that, but our header mess means it would have to be a macro.
I have a plan to reorganize the headers in the not too far future, at which
point this should become an inline.


_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

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

* Re: [dm-devel] [PATCH 3/6] block: add a hard-readonly flag to struct gendisk
@ 2020-12-08 10:57       ` Christoph Hellwig
  0 siblings, 0 replies; 90+ messages in thread
From: Christoph Hellwig @ 2020-12-08 10:57 UTC (permalink / raw)
  To: Ming Lei
  Cc: Jens Axboe, Sagi Grimberg, Mike Snitzer, Oleksii Kurochko,
	ceph-devel, Dongsheng Yang, linux-block, dm-devel, linux-nvme,
	Martin K . Petersen, Ilya Dryomov, Christoph Hellwig

On Tue, Dec 08, 2020 at 06:22:11PM +0800, Ming Lei wrote:
> >  int bdev_read_only(struct block_device *bdev)
> >  {
> > -	return bdev->bd_read_only;
> > +	return bdev->bd_read_only ||
> > +		test_bit(GD_READ_ONLY, &bdev->bd_disk->state);
> >  }
> >  EXPORT_SYMBOL(bdev_read_only);
> 
> Maybe one inline version can be added for fast path(bio_check_ro()), and the approach
> is good:

I thought of that, but our header mess means it would have to be a macro.
I have a plan to reorganize the headers in the not too far future, at which
point this should become an inline.

--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel


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

* Re: [PATCH 4/6] block: propagate BLKROSET on the whole device to all partitions
  2020-12-08 10:29     ` Ming Lei
  (?)
@ 2020-12-08 10:59       ` Christoph Hellwig
  -1 siblings, 0 replies; 90+ messages in thread
From: Christoph Hellwig @ 2020-12-08 10:59 UTC (permalink / raw)
  To: Ming Lei
  Cc: Christoph Hellwig, Jens Axboe, Sagi Grimberg, Mike Snitzer,
	Oleksii Kurochko, Dongsheng Yang, linux-block, dm-devel,
	linux-nvme, Martin K . Petersen, Ilya Dryomov, ceph-devel

On Tue, Dec 08, 2020 at 06:29:23PM +0800, Ming Lei wrote:
> > -		test_bit(GD_READ_ONLY, &bdev->bd_disk->state);
> > +	return bdev->bd_read_only || get_disk_ro(bdev->bd_disk);
> >  }
> >  EXPORT_SYMBOL(bdev_read_only);
> 
> I think this patch should be folded into previous one, otherwise
> bdev_read_only(part) may return false even though ioctl(BLKROSET)
> has been done on the whole disk.

The above is the existing behavior going back back very far, and I feel
much more comfortable having a small self-contained patch that changes
this behavior.

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

* Re: [PATCH 4/6] block: propagate BLKROSET on the whole device to all partitions
@ 2020-12-08 10:59       ` Christoph Hellwig
  0 siblings, 0 replies; 90+ messages in thread
From: Christoph Hellwig @ 2020-12-08 10:59 UTC (permalink / raw)
  To: Ming Lei
  Cc: Jens Axboe, Sagi Grimberg, Mike Snitzer, Oleksii Kurochko,
	ceph-devel, Dongsheng Yang, linux-block, dm-devel, linux-nvme,
	Martin K . Petersen, Ilya Dryomov, Christoph Hellwig

On Tue, Dec 08, 2020 at 06:29:23PM +0800, Ming Lei wrote:
> > -		test_bit(GD_READ_ONLY, &bdev->bd_disk->state);
> > +	return bdev->bd_read_only || get_disk_ro(bdev->bd_disk);
> >  }
> >  EXPORT_SYMBOL(bdev_read_only);
> 
> I think this patch should be folded into previous one, otherwise
> bdev_read_only(part) may return false even though ioctl(BLKROSET)
> has been done on the whole disk.

The above is the existing behavior going back back very far, and I feel
much more comfortable having a small self-contained patch that changes
this behavior.

_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

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

* Re: [dm-devel] [PATCH 4/6] block: propagate BLKROSET on the whole device to all partitions
@ 2020-12-08 10:59       ` Christoph Hellwig
  0 siblings, 0 replies; 90+ messages in thread
From: Christoph Hellwig @ 2020-12-08 10:59 UTC (permalink / raw)
  To: Ming Lei
  Cc: Jens Axboe, Sagi Grimberg, Mike Snitzer, Oleksii Kurochko,
	ceph-devel, Dongsheng Yang, linux-block, dm-devel, linux-nvme,
	Martin K . Petersen, Ilya Dryomov, Christoph Hellwig

On Tue, Dec 08, 2020 at 06:29:23PM +0800, Ming Lei wrote:
> > -		test_bit(GD_READ_ONLY, &bdev->bd_disk->state);
> > +	return bdev->bd_read_only || get_disk_ro(bdev->bd_disk);
> >  }
> >  EXPORT_SYMBOL(bdev_read_only);
> 
> I think this patch should be folded into previous one, otherwise
> bdev_read_only(part) may return false even though ioctl(BLKROSET)
> has been done on the whole disk.

The above is the existing behavior going back back very far, and I feel
much more comfortable having a small self-contained patch that changes
this behavior.

--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel


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

* Re: [PATCH 4/6] block: propagate BLKROSET on the whole device to all partitions
  2020-12-08  9:25       ` Christoph Hellwig
  (?)
@ 2020-12-08 12:41         ` Johannes Thumshirn
  -1 siblings, 0 replies; 90+ messages in thread
From: Johannes Thumshirn @ 2020-12-08 12:41 UTC (permalink / raw)
  To: Christoph Hellwig, Martin K. Petersen
  Cc: Jens Axboe, Oleksii Kurochko, Sagi Grimberg, Mike Snitzer,
	Ilya Dryomov, Dongsheng Yang, ceph-devel, dm-devel, linux-block,
	linux-nvme

On 08/12/2020 10:28, Christoph Hellwig wrote:
> On Tue, Dec 08, 2020 at 12:27:41AM -0500, Martin K. Petersen wrote:
>>
>> Christoph,
>>
>>> The existing behavior is inconsistent in the sense that doing:
>>>
>>> permits writes. But:
>>>
>>> <something triggers revalidate>
>>>
>>> doesn't.
>>>
>>> And a subsequent:
>>
>> Looks like the command line pieces got zapped from the commit
>> description.
> 
> Yeah.  It seems like git commit just removed them after I pasted them,
> weird.
> 

Might be because of a leading #, happened to me as well in the past. Just
add a single space on the start of the line and git commit is happy.

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

* Re: [PATCH 4/6] block: propagate BLKROSET on the whole device to all partitions
@ 2020-12-08 12:41         ` Johannes Thumshirn
  0 siblings, 0 replies; 90+ messages in thread
From: Johannes Thumshirn @ 2020-12-08 12:41 UTC (permalink / raw)
  To: Christoph Hellwig, Martin K. Petersen
  Cc: Jens Axboe, Sagi Grimberg, Mike Snitzer, Oleksii Kurochko,
	Dongsheng Yang, linux-block, dm-devel, linux-nvme, Ilya Dryomov,
	ceph-devel

On 08/12/2020 10:28, Christoph Hellwig wrote:
> On Tue, Dec 08, 2020 at 12:27:41AM -0500, Martin K. Petersen wrote:
>>
>> Christoph,
>>
>>> The existing behavior is inconsistent in the sense that doing:
>>>
>>> permits writes. But:
>>>
>>> <something triggers revalidate>
>>>
>>> doesn't.
>>>
>>> And a subsequent:
>>
>> Looks like the command line pieces got zapped from the commit
>> description.
> 
> Yeah.  It seems like git commit just removed them after I pasted them,
> weird.
> 

Might be because of a leading #, happened to me as well in the past. Just
add a single space on the start of the line and git commit is happy.

_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

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

* Re: [dm-devel] [PATCH 4/6] block: propagate BLKROSET on the whole device to all partitions
@ 2020-12-08 12:41         ` Johannes Thumshirn
  0 siblings, 0 replies; 90+ messages in thread
From: Johannes Thumshirn @ 2020-12-08 12:41 UTC (permalink / raw)
  To: Christoph Hellwig, Martin K. Petersen
  Cc: Jens Axboe, Sagi, Grimberg, Mike Snitzer, Oleksii Kurochko,
	Dongsheng Yang, linux-block, dm-devel, linux-nvme, Ilya Dryomov,
	ceph-devel

On 08/12/2020 10:28, Christoph Hellwig wrote:
> On Tue, Dec 08, 2020 at 12:27:41AM -0500, Martin K. Petersen wrote:
>>
>> Christoph,
>>
>>> The existing behavior is inconsistent in the sense that doing:
>>>
>>> permits writes. But:
>>>
>>> <something triggers revalidate>
>>>
>>> doesn't.
>>>
>>> And a subsequent:
>>
>> Looks like the command line pieces got zapped from the commit
>> description.
> 
> Yeah.  It seems like git commit just removed them after I pasted them,
> weird.
> 

Might be because of a leading #, happened to me as well in the past. Just
add a single space on the start of the line and git commit is happy.



--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel


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

* Re: [PATCH 4/6] block: propagate BLKROSET on the whole device to all partitions
  2020-12-08 10:59       ` Christoph Hellwig
  (?)
@ 2020-12-09  1:23         ` Ming Lei
  -1 siblings, 0 replies; 90+ messages in thread
From: Ming Lei @ 2020-12-09  1:23 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Jens Axboe, Sagi Grimberg, Mike Snitzer, Oleksii Kurochko,
	Dongsheng Yang, linux-block, dm-devel, linux-nvme,
	Martin K . Petersen, Ilya Dryomov, ceph-devel

On Tue, Dec 08, 2020 at 11:59:27AM +0100, Christoph Hellwig wrote:
> On Tue, Dec 08, 2020 at 06:29:23PM +0800, Ming Lei wrote:
> > > -		test_bit(GD_READ_ONLY, &bdev->bd_disk->state);
> > > +	return bdev->bd_read_only || get_disk_ro(bdev->bd_disk);
> > >  }
> > >  EXPORT_SYMBOL(bdev_read_only);
> > 
> > I think this patch should be folded into previous one, otherwise
> > bdev_read_only(part) may return false even though ioctl(BLKROSET)
> > has been done on the whole disk.
> 
> The above is the existing behavior going back back very far, and I feel
> much more comfortable having a small self-contained patch that changes
> this behavior.
> 

OK, then looks fine:

Reviewed-by: Ming Lei <ming.lei@redhat.com>

-- 
Ming


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

* Re: [PATCH 4/6] block: propagate BLKROSET on the whole device to all partitions
@ 2020-12-09  1:23         ` Ming Lei
  0 siblings, 0 replies; 90+ messages in thread
From: Ming Lei @ 2020-12-09  1:23 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Jens Axboe, Sagi Grimberg, Mike Snitzer, Oleksii Kurochko,
	Dongsheng Yang, linux-block, dm-devel, linux-nvme,
	Martin K . Petersen, Ilya Dryomov, ceph-devel

On Tue, Dec 08, 2020 at 11:59:27AM +0100, Christoph Hellwig wrote:
> On Tue, Dec 08, 2020 at 06:29:23PM +0800, Ming Lei wrote:
> > > -		test_bit(GD_READ_ONLY, &bdev->bd_disk->state);
> > > +	return bdev->bd_read_only || get_disk_ro(bdev->bd_disk);
> > >  }
> > >  EXPORT_SYMBOL(bdev_read_only);
> > 
> > I think this patch should be folded into previous one, otherwise
> > bdev_read_only(part) may return false even though ioctl(BLKROSET)
> > has been done on the whole disk.
> 
> The above is the existing behavior going back back very far, and I feel
> much more comfortable having a small self-contained patch that changes
> this behavior.
> 

OK, then looks fine:

Reviewed-by: Ming Lei <ming.lei@redhat.com>

-- 
Ming


_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

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

* Re: [dm-devel] [PATCH 4/6] block: propagate BLKROSET on the whole device to all partitions
@ 2020-12-09  1:23         ` Ming Lei
  0 siblings, 0 replies; 90+ messages in thread
From: Ming Lei @ 2020-12-09  1:23 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Jens Axboe, Sagi Grimberg, Mike Snitzer, Oleksii Kurochko,
	Dongsheng Yang, linux-block, dm-devel, linux-nvme,
	Martin K . Petersen, Ilya Dryomov, ceph-devel

On Tue, Dec 08, 2020 at 11:59:27AM +0100, Christoph Hellwig wrote:
> On Tue, Dec 08, 2020 at 06:29:23PM +0800, Ming Lei wrote:
> > > -		test_bit(GD_READ_ONLY, &bdev->bd_disk->state);
> > > +	return bdev->bd_read_only || get_disk_ro(bdev->bd_disk);
> > >  }
> > >  EXPORT_SYMBOL(bdev_read_only);
> > 
> > I think this patch should be folded into previous one, otherwise
> > bdev_read_only(part) may return false even though ioctl(BLKROSET)
> > has been done on the whole disk.
> 
> The above is the existing behavior going back back very far, and I feel
> much more comfortable having a small self-contained patch that changes
> this behavior.
> 

OK, then looks fine:

Reviewed-by: Ming Lei <ming.lei@redhat.com>

-- 
Ming

--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel


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

* Re: split hard read-only vs read-only policy v2
  2020-12-07 13:19 ` Christoph Hellwig
  (?)
@ 2020-12-10  7:50   ` Christoph Hellwig
  -1 siblings, 0 replies; 90+ messages in thread
From: Christoph Hellwig @ 2020-12-10  7:50 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Martin K . Petersen, Oleksii Kurochko, Sagi Grimberg,
	Mike Snitzer, Ilya Dryomov, Dongsheng Yang, ceph-devel, dm-devel,
	linux-block, linux-nvme

Jens, can you pick this up for 5.11?

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

* Re: split hard read-only vs read-only policy v2
@ 2020-12-10  7:50   ` Christoph Hellwig
  0 siblings, 0 replies; 90+ messages in thread
From: Christoph Hellwig @ 2020-12-10  7:50 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Sagi Grimberg, Mike Snitzer, Oleksii Kurochko, Dongsheng Yang,
	linux-block, dm-devel, linux-nvme, Martin K . Petersen,
	Ilya Dryomov, ceph-devel

Jens, can you pick this up for 5.11?

_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

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

* Re: [dm-devel] split hard read-only vs read-only policy v2
@ 2020-12-10  7:50   ` Christoph Hellwig
  0 siblings, 0 replies; 90+ messages in thread
From: Christoph Hellwig @ 2020-12-10  7:50 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Sagi Grimberg, Mike Snitzer, Oleksii Kurochko, Dongsheng Yang,
	linux-block, dm-devel, linux-nvme, Martin K . Petersen,
	Ilya Dryomov, ceph-devel

Jens, can you pick this up for 5.11?

--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel


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

* Re: [PATCH 6/6] nvme: allow revalidate to set a namespace read-only
  2021-01-09 10:42   ` Christoph Hellwig
@ 2021-01-10 15:01     ` Hannes Reinecke
  -1 siblings, 0 replies; 90+ messages in thread
From: Hannes Reinecke @ 2021-01-10 15:01 UTC (permalink / raw)
  To: Christoph Hellwig, Jens Axboe
  Cc: Martin K . Petersen, Oleksii Kurochko, Sagi Grimberg,
	Mike Snitzer, Ilya Dryomov, Dongsheng Yang, ceph-devel, dm-devel,
	linux-block, linux-nvme, Keith Busch

On 1/9/21 11:42 AM, Christoph Hellwig wrote:
> Unconditionally call set_disk_ro now that it only updates the hardware
> state.  This allows to properly set up the Linux devices read-only when
> the controller turns a previously writable namespace read-only.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> Reviewed-by: Keith Busch <kbusch@kernel.org>
> Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
> ---
>   drivers/nvme/host/core.c | 5 ++---
>   1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
> index ce1b6151944131..3a0557ccc9fc5d 100644
> --- a/drivers/nvme/host/core.c
> +++ b/drivers/nvme/host/core.c
> @@ -2114,9 +2114,8 @@ static void nvme_update_disk_info(struct gendisk *disk,
>   	nvme_config_discard(disk, ns);
>   	nvme_config_write_zeroes(disk, ns);
>   
> -	if ((id->nsattr & NVME_NS_ATTR_RO) ||
> -	    test_bit(NVME_NS_FORCE_RO, &ns->flags))
> -		set_disk_ro(disk, true);
> +	set_disk_ro(disk, (id->nsattr & NVME_NS_ATTR_RO) ||
> +		test_bit(NVME_NS_FORCE_RO, &ns->flags));
>   }
>   
>   static inline bool nvme_first_scan(struct gendisk *disk)
> 
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

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

* Re: [PATCH 6/6] nvme: allow revalidate to set a namespace read-only
@ 2021-01-10 15:01     ` Hannes Reinecke
  0 siblings, 0 replies; 90+ messages in thread
From: Hannes Reinecke @ 2021-01-10 15:01 UTC (permalink / raw)
  To: Christoph Hellwig, Jens Axboe
  Cc: Sagi Grimberg, Mike Snitzer, Oleksii Kurochko, Dongsheng Yang,
	linux-block, dm-devel, linux-nvme, Martin K . Petersen,
	Keith Busch, Ilya Dryomov, ceph-devel

On 1/9/21 11:42 AM, Christoph Hellwig wrote:
> Unconditionally call set_disk_ro now that it only updates the hardware
> state.  This allows to properly set up the Linux devices read-only when
> the controller turns a previously writable namespace read-only.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> Reviewed-by: Keith Busch <kbusch@kernel.org>
> Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
> ---
>   drivers/nvme/host/core.c | 5 ++---
>   1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
> index ce1b6151944131..3a0557ccc9fc5d 100644
> --- a/drivers/nvme/host/core.c
> +++ b/drivers/nvme/host/core.c
> @@ -2114,9 +2114,8 @@ static void nvme_update_disk_info(struct gendisk *disk,
>   	nvme_config_discard(disk, ns);
>   	nvme_config_write_zeroes(disk, ns);
>   
> -	if ((id->nsattr & NVME_NS_ATTR_RO) ||
> -	    test_bit(NVME_NS_FORCE_RO, &ns->flags))
> -		set_disk_ro(disk, true);
> +	set_disk_ro(disk, (id->nsattr & NVME_NS_ATTR_RO) ||
> +		test_bit(NVME_NS_FORCE_RO, &ns->flags));
>   }
>   
>   static inline bool nvme_first_scan(struct gendisk *disk)
> 
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

_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

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

* Re: [PATCH 6/6] nvme: allow revalidate to set a namespace read-only
  2021-01-09 10:42   ` Christoph Hellwig
@ 2021-01-09 20:27     ` Chaitanya Kulkarni
  -1 siblings, 0 replies; 90+ messages in thread
From: Chaitanya Kulkarni @ 2021-01-09 20:27 UTC (permalink / raw)
  To: Christoph Hellwig, Jens Axboe
  Cc: Martin K . Petersen, Oleksii Kurochko, Sagi Grimberg,
	Mike Snitzer, Ilya Dryomov, Dongsheng Yang, ceph-devel, dm-devel,
	linux-block, linux-nvme, Keith Busch

On 1/9/21 02:49, Christoph Hellwig wrote:
> Unconditionally call set_disk_ro now that it only updates the hardware
> state.  This allows to properly set up the Linux devices read-only when
> the controller turns a previously writable namespace read-only.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> Reviewed-by: Keith Busch <kbusch@kernel.org>
> Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
> ---
>  drivers/nvme/host/core.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
> index ce1b6151944131..3a0557ccc9fc5d 100644
> --- a/drivers/nvme/host/core.c
> +++ b/drivers/nvme/host/core.c
> @@ -2114,9 +2114,8 @@ static void nvme_update_disk_info(struct gendisk *disk,
>  	nvme_config_discard(disk, ns);
>  	nvme_config_write_zeroes(disk, ns);
>  
> -	if ((id->nsattr & NVME_NS_ATTR_RO) ||
> -	    test_bit(NVME_NS_FORCE_RO, &ns->flags))
> -		set_disk_ro(disk, true);
> +	set_disk_ro(disk, (id->nsattr & NVME_NS_ATTR_RO) ||
> +		test_bit(NVME_NS_FORCE_RO, &ns->flags));
>  }
>  

If we are adding a multi-line function call can we please consider
following, on the top of this that matches earlier multi-line function
call in the same nvme_update_disk_into() :-

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 3a0557ccc9fc..5cf0f801a95e 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -2115,7 +2115,7 @@ static void nvme_update_disk_info(struct gendisk
*disk,
        nvme_config_write_zeroes(disk, ns);
 
        set_disk_ro(disk, (id->nsattr & NVME_NS_ATTR_RO) ||
-               test_bit(NVME_NS_FORCE_RO, &ns->flags));
+                   test_bit(NVME_NS_FORCE_RO, &ns->flags));
 }
 
static inline bool nvme_first_scan(struct gendisk *disk)

Otherwise, looks good.
Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
>  static inline bool nvme_first_scan(struct gendisk *disk)


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

* Re: [PATCH 6/6] nvme: allow revalidate to set a namespace read-only
@ 2021-01-09 20:27     ` Chaitanya Kulkarni
  0 siblings, 0 replies; 90+ messages in thread
From: Chaitanya Kulkarni @ 2021-01-09 20:27 UTC (permalink / raw)
  To: Christoph Hellwig, Jens Axboe
  Cc: Sagi Grimberg, Mike Snitzer, Oleksii Kurochko, Dongsheng Yang,
	linux-block, dm-devel, linux-nvme, Martin K . Petersen,
	Keith Busch, Ilya Dryomov, ceph-devel

On 1/9/21 02:49, Christoph Hellwig wrote:
> Unconditionally call set_disk_ro now that it only updates the hardware
> state.  This allows to properly set up the Linux devices read-only when
> the controller turns a previously writable namespace read-only.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> Reviewed-by: Keith Busch <kbusch@kernel.org>
> Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
> ---
>  drivers/nvme/host/core.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
> index ce1b6151944131..3a0557ccc9fc5d 100644
> --- a/drivers/nvme/host/core.c
> +++ b/drivers/nvme/host/core.c
> @@ -2114,9 +2114,8 @@ static void nvme_update_disk_info(struct gendisk *disk,
>  	nvme_config_discard(disk, ns);
>  	nvme_config_write_zeroes(disk, ns);
>  
> -	if ((id->nsattr & NVME_NS_ATTR_RO) ||
> -	    test_bit(NVME_NS_FORCE_RO, &ns->flags))
> -		set_disk_ro(disk, true);
> +	set_disk_ro(disk, (id->nsattr & NVME_NS_ATTR_RO) ||
> +		test_bit(NVME_NS_FORCE_RO, &ns->flags));
>  }
>  

If we are adding a multi-line function call can we please consider
following, on the top of this that matches earlier multi-line function
call in the same nvme_update_disk_into() :-

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 3a0557ccc9fc..5cf0f801a95e 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -2115,7 +2115,7 @@ static void nvme_update_disk_info(struct gendisk
*disk,
        nvme_config_write_zeroes(disk, ns);
 
        set_disk_ro(disk, (id->nsattr & NVME_NS_ATTR_RO) ||
-               test_bit(NVME_NS_FORCE_RO, &ns->flags));
+                   test_bit(NVME_NS_FORCE_RO, &ns->flags));
 }
 
static inline bool nvme_first_scan(struct gendisk *disk)

Otherwise, looks good.
Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
>  static inline bool nvme_first_scan(struct gendisk *disk)


_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

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

* [PATCH 6/6] nvme: allow revalidate to set a namespace read-only
  2021-01-09 10:42 split hard read-only vs read-only policy v3 (resend) Christoph Hellwig
@ 2021-01-09 10:42   ` Christoph Hellwig
  0 siblings, 0 replies; 90+ messages in thread
From: Christoph Hellwig @ 2021-01-09 10:42 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Martin K . Petersen, Oleksii Kurochko, Sagi Grimberg,
	Mike Snitzer, Ilya Dryomov, Dongsheng Yang, ceph-devel, dm-devel,
	linux-block, linux-nvme, Keith Busch

Unconditionally call set_disk_ro now that it only updates the hardware
state.  This allows to properly set up the Linux devices read-only when
the controller turns a previously writable namespace read-only.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Keith Busch <kbusch@kernel.org>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
---
 drivers/nvme/host/core.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index ce1b6151944131..3a0557ccc9fc5d 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -2114,9 +2114,8 @@ static void nvme_update_disk_info(struct gendisk *disk,
 	nvme_config_discard(disk, ns);
 	nvme_config_write_zeroes(disk, ns);
 
-	if ((id->nsattr & NVME_NS_ATTR_RO) ||
-	    test_bit(NVME_NS_FORCE_RO, &ns->flags))
-		set_disk_ro(disk, true);
+	set_disk_ro(disk, (id->nsattr & NVME_NS_ATTR_RO) ||
+		test_bit(NVME_NS_FORCE_RO, &ns->flags));
 }
 
 static inline bool nvme_first_scan(struct gendisk *disk)
-- 
2.29.2


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

* [PATCH 6/6] nvme: allow revalidate to set a namespace read-only
@ 2021-01-09 10:42   ` Christoph Hellwig
  0 siblings, 0 replies; 90+ messages in thread
From: Christoph Hellwig @ 2021-01-09 10:42 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Sagi Grimberg, Mike Snitzer, Oleksii Kurochko, Dongsheng Yang,
	linux-block, dm-devel, linux-nvme, Martin K . Petersen,
	Keith Busch, Ilya Dryomov, ceph-devel

Unconditionally call set_disk_ro now that it only updates the hardware
state.  This allows to properly set up the Linux devices read-only when
the controller turns a previously writable namespace read-only.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Keith Busch <kbusch@kernel.org>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
---
 drivers/nvme/host/core.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index ce1b6151944131..3a0557ccc9fc5d 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -2114,9 +2114,8 @@ static void nvme_update_disk_info(struct gendisk *disk,
 	nvme_config_discard(disk, ns);
 	nvme_config_write_zeroes(disk, ns);
 
-	if ((id->nsattr & NVME_NS_ATTR_RO) ||
-	    test_bit(NVME_NS_FORCE_RO, &ns->flags))
-		set_disk_ro(disk, true);
+	set_disk_ro(disk, (id->nsattr & NVME_NS_ATTR_RO) ||
+		test_bit(NVME_NS_FORCE_RO, &ns->flags));
 }
 
 static inline bool nvme_first_scan(struct gendisk *disk)
-- 
2.29.2


_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

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

* Re: [PATCH 6/6] nvme: allow revalidate to set a namespace read-only
  2020-12-08 16:28   ` Christoph Hellwig
@ 2020-12-09  2:54     ` Ming Lei
  -1 siblings, 0 replies; 90+ messages in thread
From: Ming Lei @ 2020-12-09  2:54 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Jens Axboe, Martin K . Petersen, Oleksii Kurochko, Sagi Grimberg,
	Mike Snitzer, Ilya Dryomov, Dongsheng Yang, ceph-devel, dm-devel,
	linux-block, linux-nvme, Keith Busch

On Tue, Dec 08, 2020 at 05:28:29PM +0100, Christoph Hellwig wrote:
> Unconditionally call set_disk_ro now that it only updates the hardware
> state.  This allows to properly set up the Linux devices read-only when
> the controller turns a previously writable namespace read-only.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> Reviewed-by: Keith Busch <kbusch@kernel.org>
> Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
> ---
>  drivers/nvme/host/core.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
> index ce1b6151944131..3a0557ccc9fc5d 100644
> --- a/drivers/nvme/host/core.c
> +++ b/drivers/nvme/host/core.c
> @@ -2114,9 +2114,8 @@ static void nvme_update_disk_info(struct gendisk *disk,
>  	nvme_config_discard(disk, ns);
>  	nvme_config_write_zeroes(disk, ns);
>  
> -	if ((id->nsattr & NVME_NS_ATTR_RO) ||
> -	    test_bit(NVME_NS_FORCE_RO, &ns->flags))
> -		set_disk_ro(disk, true);
> +	set_disk_ro(disk, (id->nsattr & NVME_NS_ATTR_RO) ||
> +		test_bit(NVME_NS_FORCE_RO, &ns->flags));
>  }
>  
>  static inline bool nvme_first_scan(struct gendisk *disk)
> -- 
> 2.29.2
> 

Reviewed-by: Ming Lei <ming.lei@redhat.com>

-- 
Ming


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

* Re: [PATCH 6/6] nvme: allow revalidate to set a namespace read-only
@ 2020-12-09  2:54     ` Ming Lei
  0 siblings, 0 replies; 90+ messages in thread
From: Ming Lei @ 2020-12-09  2:54 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Jens Axboe, Sagi Grimberg, Mike Snitzer, Oleksii Kurochko,
	Dongsheng Yang, linux-block, dm-devel, linux-nvme,
	Martin K . Petersen, Keith Busch, Ilya Dryomov, ceph-devel

On Tue, Dec 08, 2020 at 05:28:29PM +0100, Christoph Hellwig wrote:
> Unconditionally call set_disk_ro now that it only updates the hardware
> state.  This allows to properly set up the Linux devices read-only when
> the controller turns a previously writable namespace read-only.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> Reviewed-by: Keith Busch <kbusch@kernel.org>
> Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
> ---
>  drivers/nvme/host/core.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
> index ce1b6151944131..3a0557ccc9fc5d 100644
> --- a/drivers/nvme/host/core.c
> +++ b/drivers/nvme/host/core.c
> @@ -2114,9 +2114,8 @@ static void nvme_update_disk_info(struct gendisk *disk,
>  	nvme_config_discard(disk, ns);
>  	nvme_config_write_zeroes(disk, ns);
>  
> -	if ((id->nsattr & NVME_NS_ATTR_RO) ||
> -	    test_bit(NVME_NS_FORCE_RO, &ns->flags))
> -		set_disk_ro(disk, true);
> +	set_disk_ro(disk, (id->nsattr & NVME_NS_ATTR_RO) ||
> +		test_bit(NVME_NS_FORCE_RO, &ns->flags));
>  }
>  
>  static inline bool nvme_first_scan(struct gendisk *disk)
> -- 
> 2.29.2
> 

Reviewed-by: Ming Lei <ming.lei@redhat.com>

-- 
Ming


_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

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

* Re: [PATCH 6/6] nvme: allow revalidate to set a namespace read-only
  2020-12-08 16:28   ` Christoph Hellwig
@ 2020-12-08 16:49     ` Hannes Reinecke
  -1 siblings, 0 replies; 90+ messages in thread
From: Hannes Reinecke @ 2020-12-08 16:49 UTC (permalink / raw)
  To: Christoph Hellwig, Jens Axboe
  Cc: Martin K . Petersen, Oleksii Kurochko, Sagi Grimberg,
	Mike Snitzer, Ilya Dryomov, Dongsheng Yang, ceph-devel, dm-devel,
	linux-block, linux-nvme, Keith Busch

On 12/8/20 5:28 PM, Christoph Hellwig wrote:
> Unconditionally call set_disk_ro now that it only updates the hardware
> state.  This allows to properly set up the Linux devices read-only when
> the controller turns a previously writable namespace read-only.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> Reviewed-by: Keith Busch <kbusch@kernel.org>
> Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
> ---
>   drivers/nvme/host/core.c | 5 ++---
>   1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
> index ce1b6151944131..3a0557ccc9fc5d 100644
> --- a/drivers/nvme/host/core.c
> +++ b/drivers/nvme/host/core.c
> @@ -2114,9 +2114,8 @@ static void nvme_update_disk_info(struct gendisk *disk,
>   	nvme_config_discard(disk, ns);
>   	nvme_config_write_zeroes(disk, ns);
>   
> -	if ((id->nsattr & NVME_NS_ATTR_RO) ||
> -	    test_bit(NVME_NS_FORCE_RO, &ns->flags))
> -		set_disk_ro(disk, true);
> +	set_disk_ro(disk, (id->nsattr & NVME_NS_ATTR_RO) ||
> +		test_bit(NVME_NS_FORCE_RO, &ns->flags));
>   }
>   
>   static inline bool nvme_first_scan(struct gendisk *disk)
> 
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

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

* Re: [PATCH 6/6] nvme: allow revalidate to set a namespace read-only
@ 2020-12-08 16:49     ` Hannes Reinecke
  0 siblings, 0 replies; 90+ messages in thread
From: Hannes Reinecke @ 2020-12-08 16:49 UTC (permalink / raw)
  To: Christoph Hellwig, Jens Axboe
  Cc: Sagi Grimberg, Mike Snitzer, Oleksii Kurochko, Dongsheng Yang,
	linux-block, dm-devel, linux-nvme, Martin K . Petersen,
	Keith Busch, Ilya Dryomov, ceph-devel

On 12/8/20 5:28 PM, Christoph Hellwig wrote:
> Unconditionally call set_disk_ro now that it only updates the hardware
> state.  This allows to properly set up the Linux devices read-only when
> the controller turns a previously writable namespace read-only.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> Reviewed-by: Keith Busch <kbusch@kernel.org>
> Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
> ---
>   drivers/nvme/host/core.c | 5 ++---
>   1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
> index ce1b6151944131..3a0557ccc9fc5d 100644
> --- a/drivers/nvme/host/core.c
> +++ b/drivers/nvme/host/core.c
> @@ -2114,9 +2114,8 @@ static void nvme_update_disk_info(struct gendisk *disk,
>   	nvme_config_discard(disk, ns);
>   	nvme_config_write_zeroes(disk, ns);
>   
> -	if ((id->nsattr & NVME_NS_ATTR_RO) ||
> -	    test_bit(NVME_NS_FORCE_RO, &ns->flags))
> -		set_disk_ro(disk, true);
> +	set_disk_ro(disk, (id->nsattr & NVME_NS_ATTR_RO) ||
> +		test_bit(NVME_NS_FORCE_RO, &ns->flags));
>   }
>   
>   static inline bool nvme_first_scan(struct gendisk *disk)
> 
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

_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

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

* [PATCH 6/6] nvme: allow revalidate to set a namespace read-only
  2020-12-08 16:28 split hard read-only vs read-only policy v3 Christoph Hellwig
@ 2020-12-08 16:28   ` Christoph Hellwig
  0 siblings, 0 replies; 90+ messages in thread
From: Christoph Hellwig @ 2020-12-08 16:28 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Martin K . Petersen, Oleksii Kurochko, Sagi Grimberg,
	Mike Snitzer, Ilya Dryomov, Dongsheng Yang, ceph-devel, dm-devel,
	linux-block, linux-nvme, Keith Busch

Unconditionally call set_disk_ro now that it only updates the hardware
state.  This allows to properly set up the Linux devices read-only when
the controller turns a previously writable namespace read-only.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Keith Busch <kbusch@kernel.org>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
---
 drivers/nvme/host/core.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index ce1b6151944131..3a0557ccc9fc5d 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -2114,9 +2114,8 @@ static void nvme_update_disk_info(struct gendisk *disk,
 	nvme_config_discard(disk, ns);
 	nvme_config_write_zeroes(disk, ns);
 
-	if ((id->nsattr & NVME_NS_ATTR_RO) ||
-	    test_bit(NVME_NS_FORCE_RO, &ns->flags))
-		set_disk_ro(disk, true);
+	set_disk_ro(disk, (id->nsattr & NVME_NS_ATTR_RO) ||
+		test_bit(NVME_NS_FORCE_RO, &ns->flags));
 }
 
 static inline bool nvme_first_scan(struct gendisk *disk)
-- 
2.29.2


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

* [PATCH 6/6] nvme: allow revalidate to set a namespace read-only
@ 2020-12-08 16:28   ` Christoph Hellwig
  0 siblings, 0 replies; 90+ messages in thread
From: Christoph Hellwig @ 2020-12-08 16:28 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Sagi Grimberg, Mike Snitzer, Oleksii Kurochko, Dongsheng Yang,
	linux-block, dm-devel, linux-nvme, Martin K . Petersen,
	Keith Busch, Ilya Dryomov, ceph-devel

Unconditionally call set_disk_ro now that it only updates the hardware
state.  This allows to properly set up the Linux devices read-only when
the controller turns a previously writable namespace read-only.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Keith Busch <kbusch@kernel.org>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
---
 drivers/nvme/host/core.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index ce1b6151944131..3a0557ccc9fc5d 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -2114,9 +2114,8 @@ static void nvme_update_disk_info(struct gendisk *disk,
 	nvme_config_discard(disk, ns);
 	nvme_config_write_zeroes(disk, ns);
 
-	if ((id->nsattr & NVME_NS_ATTR_RO) ||
-	    test_bit(NVME_NS_FORCE_RO, &ns->flags))
-		set_disk_ro(disk, true);
+	set_disk_ro(disk, (id->nsattr & NVME_NS_ATTR_RO) ||
+		test_bit(NVME_NS_FORCE_RO, &ns->flags));
 }
 
 static inline bool nvme_first_scan(struct gendisk *disk)
-- 
2.29.2


_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

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

end of thread, other threads:[~2021-01-10 15:02 UTC | newest]

Thread overview: 90+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-07 13:19 split hard read-only vs read-only policy v2 Christoph Hellwig
2020-12-07 13:19 ` [dm-devel] " Christoph Hellwig
2020-12-07 13:19 ` Christoph Hellwig
2020-12-07 13:19 ` [PATCH 1/6] dm: use bdev_read_only to check if a device is read-only Christoph Hellwig
2020-12-07 13:19   ` [dm-devel] " Christoph Hellwig
2020-12-07 13:19   ` Christoph Hellwig
2020-12-08  5:23   ` Martin K. Petersen
2020-12-08  5:23     ` [dm-devel] " Martin K. Petersen
2020-12-08  5:23     ` Martin K. Petersen
2020-12-08  9:59   ` Ming Lei
2020-12-08  9:59     ` [dm-devel] " Ming Lei
2020-12-08  9:59     ` Ming Lei
2020-12-07 13:19 ` [PATCH 2/6] block: remove the NULL bdev check in bdev_read_only Christoph Hellwig
2020-12-07 13:19   ` [dm-devel] " Christoph Hellwig
2020-12-07 13:19   ` Christoph Hellwig
2020-12-08  5:23   ` Martin K. Petersen
2020-12-08  5:23     ` [dm-devel] " Martin K. Petersen
2020-12-08  5:23     ` Martin K. Petersen
2020-12-08 10:06   ` Ming Lei
2020-12-08 10:06     ` [dm-devel] " Ming Lei
2020-12-08 10:06     ` Ming Lei
2020-12-07 13:19 ` [PATCH 3/6] block: add a hard-readonly flag to struct gendisk Christoph Hellwig
2020-12-07 13:19   ` [dm-devel] " Christoph Hellwig
2020-12-07 13:19   ` Christoph Hellwig
2020-12-08  5:24   ` Martin K. Petersen
2020-12-08  5:24     ` [dm-devel] " Martin K. Petersen
2020-12-08  5:24     ` Martin K. Petersen
2020-12-08  5:28   ` Martin K. Petersen
2020-12-08  5:28     ` [dm-devel] " Martin K. Petersen
2020-12-08  5:28     ` Martin K. Petersen
2020-12-08 10:22   ` Ming Lei
2020-12-08 10:22     ` [dm-devel] " Ming Lei
2020-12-08 10:22     ` Ming Lei
2020-12-08 10:57     ` Christoph Hellwig
2020-12-08 10:57       ` [dm-devel] " Christoph Hellwig
2020-12-08 10:57       ` Christoph Hellwig
2020-12-07 13:19 ` [PATCH 4/6] block: propagate BLKROSET on the whole device to all partitions Christoph Hellwig
2020-12-07 13:19   ` [dm-devel] " Christoph Hellwig
2020-12-07 13:19   ` Christoph Hellwig
2020-12-08  5:27   ` Martin K. Petersen
2020-12-08  5:27     ` [dm-devel] " Martin K. Petersen
2020-12-08  5:27     ` Martin K. Petersen
2020-12-08  9:25     ` Christoph Hellwig
2020-12-08  9:25       ` [dm-devel] " Christoph Hellwig
2020-12-08  9:25       ` Christoph Hellwig
2020-12-08 12:41       ` Johannes Thumshirn
2020-12-08 12:41         ` [dm-devel] " Johannes Thumshirn
2020-12-08 12:41         ` Johannes Thumshirn
2020-12-08 10:29   ` Ming Lei
2020-12-08 10:29     ` [dm-devel] " Ming Lei
2020-12-08 10:29     ` Ming Lei
2020-12-08 10:59     ` Christoph Hellwig
2020-12-08 10:59       ` [dm-devel] " Christoph Hellwig
2020-12-08 10:59       ` Christoph Hellwig
2020-12-09  1:23       ` Ming Lei
2020-12-09  1:23         ` [dm-devel] " Ming Lei
2020-12-09  1:23         ` Ming Lei
2020-12-07 13:19 ` [PATCH 5/6] rbd: remove the ->set_read_only method Christoph Hellwig
2020-12-07 13:19   ` [dm-devel] " Christoph Hellwig
2020-12-07 13:19   ` Christoph Hellwig
2020-12-07 14:57   ` Ilya Dryomov
2020-12-07 14:57     ` [dm-devel] " Ilya Dryomov
2020-12-07 14:57     ` Ilya Dryomov
2020-12-08  5:30   ` Martin K. Petersen
2020-12-08  5:30     ` [dm-devel] " Martin K. Petersen
2020-12-08  5:30     ` Martin K. Petersen
2020-12-07 13:19 ` [PATCH 6/6] nvme: allow revalidate to set a namespace read-only Christoph Hellwig
2020-12-07 13:19   ` [dm-devel] " Christoph Hellwig
2020-12-07 13:19   ` Christoph Hellwig
2020-12-07 18:13   ` Keith Busch
2020-12-07 18:13     ` [dm-devel] " Keith Busch
2020-12-07 18:13     ` Keith Busch
2020-12-08  5:29   ` Martin K. Petersen
2020-12-08  5:29     ` [dm-devel] " Martin K. Petersen
2020-12-08  5:29     ` Martin K. Petersen
2020-12-10  7:50 ` split hard read-only vs read-only policy v2 Christoph Hellwig
2020-12-10  7:50   ` [dm-devel] " Christoph Hellwig
2020-12-10  7:50   ` Christoph Hellwig
2020-12-08 16:28 split hard read-only vs read-only policy v3 Christoph Hellwig
2020-12-08 16:28 ` [PATCH 6/6] nvme: allow revalidate to set a namespace read-only Christoph Hellwig
2020-12-08 16:28   ` Christoph Hellwig
2020-12-08 16:49   ` Hannes Reinecke
2020-12-08 16:49     ` Hannes Reinecke
2020-12-09  2:54   ` Ming Lei
2020-12-09  2:54     ` Ming Lei
2021-01-09 10:42 split hard read-only vs read-only policy v3 (resend) Christoph Hellwig
2021-01-09 10:42 ` [PATCH 6/6] nvme: allow revalidate to set a namespace read-only Christoph Hellwig
2021-01-09 10:42   ` Christoph Hellwig
2021-01-09 20:27   ` Chaitanya Kulkarni
2021-01-09 20:27     ` Chaitanya Kulkarni
2021-01-10 15:01   ` Hannes Reinecke
2021-01-10 15:01     ` Hannes Reinecke

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.