Whamcloud - gitweb
LU-8300 lfsck: pass LOC_F_NEW when create new object 68/20868/3
authorFan Yong <fan.yong@intel.com>
Fri, 13 May 2016 15:44:35 +0000 (23:44 +0800)
committerOleg Drokin <oleg.drokin@intel.com>
Thu, 22 Sep 2016 03:04:35 +0000 (03:04 +0000)
For lfsck_create_lpf() case, we know that the target object of
'.lustre/lost+found/MDTxxxx' does not exist, need to pass the
lu_object_conf parameter 'LOC_F_NEW' to the lower layer, then
the OSD will not return -115 to the LFSCK if OI files lost.

Signed-off-by: Fan Yong <fan.yong@intel.com>
Change-Id: I0c348dea99e7ff98f432e09a9664c6ba46567f11
Reviewed-on: http://review.whamcloud.com/20868
Tested-by: Jenkins
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Lai Siyao <lai.siyao@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/lfsck/lfsck_internal.h
lustre/lfsck/lfsck_lib.c

index fd3164c..9b82ca0 100644 (file)
@@ -1234,6 +1234,16 @@ static inline u32 lfsck_dev_idx(struct lfsck_instance *lfsck)
 }
 
 static inline struct dt_object *
+lfsck_object_find_by_dev_new(const struct lu_env *env, struct dt_device *dev,
+                            const struct lu_fid *fid)
+{
+       struct lu_object_conf   *conf = &lfsck_env_info(env)->lti_conf;
+
+       conf->loc_flags = LOC_F_NEW;
+       return lu2dt(lu_object_find_slice(env, dt2lu_dev(dev), fid, conf));
+}
+
+static inline struct dt_object *
 lfsck_object_find_by_dev_nowait(const struct lu_env *env, struct dt_device *dev,
                                const struct lu_fid *fid)
 {
@@ -1307,6 +1317,20 @@ lfsck_object_find_bottom_nowait(const struct lu_env *env,
 }
 
 static inline struct dt_object *
+lfsck_object_find_bottom_new(const struct lu_env *env,
+                            struct lfsck_instance *lfsck,
+                            const struct lu_fid *fid)
+{
+       struct dt_device *dev;
+
+       dev = lfsck_find_dev_by_fid(env, lfsck, fid);
+       if (IS_ERR(dev))
+               return (struct dt_object *)dev;
+
+       return lfsck_object_find_by_dev_new(env, dev, fid);
+}
+
+static inline struct dt_object *
 lfsck_object_locate(struct dt_device *dev, struct dt_object *obj)
 {
        if (lfsck_obj2dev(obj) == dev) {
index 0a0c483..634b451 100644 (file)
@@ -1034,7 +1034,7 @@ static int lfsck_create_lpf(const struct lu_env *env,
                *cfid = bk->lb_lpf_fid;
        }
 
-       child = lfsck_object_find_bottom(env, lfsck, cfid);
+       child = lfsck_object_find_bottom_new(env, lfsck, cfid);
        if (IS_ERR(child))
                GOTO(unlock, rc = PTR_ERR(child));