]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
nvme: fix incorrect behavior when BLKROSET is called by the user
authorSagi Grimberg <sagi@grimberg.me>
Mon, 9 Nov 2020 10:57:34 +0000 (02:57 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 18 Nov 2020 18:22:22 +0000 (19:22 +0100)
[ Upstream commit 65c5a055b0d567b7e7639d942c0605da9cc54c5e ]

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 <sagi@grimberg.me>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/nvme/host/core.c

index b130696b0059247c71ebe19580efe50c0e89e495..349fba056cb65fa7cd8fa0a8fd4dbb7fc0813e27 100644 (file)
@@ -2064,8 +2064,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)