LU-11089 obd: use wait_event_var() in lu_context_key_degister()
lu_context_key_degister() has an open coded loop which calls
schedule() without setting a new task state. This is generally
a bad idea - it could easily just spin.
Instead, use wait_event_var() to wait for ->lct_used to be zero,
and arrange to get a wakeup when that happens.
Previously ->lct_used would only fall down to 1. Now we decrement
it an extra time so that wake_up, which only happens when the
count reaches zero, will only happen when lu_context_key_degister()
is actually waiting for it.
Note that this patch removes key_fini() from protection by
lu_keys_guard. key_fini() calls are not always protected
by a lock, and there seems to be no need here. Nothing else
can be acting on the given key in that context at this point,
so no race is possible.
Linux-commit:
ef84c07364211bb4e398a9de45d1c13a32059cee
Change-Id: I9514bd21916f75fce00e393612967fb197e3a1c4
Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: James Simmons <uja.ornl@yahoo.com>
Reviewed-on: https://review.whamcloud.com/33667
Tested-by: Jenkins
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Petros Koutoupis <pkoutoupis@cray.com>
Reviewed-by: Gu Zheng <gzheng@ddn.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>