Whamcloud - gitweb
LU-11089 obd: remove lock from key register/degister 68/33668/7
authorNeilBrown <neilb@suse.com>
Tue, 21 May 2019 15:07:47 +0000 (11:07 -0400)
committerOleg Drokin <green@whamcloud.com>
Sat, 1 Jun 2019 03:57:53 +0000 (03:57 +0000)
commitf0b78533f07ca6d766f1ea97a623cdd6ff063e0f
treea34b98e52b5a76cfcc4a77e5c9d963ec40fd5680
parent372ef85512dd2a722415fba9a3df66f81029508b
LU-11089 obd: remove lock from key register/degister

lu_context_key_register() doesn't really need locking.
It can use cmpxchg() to atomically install a key, and
check the result to see if it succeeded.
This requires the key to be completely ready before we
try to install it, so lct_used and lct_reference are
set up first, then reverted on failure.

With this done, lu_context_key_degister() no longer
needs locking. It just need to set the slot to NULL.
This is done with suitable memory barriers so that the
slot cannot be reused until we are completely finished
with it.

Note that I added a warning if the slot holds NULL.
The code currently tested that code, but I don't think it
can really happen.

Linux-commit: f4f30a8fc2c9568b87920e89fe4230530c26148f

Change-Id: I8e81c4694e8df2a2805e0b3104a83aa490c536ec
Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: James Simmons <uja.ornl@yahoo.com>
Reviewed-on: https://review.whamcloud.com/33668
Reviewed-by: Gu Zheng <gzheng@ddn.com>
Tested-by: Jenkins
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/obdclass/lu_object.c