Re: [PATCH 1/3] nvme: provide a way to disable nvme mpath per subsystem

From: Sagi Grimberg
Date: Thu May 31 2018 - 04:18:03 EST



@@ -246,3 +246,27 @@ void nvme_mpath_remove_disk(struct nvme_ns_head *head)
blk_cleanup_queue(head->disk->queue);
put_disk(head->disk);
}
+
+int nvme_mpath_change_personality(struct nvme_subsystem *subsys)
+{
+ struct nvme_ctrl *ctrl;
+ int ret = 0;
+
+restart:
+ mutex_lock(&subsys->lock);
+ list_for_each_entry(ctrl, &subsys->ctrls, subsys_entry) {
+ if (!list_empty(&ctrl->namespaces)) {
+ mutex_unlock(&subsys->lock);
+ nvme_remove_namespaces(ctrl);

This looks completely broken. Any of these namespaces can have an
active handle on it.