From db9965ce33365c2645827b06af21f8f5918ea2bb Mon Sep 17 00:00:00 2001 From: Wang Shilong Date: Thu, 10 Jan 2019 23:32:14 +0800 Subject: [PATCH] LU-11849 utils: fix to make exclude projid works We intended to use projid not uid here, fix it. Also add ! --projid options test to cover this. Test-Parameters: trivial testlist=sanity-quota Change-Id: I64c3f1c68885947d0e91626525ee037756e1d7d8 Signed-off-by: Wang Shilong Reviewed-on: https://review.whamcloud.com/34005 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: Li Xi Reviewed-by: Gu Zheng --- lustre/tests/sanity-quota.sh | 20 ++++++++++++++++---- lustre/utils/liblustreapi.c | 2 +- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/lustre/tests/sanity-quota.sh b/lustre/tests/sanity-quota.sh index 392f21a..2325370 100755 --- a/lustre/tests/sanity-quota.sh +++ b/lustre/tests/sanity-quota.sh @@ -2883,13 +2883,25 @@ test_50() { skip "Project quota is not supported" setup_quota_test || error "setup quota failed with $?" - local dir="$DIR/$tdir/dir" + local dir1="$DIR/$tdir/dir1" + local dir2="$DIR/$tdir/dir2" + + mkdir -p $dir1 && change_project -sp 1 $dir1 + mkdir -p $dir2 && change_project -sp 2 $dir2 + for num in $(seq 1 10); do + touch $dir1/file_$num $dir2/file_$num + ln -s $dir1/file_$num $dir1/file_$num"_link" + ln -s $dir2/file_$num $dir2/file_$num"_link" + done - mkdir $dir && change_project -p 1 $dir count=$($LFS find --projid 1 $DIR | wc -l) - [ "$count" != 1 ] && error "expected 1 but got $count" + [ "$count" != 21 ] && error "expected 21 but got $count" - rm -rf $dir + # 1(projid 0 dir) + 1(projid 2 dir) + 20(projid 2 files) + count=$($LFS find ! --projid 1 $DIR/$tdir | wc -l) + [ "$count" != 22 ] && error "expected 22 but got $count" + + rm -rf $dir1 $dir2 cleanup_quota_test } run_test 50 "Test if lfs find --projid works" diff --git a/lustre/utils/liblustreapi.c b/lustre/utils/liblustreapi.c index 75ae65c..67eb90b 100644 --- a/lustre/utils/liblustreapi.c +++ b/lustre/utils/liblustreapi.c @@ -4297,7 +4297,7 @@ obd_matches: if (ret) goto out; if (projid == param->fp_projid) { - if (param->fp_exclude_uid) + if (param->fp_exclude_projid) goto decided; } else { if (!param->fp_exclude_projid) -- 1.8.3.1