From: Sagi Grimberg Date: Mon, 9 Nov 2020 10:57:34 +0000 (-0800) Subject: nvme: fix incorrect behavior when BLKROSET is called by the user X-Git-Tag: v5.10.7~1008^2~11^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=65c5a055b0d567b7e7639d942c0605da9cc54c5e;p=platform%2Fkernel%2Flinux-rpi.git 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") Signed-off-by: Sagi Grimberg Signed-off-by: Christoph Hellwig --- diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index 40ca71b..9b01afc 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -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)