mirror of https://gitee.com/openkylin/linux.git
nvme: check namespace head shared property
Reject a new shared namespace if a duplicate unshared namespace exists. Signed-off-by: Keith Busch <kbusch@kernel.org> Reviewed-by: Sagi Grimberg <sagi@grimberg.me> Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
parent
9ad1927a3b
commit
0c284db7f2
|
@ -3496,8 +3496,9 @@ static int nvme_init_ns_head(struct nvme_ns *ns, unsigned nsid,
|
||||||
ret = PTR_ERR(head);
|
ret = PTR_ERR(head);
|
||||||
goto out_unlock;
|
goto out_unlock;
|
||||||
}
|
}
|
||||||
|
head->shared = is_shared;
|
||||||
} else {
|
} else {
|
||||||
if (!is_shared) {
|
if (!is_shared || !head->shared) {
|
||||||
dev_err(ctrl->device,
|
dev_err(ctrl->device,
|
||||||
"Duplicate unshared namespace %d\n",
|
"Duplicate unshared namespace %d\n",
|
||||||
nsid);
|
nsid);
|
||||||
|
|
|
@ -352,6 +352,7 @@ struct nvme_ns_head {
|
||||||
struct nvme_ns_ids ids;
|
struct nvme_ns_ids ids;
|
||||||
struct list_head entry;
|
struct list_head entry;
|
||||||
struct kref ref;
|
struct kref ref;
|
||||||
|
bool shared;
|
||||||
int instance;
|
int instance;
|
||||||
#ifdef CONFIG_NVME_MULTIPATH
|
#ifdef CONFIG_NVME_MULTIPATH
|
||||||
struct gendisk *disk;
|
struct gendisk *disk;
|
||||||
|
|
Loading…
Reference in New Issue