From 6ddb2bfd355cabef1b9c57e480779174292707ae Mon Sep 17 00:00:00 2001 From: Rajeev Mishra Date: Tue, 23 Jul 2024 20:57:03 +0000 Subject: [PATCH] LU-18059 utils: lfs migrate fails for ost striped file The lfs migrate fails for the ost striped file with following error message lfs migrate: can't create composite layout from file /mnt/lustre/d56xh.sanity.src: Numerical result out of range test_56ej has been added to sanity.sh to test this scenario. Signed-off-by: Rajeev Mishra HPE-bug-id: LUS-11815 Test-Parameters: trivial Change-Id: Idc345c3662fde5db3d323019927b4d3a82b04816 Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/55847 Tested-by: Maloo Tested-by: jenkins Reviewed-by: Petros Koutoupis Reviewed-by: Oleg Drokin Reviewed-by: Andreas Dilger --- lustre/tests/sanity.sh | 16 ++++++++++++++++ lustre/utils/liblustreapi_layout.c | 6 +++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index 05af821..b10e7e4 100755 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -9735,6 +9735,22 @@ test_56ei() { } run_test 56ei "test lfs find --printf prints correct projid for special files" +test_56ej() { + test_mkdir $DIR/$tdir.src || + error "mkdir failed on $DIR/$tdir.src" + test_mkdir $DIR/$tdir.dest || + error "mkdir failed on $DIR/$tdir.dest" + local f_mgrt=$DIR/$tdir.dest/$tfile.mgrt + + $LFS setstripe -o 1 $DIR/$tdir.src + $LFS setstripe -o 0 $DIR/$tdir.dest + dd if=/dev/random of=$f_mgrt bs=1M count=1 + + $LFS migrate --non-block --copy $DIR/$tdir.src $f_mgrt || + error "migrate remote dir error $DIR/$tdir.src $f_mgrt" +} +run_test 56ej "lfs migration --non-block copy" + test_57a() { [ $PARALLEL == "yes" ] && skip "skip parallel run" # note test will not do anything if MDS is not local diff --git a/lustre/utils/liblustreapi_layout.c b/lustre/utils/liblustreapi_layout.c index 498ed04..7e3ad0d 100644 --- a/lustre/utils/liblustreapi_layout.c +++ b/lustre/utils/liblustreapi_layout.c @@ -464,6 +464,9 @@ static bool llapi_layout_lum_truncated(struct lov_user_md *lum, size_t lum_size) else if (lum->lmm_magic == LOV_MAGIC_V3 || lum->lmm_magic == __swab32(LOV_MAGIC_V3)) magic = LOV_MAGIC_V3; + else if (lum->lmm_magic == LOV_MAGIC_SPECIFIC || + lum->lmm_magic == __swab32(LOV_MAGIC_SPECIFIC)) + magic = LOV_MAGIC_V3; else if (lum->lmm_magic == LOV_MAGIC_COMP_V1 || lum->lmm_magic == __swab32(LOV_MAGIC_COMP_V1)) magic = LOV_MAGIC_COMP_V1; @@ -588,7 +591,8 @@ struct llapi_layout *llapi_layout_get_by_xattr(void *lov_xattr, layout->llot_gen = comp_v1->lcm_layout_gen; layout->llot_flags = comp_v1->lcm_flags; } else if (lum->lmm_magic == LOV_MAGIC_V1 || - lum->lmm_magic == LOV_MAGIC_V3) { + lum->lmm_magic == LOV_MAGIC_V3 || + lum->lmm_magic == LOV_MAGIC_SPECIFIC) { ent_count = 1; layout->llot_is_composite = false; -- 1.8.3.1