Whamcloud - gitweb
LU-11689 lfs: make sure project proceed all dirs 07/33707/2
authorWang Shilong <wshilong@ddn.com>
Thu, 22 Nov 2018 01:23:36 +0000 (09:23 +0800)
committerOleg Drokin <green@whamcloud.com>
Fri, 4 Jan 2019 04:48:04 +0000 (04:48 +0000)
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 <wshilong@ddn.com>
Reviewed-on: https://review.whamcloud.com/33707
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Tested-by: Jenkins
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Gu Zheng <gzheng@ddn.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/tests/sanity-quota.sh
lustre/utils/lfs_project.c

index 95a9113..48cfda6 100755 (executable)
@@ -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
 }
index a2e9eb2..03de7d5 100644 (file)
@@ -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);
        }