From: Patrick Farrell Date: Mon, 20 Feb 2023 05:19:40 +0000 (-0500) Subject: LU-13805 osc: Don't include lock for srvlock X-Git-Tag: 2.15.57~118 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=refs%2Fchanges%2F67%2F50067%2F16;p=fs%2Flustre-release.git LU-13805 osc: Don't include lock for srvlock When doing server side locking, it doesn't make sense to do the 'search for covering lock and send it to the server' step when building an RPC, because we will not use that lock. This can disguise issues on the client, because prolonging a lock is supposed to let a client avoid eviction if it is still doing IO under the lock, but we are not. This can result in delaying an eviction which should be occurring because the client can't give the lock back. Signed-off-by: Patrick Farrell Change-Id: I6957925bf2d8b7be2340469337906a94a758953d Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/50067 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Oleg Drokin Reviewed-by: Andreas Dilger --- diff --git a/lustre/osc/osc_object.c b/lustre/osc/osc_object.c index ea1d290..026cb2d 100644 --- a/lustre/osc/osc_object.c +++ b/lustre/osc/osc_object.c @@ -345,10 +345,12 @@ static void osc_req_attr_set(const struct lu_env *env, struct cl_object *obj, struct obdo *oa; struct ost_lvb *lvb; u64 flags = attr->cra_flags; + struct osc_page *opg; - oinfo = cl2osc(obj)->oo_oinfo; - lvb = &oinfo->loi_lvb; - oa = attr->cra_oa; + oinfo = cl2osc(obj)->oo_oinfo; + lvb = &oinfo->loi_lvb; + oa = attr->cra_oa; + opg = osc_cl_page_osc(attr->cra_page, cl2osc(obj)); if ((flags & OBD_MD_FLMTIME) != 0) { oa->o_mtime = lvb->lvb_mtime; @@ -382,14 +384,15 @@ static void osc_req_attr_set(const struct lu_env *env, struct cl_object *obj, } oa->o_valid |= OBD_MD_FLID; } - if (flags & OBD_MD_FLHANDLE) { + /* if srvlock is set, don't look for a local lock, since we won't use + * it and shouldn't note it in the RPC + */ + if (flags & OBD_MD_FLHANDLE && !opg->ops_srvlock) { struct ldlm_lock *lock; - struct osc_page *opg; - opg = osc_cl_page_osc(attr->cra_page, cl2osc(obj)); lock = osc_dlmlock_at_pgoff(env, cl2osc(obj), osc_index(opg), OSC_DAP_FL_TEST_LOCK | OSC_DAP_FL_CANCELING); - if (lock == NULL && !opg->ops_srvlock) { + if (lock == NULL) { struct ldlm_resource *res; struct ldlm_res_id *resname; @@ -410,12 +413,9 @@ static void osc_req_attr_set(const struct lu_env *env, struct cl_object *obj, LBUG(); } - /* check for lockless io. */ - if (lock != NULL) { - oa->o_handle = lock->l_remote_handle; - oa->o_valid |= OBD_MD_FLHANDLE; - LDLM_LOCK_PUT(lock); - } + oa->o_handle = lock->l_remote_handle; + oa->o_valid |= OBD_MD_FLHANDLE; + LDLM_LOCK_PUT(lock); } }