Whamcloud - gitweb
LU-9342 pfl: handle uninited component in user defined LOVEA 19/26619/8
authorBobi Jam <bobijam.xu@intel.com>
Fri, 14 Apr 2017 08:06:34 +0000 (16:06 +0800)
committerOleg Drokin <oleg.drokin@intel.com>
Fri, 28 Apr 2017 20:36:30 +0000 (20:36 +0000)
It is possible that user defined LOVEA contains uninstantiated flag
like replay of create or layout extend or lfs swap, the partial LOVEA
will passed into
lod_declare_xattr_set()->lod_declare_striped_object()->
lod_prepare_create()->lod_qos_parse_config()->
lod_use_defined_striping(),
so that lod_use_defined_striping() also need to take care of
uninstantiated component entry.

Signed-off-by: Bobi Jam <bobijam.xu@intel.com>
Change-Id: I45d46b118bcde66f4604b80e2da51a808f381219
Reviewed-on: https://review.whamcloud.com/26619
Reviewed-by: Niu Yawei <yawei.niu@intel.com>
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
lustre/lod/lod_qos.c
lustre/tests/sanity.sh

index 89850ab..080b8b2 100644 (file)
@@ -1788,9 +1788,16 @@ int lod_use_defined_striping(const struct lu_env *env,
                lod_comp->llc_stripe_size = le32_to_cpu(v1->lmm_stripe_size);
                lod_comp->llc_stripenr = le16_to_cpu(v1->lmm_stripe_count);
                lod_comp->llc_layout_gen = le16_to_cpu(v1->lmm_layout_gen);
+               /**
+                * The stripe_offset of an uninit-ed component is stored in
+                * the lmm_layout_gen
+                */
+               if (mo->ldo_is_composite && !lod_comp_inited(lod_comp))
+                       lod_comp->llc_stripe_offset = lod_comp->llc_layout_gen;
                lod_obj_set_pool(mo, i, pool_name);
 
-               if (!(lod_comp->llc_pattern & LOV_PATTERN_F_RELEASED)) {
+               if ((!mo->ldo_is_composite || lod_comp_inited(lod_comp)) &&
+                   !(lod_comp->llc_pattern & LOV_PATTERN_F_RELEASED)) {
                        rc = lod_initialize_objects(env, mo, objs, i);
                        if (rc)
                                GOTO(out, rc);
index f432e35..87fe6a8 100755 (executable)
@@ -11867,14 +11867,16 @@ test_184d() {
                error "create $file2 failed"
        $OPENFILE -f O_CREAT:O_LOV_DELAY_CREATE $file3 ||
                error "create $file3 failed"
-       lovea1=$($LFS getstripe $file1 | sed 1d)
+       lovea1=$(get_layout_param $file1)
 
        $LFS swap_layouts $file2 $file3 ||
                error "swap $file2 $file3 layouts failed"
        $LFS swap_layouts $file1 $file2 ||
                error "swap $file1 $file2 layouts failed"
 
-       lovea2=$($LFS getstripe $file2 | sed 1d)
+       lovea2=$(get_layout_param $file2)
+       echo "$lovea1"
+       echo "$lovea2"
        [ "$lovea1" == "$lovea2" ] || error "lovea $lovea1 != $lovea2"
 
        lovea1=$(getfattr -n trusted.lov $file1 | grep ^trusted)