From 7a6b48c2f97f165b4449f6283e313cfa33aea5a1 Mon Sep 17 00:00:00 2001 From: Alex Zhuravlev Date: Wed, 7 Oct 2015 11:21:03 +0300 Subject: [PATCH] LU-7186 lod: do not propagate size if stripeless if a file has no stripes, but the size isn't zero, then do not try to propagate this size to stripes. Change-Id: I25401bcc41e3ea84a2b9158120f1e907af47fafa Signed-off-by: Alex Zhuravlev Reviewed-on: http://review.whamcloud.com/16743 Reviewed-by: Frank Zago Tested-by: Jenkins Reviewed-by: John L. Hammond Tested-by: Maloo Reviewed-by: Oleg Drokin --- lustre/lod/lod_object.c | 3 +++ lustre/tests/sanity-hsm.sh | 13 +++++++++++++ 2 files changed, 16 insertions(+) diff --git a/lustre/lod/lod_object.c b/lustre/lod/lod_object.c index 9e3e800..c2313c3 100644 --- a/lustre/lod/lod_object.c +++ b/lustre/lod/lod_object.c @@ -3373,6 +3373,9 @@ static int lod_declare_init_size(const struct lu_env *env, LASSERT(lo->ldo_stripe || lo->ldo_stripenr == 0); LASSERT(lo->ldo_stripe_size > 0); + if (lo->ldo_stripenr == 0) + RETURN(0); + rc = dt_attr_get(env, next, attr); LASSERT(attr->la_valid & LA_SIZE); if (rc) diff --git a/lustre/tests/sanity-hsm.sh b/lustre/tests/sanity-hsm.sh index b8ae8da..0126b78 100755 --- a/lustre/tests/sanity-hsm.sh +++ b/lustre/tests/sanity-hsm.sh @@ -3032,6 +3032,19 @@ test_58() { } run_test 58 "Truncate a released file will trigger restore" +test_59() { + local fid + copytool_setup + $MCREATE $DIR/$tfile || error "mcreate failed" + $TRUNCATE $DIR/$tfile 42 || error "truncate failed" + $LFS hsm_archive $DIR/$tfile || error "archive request failed" + fid=$(path2fid $DIR/$tfile) + wait_request_state $fid ARCHIVE SUCCEED + $LFS hsm_release $DIR/$tfile || error "release failed" + copytool_cleanup +} +run_test 59 "Release stripeless file with non-zero size" + test_60() { # This test validates the fix for LU-4512. Ensure that the -u # option changes the progress reporting interval from the -- 1.8.3.1