Commit 369a6fec authored by John L. Hammond's avatar John L. Hammond Committed by Greg Kroah-Hartman

staging: lustre: obdclass: hoist locking in lu_context_exit()

Hoist lu_keys_guard locking out of the for loop in lu_context_exit().
Signed-off-by: default avatarJohn L. Hammond <john.hammond@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-8918
Reviewed-on: https://review.whamcloud.com/24217Reviewed-by: default avatarDmitry Eremin <dmitry.eremin@intel.com>
Reviewed-by: default avatarJinshan Xiong <jinshan.xiong@gmail.com>
Reviewed-by: default avatarOleg Drokin <oleg.drokin@intel.com>
Signed-off-by: default avatarJames Simmons <jsimmons@infradead.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent a5394d48
......@@ -1721,10 +1721,11 @@ void lu_context_exit(struct lu_context *ctx)
LINVRNT(ctx->lc_state == LCS_ENTERED);
ctx->lc_state = LCS_LEFT;
if (ctx->lc_tags & LCT_HAS_EXIT && ctx->lc_value) {
/* could race with key quiescency */
if (ctx->lc_tags & LCT_REMEMBER)
read_lock(&lu_keys_guard);
for (i = 0; i < ARRAY_SIZE(lu_keys); ++i) {
/* could race with key quiescency */
if (ctx->lc_tags & LCT_REMEMBER)
read_lock(&lu_keys_guard);
if (ctx->lc_value[i]) {
struct lu_context_key *key;
......@@ -1733,9 +1734,10 @@ void lu_context_exit(struct lu_context *ctx)
key->lct_exit(ctx,
key, ctx->lc_value[i]);
}
if (ctx->lc_tags & LCT_REMEMBER)
read_unlock(&lu_keys_guard);
}
if (ctx->lc_tags & LCT_REMEMBER)
read_unlock(&lu_keys_guard);
}
}
EXPORT_SYMBOL(lu_context_exit);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment