@@ -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.

Reply via email to