Whamcloud - gitweb
LU-13170 osd: positive lookup shouldn't return an error
[fs/lustre-release.git] / lustre / osd-zfs / osd_index.c
index 226e304..765099a 100644 (file)
@@ -564,7 +564,7 @@ osd_consistency_check(const struct lu_env *env, struct osd_device *osd,
                        RETURN(rc);
        }
 
-       if (thread_is_running(&scrub->os_thread)) {
+       if (scrub->os_running) {
                if (scrub->os_pos_current > oid)
                        RETURN(0);
        } else if (osd->od_auto_scrub_interval == AS_NEVER) {
@@ -596,7 +596,7 @@ again:
        insert = false;
 
 trigger:
-       if (thread_is_running(&scrub->os_thread)) {
+       if (scrub->os_running) {
                if (!dn) {
                        rc = __osd_obj2dnode(osd->od_os, oid, &dn);
                        /* The object has been removed (by race maybe). */
@@ -682,11 +682,17 @@ static int osd_dir_lookup(const struct lu_env *env, struct dt_object *dt,
 
 out:
        if (!rc && !osd_remote_fid(env, osd, fid)) {
-               rc = osd_consistency_check(env, osd, obj, fid, oid,
+               /*
+                * this should ask the scrubber to check OI given
+                * the mapping we just found in the dir entry.
+                * but result of that check should not affect
+                * result of the lookup in the directory.
+                * otherwise such a direntry becomes hidden
+                * from the layers above, including LFSCK which
+                * is supposed to fix dangling entries.
+                */
+               osd_consistency_check(env, osd, obj, fid, oid,
                                S_ISDIR(DTTOIF(oti->oti_zde.lzd_reg.zde_type)));
-               /* Only -ENOENT error will affect the lookup result. */
-               if (rc != -ENOENT)
-                       rc = 0;
        }
 
        return rc == 0 ? 1 : (rc == -ENOENT ? -ENODATA : rc);
@@ -901,7 +907,7 @@ static int osd_declare_dir_insert(const struct lu_env *env,
        LASSERT(rec1->rec_type != 0);
 
        LASSERT(th != NULL);
-       oh = container_of0(th, struct osd_thandle, ot_super);
+       oh = container_of(th, struct osd_thandle, ot_super);
 
        idc = osd_idc_find_or_init(env, osd, fid);
        if (IS_ERR(idc))
@@ -1015,7 +1021,7 @@ static int osd_dir_insert(const struct lu_env *env, struct dt_object *dt,
        LASSERT(osd_invariant(parent));
 
        LASSERT(th != NULL);
-       oh = container_of0(th, struct osd_thandle, ot_super);
+       oh = container_of(th, struct osd_thandle, ot_super);
 
        idc = osd_idc_find(env, osd, fid);
        if (unlikely(idc == NULL)) {
@@ -1122,7 +1128,7 @@ static int osd_declare_dir_delete(const struct lu_env *env,
        LASSERT(zap_dn != NULL);
 
        LASSERT(th != NULL);
-       oh = container_of0(th, struct osd_thandle, ot_super);
+       oh = container_of(th, struct osd_thandle, ot_super);
 
        /*
         * In Orion . and .. were stored in the directory (not generated upon
@@ -1161,7 +1167,7 @@ static int osd_dir_delete(const struct lu_env *env, struct dt_object *dt,
        LASSERT(zap_dn);
 
        LASSERT(th != NULL);
-       oh = container_of0(th, struct osd_thandle, ot_super);
+       oh = container_of(th, struct osd_thandle, ot_super);
 
        /*
         * In Orion . and .. were stored in the directory (not generated upon
@@ -1769,7 +1775,7 @@ static int osd_declare_index_insert(const struct lu_env *env,
        ENTRY;
 
        LASSERT(th != NULL);
-       oh = container_of0(th, struct osd_thandle, ot_super);
+       oh = container_of(th, struct osd_thandle, ot_super);
 
        LASSERT(obj->oo_dn);
 
@@ -1798,7 +1804,7 @@ static int osd_index_insert(const struct lu_env *env, struct dt_object *dt,
        LASSERT(osd_invariant(obj));
        LASSERT(th != NULL);
 
-       oh = container_of0(th, struct osd_thandle, ot_super);
+       oh = container_of(th, struct osd_thandle, ot_super);
 
        rc = osd_prepare_key_uint64(obj, k, key);
 
@@ -1823,7 +1829,7 @@ static int osd_declare_index_delete(const struct lu_env *env,
        LASSERT(th != NULL);
        LASSERT(obj->oo_dn);
 
-       oh = container_of0(th, struct osd_thandle, ot_super);
+       oh = container_of(th, struct osd_thandle, ot_super);
 
        /* do not specify the key as then DMU is trying to look it up
         * which is very expensive. usually the layers above lookup
@@ -1846,7 +1852,7 @@ static int osd_index_delete(const struct lu_env *env, struct dt_object *dt,
 
        LASSERT(obj->oo_dn);
        LASSERT(th != NULL);
-       oh = container_of0(th, struct osd_thandle, ot_super);
+       oh = container_of(th, struct osd_thandle, ot_super);
 
        rc = osd_prepare_key_uint64(obj, k, key);