From 36243c75bd55c9e4d24f4e592fe03c92b56baedd Mon Sep 17 00:00:00 2001 From: Lai Siyao Date: Wed, 12 Jun 2019 18:33:12 +0800 Subject: [PATCH] LU-11213 lod: default LMV can't be deleted When 'space' hash type was introduced, default LMV deletion added check for hash type, but it only checks whether type is 'none', while by default it's 'fnv_1a_64', which caused default LMV can't be deleted. Change check to !LMV_HASH_TYPE_SPACE and update test 413b. Fixes: a24f6153292 ("LU-11213 dne: add new dir hash type 'space'") Signed-off-by: Lai Siyao Change-Id: I88c630dc8d339ddeb9dc03d6f8987d8783062a13 Reviewed-on: https://review.whamcloud.com/35207 Tested-by: Jenkins Reviewed-by: Andreas Dilger Tested-by: Maloo Reviewed-by: Li Xi Reviewed-by: Oleg Drokin --- lustre/lod/lod_object.c | 8 +++++--- lustre/tests/sanity.sh | 6 ++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/lustre/lod/lod_object.c b/lustre/lod/lod_object.c index cfa8d03..50b40b8 100644 --- a/lustre/lod/lod_object.c +++ b/lustre/lod/lod_object.c @@ -3680,14 +3680,16 @@ static int lod_xattr_set_default_lmv_on_dir(const struct lu_env *env, LASSERT(buf != NULL && buf->lb_buf != NULL); lum = buf->lb_buf; - CDEBUG(D_OTHER, "set default stripe_count # %u stripe_offset %d\n", + CDEBUG(D_INFO, + "set default stripe_count # %u stripe_offset %d hash %u\n", le32_to_cpu(lum->lum_stripe_count), - (int)le32_to_cpu(lum->lum_stripe_offset)); + (int)le32_to_cpu(lum->lum_stripe_offset), + le32_to_cpu(lum->lum_hash_type)); if (LMVEA_DELETE_VALUES((le32_to_cpu(lum->lum_stripe_count)), le32_to_cpu(lum->lum_stripe_offset)) && le32_to_cpu(lum->lum_magic) == LMV_USER_MAGIC && - le32_to_cpu(lum->lum_hash_type) == LMV_HASH_TYPE_UNKNOWN) { + le32_to_cpu(lum->lum_hash_type) != LMV_HASH_TYPE_SPACE) { rc = lod_xattr_del_internal(env, dt, name, th); if (rc == -ENODATA) rc = 0; diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index 12cc892..c21a447 100644 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -20094,6 +20094,12 @@ test_413b() { done [ $((max - min)) -gt $MDSCOUNT ] || error "subdirs shouldn't be evenly distributed" + + which getfattr > /dev/null 2>&1 || skip_env "no getfattr command" + + $LFS setdirstripe -D -d $DIR/$tdir || error "setdirstripe -d failed" + getfattr -n trusted.dmv $DIR/$tdir && error "default dir layout exists" + true } run_test 413b "mkdir with balanced space usage" -- 1.8.3.1