Whamcloud - gitweb
LU-11849 utils: fix to make exclude projid works 05/34005/4
authorWang Shilong <wshilong@ddn.com>
Thu, 10 Jan 2019 15:32:14 +0000 (23:32 +0800)
committerOleg Drokin <green@whamcloud.com>
Sun, 3 Mar 2019 00:21:06 +0000 (00:21 +0000)
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 <wshilong@ddn.com>
Reviewed-on: https://review.whamcloud.com/34005
Tested-by: Jenkins
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Li Xi <lixi@ddn.com>
Reviewed-by: Gu Zheng <gzheng@ddn.com>
lustre/tests/sanity-quota.sh
lustre/utils/liblustreapi.c

index 392f21a..2325370 100755 (executable)
@@ -2883,13 +2883,25 @@ test_50() {
                skip "Project quota is not supported"
 
        setup_quota_test || error "setup quota failed with $?"
                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=$($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"
        cleanup_quota_test
 }
 run_test 50 "Test if lfs find --projid works"
index 75ae65c..67eb90b 100644 (file)
@@ -4297,7 +4297,7 @@ obd_matches:
                if (ret)
                        goto out;
                if (projid == param->fp_projid) {
                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)
                                goto decided;
                } else {
                        if (!param->fp_exclude_projid)