Whamcloud - gitweb
LU-5916 lod: inherit default pool setting properly
[fs/lustre-release.git] / lustre / lod / lod_object.c
index 3bbf3b1..176ea7d 100644 (file)
@@ -515,6 +515,7 @@ static int lod_xattr_set_lov_on_dir(const struct lu_env *env,
        struct lod_object       *l = lod_dt_obj(dt);
        struct lov_user_md_v1   *lum;
        struct lov_user_md_v3   *v3 = NULL;
+       const char              *pool_name = NULL;
        int                      rc;
        ENTRY;
 
@@ -532,8 +533,11 @@ static int lod_xattr_set_lov_on_dir(const struct lu_env *env,
        if (rc)
                RETURN(rc);
 
-       if (lum->lmm_magic == LOV_USER_MAGIC_V3)
+       if (lum->lmm_magic == LOV_USER_MAGIC_V3) {
                v3 = buf->lb_buf;
+               if (v3->lmm_pool_name[0] != '\0')
+                       pool_name = v3->lmm_pool_name;
+       }
 
        /* if { size, offset, count } = { 0, -1, 0 } and no pool
         * (i.e. all default values specified) then delete default
@@ -545,10 +549,8 @@ static int lod_xattr_set_lov_on_dir(const struct lu_env *env,
                (int)lum->lmm_stripe_offset,
                v3 ? "from" : "", v3 ? v3->lmm_pool_name : "");
 
-       if (LOVEA_DELETE_VALUES((lum->lmm_stripe_size),
-                               (lum->lmm_stripe_count),
-                               (lum->lmm_stripe_offset)) &&
-                       lum->lmm_magic == LOV_USER_MAGIC_V1) {
+       if (LOVEA_DELETE_VALUES(lum->lmm_stripe_size, lum->lmm_stripe_count,
+                               lum->lmm_stripe_offset, pool_name)) {
                rc = dt_xattr_del(env, next, name, th, capa);
                if (rc == -ENODATA)
                        rc = 0;
@@ -966,7 +968,8 @@ static int lod_declare_object_create(const struct lu_env *env,
 
                if (LOVEA_DELETE_VALUES(lo->ldo_def_stripe_size,
                                        lo->ldo_def_stripenr,
-                                       lo->ldo_def_stripe_offset))
+                                       lo->ldo_def_stripe_offset,
+                                       lo->ldo_pool))
                        RETURN(0);
 
                OBD_ALLOC_PTR(v3);