From: Wang Shilong Date: Thu, 22 Nov 2018 01:23:36 +0000 (+0800) Subject: LU-11689 lfs: make sure project proceed all dirs X-Git-Tag: 2.12.51~77 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=e022922fb4a2429d0c2488a13ad8127c068aa2b8 LU-11689 lfs: make sure project proceed all dirs Leftover fix since LU-10986 lfs: make lfs project tolerant errors We should proceed other dirs if we hit errors, otherwise, some dirtree like following will fail if aaaa not exists. testdir/ ├── subdir │   └── 1 ├── bbbb -> aaaa └── cccc Also remove extra error output since we have output failing messages inside every action function. Test-Parameters: trivial testlist=sanity-quota,sanity-quota Change-Id: I0062dbc3f4d1925c9e9e1a509ee35ac569bd9b74 Signed-off-by: Wang Shilong Reviewed-on: https://review.whamcloud.com/33707 Reviewed-by: Andreas Dilger Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Gu Zheng Reviewed-by: Oleg Drokin --- diff --git a/lustre/tests/sanity-quota.sh b/lustre/tests/sanity-quota.sh index 95a9113..48cfda6 100755 --- a/lustre/tests/sanity-quota.sh +++ b/lustre/tests/sanity-quota.sh @@ -3071,10 +3071,12 @@ test_57() { " failed to get xattr for '$dir/pipe'" || return 1 #command can process further if it hit some errors touch $dir/aaa $dir/bbb + mkdir $dir/subdir -p + touch $dir/subdir/aaa $dir/subdir/bbb #create one invalid link file ln -s $dir/not_exist_file $dir/ccc local cnt=$(lfs project -r $dir 2>/dev/null | wc -l) - [ $cnt -eq 2 ] || error "expected 2 got $cnt" + [ $cnt -eq 5 ] || error "expected 5 got $cnt" cleanup_quota_test } diff --git a/lustre/utils/lfs_project.c b/lustre/utils/lfs_project.c index a2e9eb2..03de7d5 100644 --- a/lustre/utils/lfs_project.c +++ b/lustre/utils/lfs_project.c @@ -261,10 +261,6 @@ lfs_project_handle_dir(struct list_head *head, const char *pathname, } } - if (ret) - fprintf(stderr, "%s: failed to handle dir '%s': %s\n", - progname, pathname, strerror(errno)); - closedir(dir); return ret; } @@ -304,12 +300,10 @@ static int lfs_project_iterate(const char *pathname, while (!list_empty(&head)) { lpi = list_entry(head.next, struct lfs_project_item, lpi_list); list_del(&lpi->lpi_list); - if (rc == 0) { - rc = lfs_project_handle_dir(&head, lpi->lpi_pathname, - phc, func); - if (!ret && rc) - ret = rc; - } + rc = lfs_project_handle_dir(&head, lpi->lpi_pathname, + phc, func); + if (!ret && rc) + ret = rc; free(lpi); }