Whamcloud - gitweb
LU-13805 osc: Don't include lock for srvlock 67/50067/16
authorPatrick Farrell <pfarrell@whamcloud.com>
Mon, 20 Feb 2023 05:19:40 +0000 (00:19 -0500)
committerOleg Drokin <green@whamcloud.com>
Wed, 28 Jun 2023 21:45:58 +0000 (21:45 +0000)
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 <pfarrell@whamcloud.com>
Change-Id: I6957925bf2d8b7be2340469337906a94a758953d
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/50067
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
lustre/osc/osc_object.c

index ea1d290..026cb2d 100644 (file)
@@ -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);
        }
 }