Blob Blame History Raw
From: Jason Gunthorpe <jgg@mellanox.com>
Date: Wed, 25 Jul 2018 21:40:16 -0600
Subject: IB/uverbs: Lower the test for ongoing disassociation
Patch-mainline: v4.19-rc1
Git-commit: cc2e14e68004e6dec70842f990085f67c1f6fec7
References: bsc#1103992 FATE#326009

Commands that are reading/writing to objects can test for an ongoing
disassociation during their initial call to rdma_lookup_get_uobject.  This
directly prevents all of these commands from conflicting with an ongoing
disassociation.

Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
---
 drivers/infiniband/core/rdma_core.c |   11 +++++++++++
 1 file changed, 11 insertions(+)

--- a/drivers/infiniband/core/rdma_core.c
+++ b/drivers/infiniband/core/rdma_core.c
@@ -449,6 +449,17 @@ struct ib_uobject *rdma_lookup_get_uobje
 		goto free;
 	}
 
+	/*
+	 * If we have been disassociated block every command except for
+	 * DESTROY based commands.
+	 */
+	if (mode != UVERBS_LOOKUP_DESTROY &&
+	    !srcu_dereference(ufile->device->ib_dev,
+			      &ufile->device->disassociate_srcu)) {
+		ret = -EIO;
+		goto free;
+	}
+
 	ret = uverbs_try_lock_object(uobj, mode);
 	if (ret)
 		goto free;