提交 bf94fee5 编写于 作者: S Sagi Grimberg 提交者: Yang Yingliang

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

mainline inclusion
from mainline-5.10
commit 65c5a055
category: bugfix
bugzilla: NA
CVE: NA

-------------------------------------------------

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: 1293477f ("nvme: set gendisk read only based on nsattr")
Signed-off-by: NSagi Grimberg <sagi@grimberg.me>
Signed-off-by: NChristoph Hellwig <hch@lst.de>
Signed-off-by: NWenchao Hao <haowenchao@huawei.com>
Reviewed-by: NMiaohe Lin <linmiaohe@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 802c82f9
...@@ -1682,8 +1682,6 @@ static void nvme_update_disk_info(struct gendisk *disk, ...@@ -1682,8 +1682,6 @@ static void nvme_update_disk_info(struct gendisk *disk,
if (id->nsattr & (1 << 0)) if (id->nsattr & (1 << 0))
set_disk_ro(disk, true); set_disk_ro(disk, true);
else
set_disk_ro(disk, false);
blk_mq_unfreeze_queue(disk->queue); blk_mq_unfreeze_queue(disk->queue);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册