Whamcloud - gitweb
LU-12635 build: Support for gcc -Wimplicit-fallthrough
[fs/lustre-release.git] / lustre / lod / lod_object.c
index d33a667..1fa0ffb 100644 (file)
@@ -3817,7 +3817,7 @@ static int lod_xattr_set_lmv(const struct lu_env *env, struct dt_object *dt,
                /* if it's source stripe of migrating directory, don't create */
                if (!((lo->ldo_dir_hash_type & LMV_HASH_FLAG_MIGRATION) &&
                      i >= lo->ldo_dir_migrate_offset)) {
-                       dt_write_lock(env, dto, MOR_TGT_CHILD);
+                       dt_write_lock(env, dto, DT_TGT_CHILD);
                        rc = lod_sub_create(env, dto, attr, NULL, dof, th);
                        if (rc != 0) {
                                dt_write_unlock(env, dto);
@@ -4638,7 +4638,13 @@ static int lod_declare_xattr_del(const struct lu_env *env,
        if (!S_ISDIR(dt->do_lu.lo_header->loh_attr))
                RETURN(0);
 
-       /* set xattr to each stripes, if needed */
+       /* NB: don't delete stripe LMV, because when we do this, normally we
+        * will remove stripes, besides, if directory LMV is corrupt, this will
+        * prevent deleting its LMV and fixing it (via LFSCK).
+        */
+       if (!strcmp(name, XATTR_NAME_LMV))
+               RETURN(0);
+
        rc = lod_striping_load(env, lo);
        if (rc != 0)
                RETURN(rc);
@@ -4684,6 +4690,9 @@ static int lod_xattr_del(const struct lu_env *env, struct dt_object *dt,
        if (rc != 0 || !S_ISDIR(dt->do_lu.lo_header->loh_attr))
                RETURN(rc);
 
+       if (!strcmp(name, XATTR_NAME_LMV))
+               RETURN(0);
+
        if (lo->ldo_dir_stripe_count == 0)
                RETURN(0);
 
@@ -6010,7 +6019,7 @@ static int lod_destroy(const struct lu_env *env, struct dt_object *dt,
 
                        if (!OBD_FAIL_CHECK(OBD_FAIL_LFSCK_LOST_SPEOBJ) ||
                            i == cfs_fail_val) {
-                               dt_write_lock(env, stripe, MOR_TGT_CHILD);
+                               dt_write_lock(env, stripe, DT_TGT_CHILD);
                                rc = lod_sub_ref_del(env, stripe, th);
                                dt_write_unlock(env, stripe);
                                if (rc != 0)