Whamcloud - gitweb
LU-12635 build: Support for gcc -Wimplicit-fallthrough
[fs/lustre-release.git] / lustre / lod / lod_object.c
index dd5e8e1..1fa0ffb 100644 (file)
@@ -2040,7 +2040,7 @@ static int lod_prep_md_striped_create(const struct lu_env *env,
                                continue;
 
                        tgt_dt = tgt->ltd_tgt;
-                       rc = dt_statfs(env, tgt_dt, &info->lti_osfs, NULL);
+                       rc = dt_statfs(env, tgt_dt, &info->lti_osfs);
                        if (rc) {
                                /* this OSP doesn't feel well */
                                rc = 0;
@@ -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);
@@ -4303,6 +4303,9 @@ static int lod_layout_del_prep_layout(const struct lu_env *env,
 
        ENTRY;
 
+       LASSERT(lo->ldo_is_composite);
+       LASSERT(lo->ldo_comp_cnt > 0 && lo->ldo_comp_entries != NULL);
+
        rc = lod_layout_data_init(info, lo->ldo_comp_cnt);
        if (rc)
                RETURN(rc);
@@ -4412,9 +4415,7 @@ static int lod_layout_del(const struct lu_env *env, struct dt_object *dt,
        struct lu_attr *attr = &lod_env_info(env)->lti_attr;
        int rc;
 
-       LASSERT(lo->ldo_is_composite);
        LASSERT(lo->ldo_mirror_count == 1);
-       LASSERT(lo->ldo_comp_cnt > 0 && lo->ldo_comp_entries != NULL);
 
        rc = lod_layout_del_prep_layout(env, lo, th);
        if (rc < 0)
@@ -4637,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);
@@ -4683,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);
 
@@ -6009,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)
@@ -6354,7 +6364,7 @@ static bool lod_sel_osts_allowed(const struct lu_env *env,
                        break;
                }
 
-               rc = dt_statfs(env, ost->ltd_ost, sfs, &info);
+               rc = dt_statfs_info(env, ost->ltd_ost, sfs, &info);
                if (rc) {
                        CDEBUG(D_LAYOUT, "statfs failed for ost %d, error %d\n",
                               index, rc);