From cbd9992d513ec4d54fae97182747b2e31681a36e Mon Sep 17 00:00:00 2001 From: Bobi Jam Date: Fri, 14 Apr 2017 16:06:34 +0800 Subject: [PATCH] LU-9342 pfl: handle uninited component in user defined LOVEA 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 Change-Id: I45d46b118bcde66f4604b80e2da51a808f381219 Reviewed-on: https://review.whamcloud.com/26619 Reviewed-by: Niu Yawei Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger --- lustre/lod/lod_qos.c | 9 ++++++++- lustre/tests/sanity.sh | 6 ++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/lustre/lod/lod_qos.c b/lustre/lod/lod_qos.c index 89850ab..080b8b2 100644 --- a/lustre/lod/lod_qos.c +++ b/lustre/lod/lod_qos.c @@ -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); diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index f432e35..87fe6a8 100755 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -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) -- 1.8.3.1