Skip to content

Commit

Permalink
nvme: fix incorrect behavior when BLKROSET is called by the user
Browse files Browse the repository at this point in the history
[ Upstream commit 65c5a05 ]

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: 1293477 ("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>
  • Loading branch information
sagigrimberg authored and gregkh committed Nov 18, 2020
1 parent 09d90db commit e360c1e
Showing 1 changed file with 0 additions and 2 deletions.
2 changes: 0 additions & 2 deletions drivers/nvme/host/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit e360c1e

Please sign in to comment.