From dee41b90e74c0c2021207c0431d6c34642c7019c Mon Sep 17 00:00:00 2001 From: Vitaly Fertman Date: Wed, 7 Aug 2019 16:48:17 +0300 Subject: [PATCH] LU-10070 lod: SEL inheritance fix a sub-dir cannot be created in a dir with a SEL layout template due to problem layout verification Fixes: 94e9699878e ("LU-10070 lod: SEL: interoperability support") Signed-off-by: Vitaly Fertman Cray-bug-id: LUS-2528 Change-Id: I2c439e44d8f183f4057f548ee38e530c578371e4 Reviewed-on: https://review.whamcloud.com/35704 Reviewed-by: Patrick Farrell Tested-by: jenkins Tested-by: Maloo Reviewed-by: Alexey Lyashkov Reviewed-by: Oleg Drokin --- lustre/lod/lod_lov.c | 14 +++++++++++++- lustre/tests/sanity-pfl.sh | 14 ++++++++++++-- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/lustre/lod/lod_lov.c b/lustre/lod/lod_lov.c index bb8e3cf..c044bd1 100644 --- a/lustre/lod/lod_lov.c +++ b/lustre/lod/lod_lov.c @@ -1013,7 +1013,7 @@ int lod_generate_lovea(const struct lu_env *env, struct lod_object *lo, if (lod_comp->llc_flags & LCME_FL_NOSYNC) lcme->lcme_timestamp = cpu_to_le64(lod_comp->llc_timestamp); - if (lod_comp->llc_flags & LCME_FL_EXTENSION) + if (lod_comp->llc_flags & LCME_FL_EXTENSION && !is_dir) lcm->lcm_magic = cpu_to_le32(LOV_MAGIC_SEL); lcme->lcme_extent.e_start = @@ -1345,6 +1345,18 @@ int lod_parse_striping(const struct lu_env *env, struct lod_object *lo, le32_to_cpu(comp_v1->lcm_entries[i].lcme_id); if (lod_comp->llc_id == LCME_ID_INVAL) GOTO(out, rc = -EINVAL); + + if (comp_v1->lcm_entries[i].lcme_flags & + cpu_to_le32(LCME_FL_EXTENSION) && + magic != LOV_MAGIC_SEL) { + struct lod_device *d = + lu2lod_dev(lo->ldo_obj.do_lu.lo_dev); + + CDEBUG(D_WARNING, "%s: not SEL magic on SEL " + "file "DFID": %x\n", + lod2obd(d)->obd_name, + PFID(lod_object_fid(lo)), magic); + } } else { lod_comp_set_init(lod_comp); } diff --git a/lustre/tests/sanity-pfl.sh b/lustre/tests/sanity-pfl.sh index 83ac42b..708b3e2 100644 --- a/lustre/tests/sanity-pfl.sh +++ b/lustre/tests/sanity-pfl.sh @@ -1053,6 +1053,7 @@ test_19b() { skip "skipped for lustre < $SEL_VER" local comp_file=$DIR/$tdir/$tfile + local comp_dir=$DIR/$tdir/$tdir local flg_opts="" local found="" @@ -1060,15 +1061,24 @@ test_19b() { $LFS setstripe --ext-size 64M -c 1 -E -1 $DIR/$tdir || error "Setstripe on $DIR/$tdir failed" + # check inheritance for a sub-dir and a file + test_mkdir $comp_dir + found=$($LFS find --comp-start 0 -E 64M $comp_dir | wc -l) + [ $found -eq 1 ] || error "Dir Inheritance: wrong first component size" + + flg_opts="--comp-flags extension" + found=$($LFS find --comp-start 64M -E EOF $flg_opts $comp_dir | wc -l) + [ $found -eq 1 ] || error "Dir Inheritance: Second component not found" + touch $comp_file flg_opts="--comp-flags init" found=$($LFS find --comp-start 0 -E 64M $flg_opts $comp_file | wc -l) - [ $found -eq 1 ] || error "Inheritance: wrong first component size" + [ $found -eq 1 ] || error "File Inheritance: wrong first component size" flg_opts="--comp-flags extension" found=$($LFS find --comp-start 64M -E EOF $flg_opts $comp_file | wc -l) - [ $found -eq 1 ] || error "Inheritance: Second component not found" + [ $found -eq 1 ] || error "File Inheritance: Second component not found" test19_io_base $comp_file 1 } -- 1.8.3.1