From da18ad5628556cb8eb0bcba786743b2d205a39d9 Mon Sep 17 00:00:00 2001 From: Mikhail Pershin Date: Tue, 19 Jan 2021 17:21:57 +0300 Subject: [PATCH] LU-14312 ldlm: don't change GROUP lock GID on client GROUP lock GID is part of inodebits policy and is passed to the server from client in policy li_gid field. Meanwhile the ldlm_ibits_policy_wire_to_local() is used on client also when server reply or completion AST is processed, so client original GID can be overwritten by server value. This is not problem if both server and client have the same Lustre version but if server is older then it can have garbage in li_gid field and client lock policy is updated with it. Considering that GROUP lock GID is never changed and server should not do that, the solution is to ignore returned li_gid from server and never update original GID of GROUP lock on client from server response. Test-Parameters: testlist=sanity serverversion=2.12.6 env=ONLY=272b Test-Parameters: testlist=sanity serverversion=2.13.0 serverdistro=el7.7 env=ONLY=272b Signed-off-by: Mikhail Pershin Change-Id: I9a82f4b3513fd93d63b92a9527cb7b89c635e61b Reviewed-on: https://review.whamcloud.com/41268 Tested-by: jenkins Reviewed-by: Andreas Dilger Reviewed-by: Oleg Drokin Tested-by: Maloo --- lustre/ldlm/ldlm_inodebits.c | 5 ++--- lustre/ldlm/ldlm_lockd.c | 7 +++++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/lustre/ldlm/ldlm_inodebits.c b/lustre/ldlm/ldlm_inodebits.c index a338c4d..fad8fc6 100644 --- a/lustre/ldlm/ldlm_inodebits.c +++ b/lustre/ldlm/ldlm_inodebits.c @@ -449,10 +449,9 @@ void ldlm_ibits_policy_wire_to_local(const union ldlm_wire_policy_data *wpolicy, union ldlm_policy_data *lpolicy) { lpolicy->l_inodebits.bits = wpolicy->l_inodebits.bits; - lpolicy->l_inodebits.li_gid = wpolicy->l_inodebits.li_gid; /** - * try_bits are to be handled outside of generic write_to_local due - * to different behavior on a server and client. + * try_bits and li_gid are to be handled outside of generic + * write_to_local due to different behavior on a server and client. */ } diff --git a/lustre/ldlm/ldlm_lockd.c b/lustre/ldlm/ldlm_lockd.c index 0315364..cbf9479 100644 --- a/lustre/ldlm/ldlm_lockd.c +++ b/lustre/ldlm/ldlm_lockd.c @@ -1361,11 +1361,14 @@ int ldlm_handle_enqueue0(struct ldlm_namespace *ns, dlm_req->lock_desc.l_resource.lr_type, &dlm_req->lock_desc.l_policy_data, &lock->l_policy_data); - if (dlm_req->lock_desc.l_resource.lr_type == LDLM_EXTENT) + if (dlm_req->lock_desc.l_resource.lr_type == LDLM_EXTENT) { lock->l_req_extent = lock->l_policy_data.l_extent; - else if (dlm_req->lock_desc.l_resource.lr_type == LDLM_IBITS) + } else if (dlm_req->lock_desc.l_resource.lr_type == LDLM_IBITS) { lock->l_policy_data.l_inodebits.try_bits = dlm_req->lock_desc.l_policy_data.l_inodebits.try_bits; + lock->l_policy_data.l_inodebits.li_gid = + dlm_req->lock_desc.l_policy_data.l_inodebits.li_gid; + } existing_lock: cookie = req; -- 1.8.3.1