aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/core/uverbs_main.c
diff options
context:
space:
mode:
authorJason Gunthorpe <jgg@mellanox.com>2018-07-10 20:55:18 -0600
committerJason Gunthorpe <jgg@mellanox.com>2018-07-25 14:21:22 -0600
commit87064277c4d3b0ddb251a91324f2525048027ee2 (patch)
treeddb90f53572eddb44b6c0ba2bf72aa271841b66e /drivers/infiniband/core/uverbs_main.c
parentIB/uverbs: Clarify and revise uverbs_close_fd (diff)
downloadlinux-dev-87064277c4d3b0ddb251a91324f2525048027ee2.tar.xz
linux-dev-87064277c4d3b0ddb251a91324f2525048027ee2.zip
IB/uverbs: Revise and clarify the rwsem and uobjects_lock
Rename 'cleanup_rwsem' to 'hw_destroy_rwsem' which is held across any call to the type destroy function (aka 'hw' destroy). The main purpose of this lock is to prevent normal add and destroy from running concurrently with uverbs_cleanup_ufile() Since the uobjects list is always manipulated under the 'hw_destroy_rwsem' we can eliminate the uobjects_lock in the cleanup function. This allows converting that lock to a very simple spinlock with a narrow critical section. Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Diffstat (limited to 'drivers/infiniband/core/uverbs_main.c')
-rw-r--r--drivers/infiniband/core/uverbs_main.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/infiniband/core/uverbs_main.c b/drivers/infiniband/core/uverbs_main.c
index 8425718bebbd..77faf32fc997 100644
--- a/drivers/infiniband/core/uverbs_main.c
+++ b/drivers/infiniband/core/uverbs_main.c
@@ -889,9 +889,9 @@ static int ib_uverbs_open(struct inode *inode, struct file *filp)
mutex_init(&file->mutex);
mutex_init(&file->cleanup_mutex);
- mutex_init(&file->uobjects_lock);
+ spin_lock_init(&file->uobjects_lock);
INIT_LIST_HEAD(&file->uobjects);
- init_rwsem(&file->cleanup_rwsem);
+ init_rwsem(&file->hw_destroy_rwsem);
filp->private_data = file;
kobject_get(&dev->kobj);