Skip to contentSkip to conversation

nvme: fix incorrect behavior when BLKROSET is called by the user

PATCH Applied Sagi Grimberg 2 participants 2 messages Nov 9, 2020 NVMe

lore
Share & tools
lore

Sagi Grimberg

author maintainer
#0 lore raw

PATCH v2 1/1 nvme: fix incorrect behavior when BLKROSET is called by the user

The offending commit breaks BLKROSET ioctl because a device revalidation will blindly override BLKROSET setting. Hence, we remove the disk rw setting in case NVME_NS_ATTR_RO is cleared from by the controller.

Fixes 1293477f4f32 ("nvme: set gendisk read only based on nsattr")

---
From v1:
- keep the ro set, remove only ro clear

 drivers/nvme/host/core.c | 2 --
 1 file changed, 2 deletions(-)
drivers/nvme/host/core.c +0 -2
index 40ca71b29bb9..9b01afcb7777 100644
@@ -2060,8 +2060,6 @@ static void nvme_update_disk_info(struct gendisk *disk,
 
 	if (id->nsattr & NVME_NS_ATTR_RO)
 		set_disk_ro(disk, true);
-	else
-		set_disk_ro(disk, false);
 }
 
 static inline bool nvme_first_scan(struct gendisk *disk)
Signature · 7 lines
2.25.1


_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme