]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
nvme: Avoid flush dependency in delete controller flow
authorNitzan Carmi <nitzanc@mellanox.com>
Mon, 9 Apr 2018 14:50:26 +0000 (17:50 +0300)
committerPaul E. McKenney <paulmck@linux.vnet.ibm.com>
Tue, 15 May 2018 17:28:03 +0000 (10:28 -0700)
The nvme_delete_ctrl() function queues a work item on a MEM_RECLAIM
queue (nvme_delete_wq), which eventually calls cleanup_srcu_struct(),
which in turn flushes a delayed work from an !MEM_RECLAIM queue. This
is unsafe as we might trigger deadlocks under severe memory pressure.

Since we don't ever invoke call_srcu(), it is safe to use the shiny new
_quiesced() version of srcu cleanup, thus avoiding that flush dependency.
This commit makes that change.

Signed-off-by: Nitzan Carmi <nitzanc@mellanox.com>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Reviewed-by: Max Gurtovoy <maxg@mellanox.com>
Tested-by: Nicholas Piggin <npiggin@gmail.com>
drivers/nvme/host/core.c

index 9df4f71e58caa0f93e8a6175cb48ec8d78f164e0..c3cea8a2984350dbd5c6b159b172fda35f683f13 100644 (file)
@@ -349,7 +349,7 @@ static void nvme_free_ns_head(struct kref *ref)
        nvme_mpath_remove_disk(head);
        ida_simple_remove(&head->subsys->ns_ida, head->instance);
        list_del_init(&head->entry);
-       cleanup_srcu_struct(&head->srcu);
+       cleanup_srcu_struct_quiesced(&head->srcu);
        kfree(head);
 }