Whamcloud - gitweb
LU-10629 lod: Clear OST pool with setstripe 64/31364/12
authorBen Evans <bevans@cray.com>
Wed, 21 Feb 2018 18:17:58 +0000 (13:17 -0500)
committerOleg Drokin <oleg.drokin@intel.com>
Mon, 9 Apr 2018 19:49:06 +0000 (19:49 +0000)
When setstripe -d is run on a directory, we should
clear the OST pool along with all the other settings
Currently there is no way to clear an OST pool,
only change them.

Signed-off-by: Ben Evans <bevans@cray.com>
Cray-bug-id: LUS-5696
Change-Id: I50426ce79ab153a715d29cc5d54b0ce70726da41
Reviewed-on: https://review.whamcloud.com/31364
Reviewed-by: Jinshan Xiong <jinshan.xiong@gmail.com>
Tested-by: Jenkins
Reviewed-by: Jian Yu <jian.yu@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/lod/lod_object.c
lustre/tests/sanity.sh
lustre/tests/test-framework.sh

index 8735bee..1fac134 100644 (file)
@@ -3778,6 +3778,7 @@ static int lod_xattr_set(const struct lu_env *env,
                struct lod_default_striping *lds = &info->lti_def_striping;
                struct lov_user_md_v1 *v1 = buf->lb_buf;
                char pool[LOV_MAXPOOLNAME + 1];
+               bool is_del;
 
                /* get existing striping config */
                rc = lod_get_default_lov_striping(env, lod_dt_obj(dt), lds);
@@ -3790,8 +3791,14 @@ static int lod_xattr_set(const struct lu_env *env,
                                            lds->lds_def_comp_cnt, pool,
                                            sizeof(pool));
 
+               is_del = LOVEA_DELETE_VALUES(v1->lmm_stripe_size,
+                                            v1->lmm_stripe_count,
+                                            v1->lmm_stripe_offset,
+                                            NULL);
+
                /* Retain the pool name if it is not given */
-               if (v1->lmm_magic == LOV_USER_MAGIC_V1 && pool[0] != '\0') {
+               if (v1->lmm_magic == LOV_USER_MAGIC_V1 && pool[0] != '\0' &&
+                       !is_del) {
                        struct lod_thread_info *info = lod_env_info(env);
                        struct lov_user_md_v3 *v3  = info->lti_ea_store;
 
index 76a8e08..efc4b9d 100755 (executable)
@@ -2252,6 +2252,31 @@ test_27F() { # LU-5346/LU-7975
 }
 run_test 27F "Client resend delayed layout creation with non-zero size"
 
+test_27G() { #LU-10629
+       [ -n "$FILESET" ] && skip "SKIP due to FILESET set" && return
+       remote_mds_nodsh && skip "remote MDS with nodsh" && return
+       local POOL=${POOL:-testpool}
+       local ostrange="0 0 1"
+
+       test_mkdir $DIR/$tdir
+       pool_add $POOL || error "pool_add failed"
+       pool_add_targets $POOL $ostrange || error "pool_add_targets failed"
+       $LFS setstripe -p $POOL $DIR/$tdir
+
+       local pool=$($LFS getstripe -p $DIR/$tdir)
+
+       [ "$pool" = "$POOL" ] || error "Striping failed got '$pool' not '$POOL'"
+
+       $LFS setstripe -d $DIR/$tdir
+
+       pool=$($LFS getstripe -p $DIR/$tdir)
+
+       rmdir $DIR/$tdir
+
+       [ -z "$pool" ] || error "'$pool' is not empty"
+}
+run_test 27G "Clear OST pool from stripe"
+
 # createtest also checks that device nodes are created and
 # then visible correctly (#2091)
 test_28() { # bug 2091
index 1630e79..d82f4bd 100755 (executable)
@@ -7177,7 +7177,7 @@ create_pool() {
        local fsname=${1%%.*}
        local poolname=${1##$fsname.}
 
-       trap "destroy_test_pools $fsname" EXIT
+       stack_trap "destroy_test_pools $fsname" EXIT
        do_facet mgs lctl pool_new $1
        local RC=$?
        # get param should return err unless pool is created