In lu_context_refill, the key_set_version should be protected
before comparing it to version stored in the lu_context.
This patch is a supplement of the previous patch
https://review.whamcloud.com/#/c/28405/, which adds protection
for key_set_version from modification in lu_context_refill
and lu_context_key_degister.
Lustre-change: https://review.whamcloud.com/27448
Lustre-commit:
4538de675cc1ee05408fa912e71c65d9109d7027
Change-Id: I201f56214382a717cfc31ba573e06fec9fbedae4
Signed-off-by: Hongchao Zhang <hongchao.zhang@intel.com>
Reviewed-by: Patrick Farrell <paf@cray.com>
Reviewed-by: Fan Yong <fan.yong@intel.com>
Signed-off-by: Minh Diep <minh.diep@intel.com>
Reviewed-on: https://review.whamcloud.com/31017
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: John L. Hammond <john.hammond@intel.com>
lu_context_key_quiesce(key);
- ++key_set_version;
write_lock(&lu_keys_guard);
+ ++key_set_version;
key_fini(&lu_shrink_env.le_ctx, key->lct_index);
/**
*/
int lu_context_refill(struct lu_context *ctx)
{
- return likely(ctx->lc_version == key_set_version) ? 0 : keys_fill(ctx);
+ read_lock(&lu_keys_guard);
+ if (likely(ctx->lc_version == key_set_version)) {
+ read_unlock(&lu_keys_guard);
+ return 0;
+ }
+
+ read_unlock(&lu_keys_guard);
+ return keys_fill(ctx);
}
/**