Whamcloud - gitweb
LU-8704 osp: update local fldb cache 20/44720/30
authorAlex Zhuravlev <bzzz@whamcloud.com>
Sat, 21 Aug 2021 15:45:53 +0000 (18:45 +0300)
committerOleg Drokin <green@whamcloud.com>
Mon, 1 May 2023 04:07:48 +0000 (04:07 +0000)
update local fldb cache during precreate. this is to avoid
a situation when LOD is generating LOVEA and has to lookup
in FLDB. in turn this may lead to an RPC with a local
transaction running. not good.

Signed-off-by: Alex Zhuravlev <bzzz@whamcloud.com>
Change-Id: Iadf89eddcef88750d234b0139b67e04715e68855
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/44720
Reviewed-by: Sergey Cheremencev <scherementsev@ddn.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
lustre/osp/osp_precreate.c

index 2c04b5e..44129f0 100644 (file)
@@ -447,6 +447,23 @@ out:
        RETURN(rc);
 }
 
+static void osp_update_fldb_cache(const struct lu_env *env,
+                                 struct osp_device *osp,
+                                 struct lu_fid *fid)
+{
+       struct lu_seq_range range = { 0 };
+       struct lu_server_fld *server_fld;
+       struct lu_site *site;
+
+       site = osp->opd_storage->dd_lu_dev.ld_site;
+       server_fld = lu_site2seq(site)->ss_server_fld;
+       if (!server_fld)
+               return;
+
+       fld_range_set_type(&range, LU_SEQ_RANGE_ANY);
+       fld_server_lookup(env, server_fld, fid_seq(fid), &range);
+}
+
 /**
  * Switch to another sequence
  *
@@ -506,6 +523,9 @@ static int osp_precreate_rollover_new_seq(struct lu_env *env,
        osp->opd_pre_last_created_fid = *fid;
        spin_unlock(&osp->opd_pre_lock);
 
+       if (!rc)
+               osp_update_fldb_cache(env, osp, fid);
+
        RETURN(rc);
 }
 
@@ -712,6 +732,10 @@ out_req:
        osp_pre_update_status(d, rc);
 
        ptlrpc_req_finished(req);
+
+       if (!rc)
+               osp_update_fldb_cache(env, d, fid);
+
        RETURN(rc);
 }