Whamcloud - gitweb
LU-8821 mdt: avoid double find in mdt_path_current() 01/23701/2
authorJohn L. Hammond <john.hammond@intel.com>
Thu, 12 Nov 2015 15:49:09 +0000 (09:49 -0600)
committerOleg Drokin <oleg.drokin@intel.com>
Tue, 24 Jan 2017 05:22:44 +0000 (05:22 +0000)
In mdt_path_current() avoid finding the object we are already holding
a reference to.

Signed-off-by: John L. Hammond <john.hammond@intel.com>
Change-Id: Iae4796047d2c5b02989d29baf2e7620545f7e45c
Reviewed-on: https://review.whamcloud.com/23701
Tested-by: Jenkins
Reviewed-by: Jinshan Xiong <jinshan.xiong@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/mdt/mdt_handler.c

index db90982..f134fc0 100644 (file)
@@ -5570,9 +5570,14 @@ static int mdt_path_current(struct mdt_thread_info *info,
                    lu_fid_eq(&mdt->mdt_md_root_fid, &fp->gf_fid))
                        GOTO(out, rc = -ENOENT);
 
-               mdt_obj = mdt_object_find(info->mti_env, mdt, tmpfid);
-               if (IS_ERR(mdt_obj))
-                       GOTO(out, rc = PTR_ERR(mdt_obj));
+               if (lu_fid_eq(mdt_object_fid(obj), tmpfid)) {
+                       mdt_obj = obj;
+                       mdt_object_get(info->mti_env, mdt_obj);
+               } else {
+                       mdt_obj = mdt_object_find(info->mti_env, mdt, tmpfid);
+                       if (IS_ERR(mdt_obj))
+                               GOTO(out, rc = PTR_ERR(mdt_obj));
+               }
 
                if (!mdt_object_exists(mdt_obj)) {
                        mdt_object_put(info->mti_env, mdt_obj);