}
run_test 55 "Chgrp should be affected by group quota"
-test_56 () {
+test_56() {
setup_quota_test || error "setup quota failed with $?"
set_ost_qtype $QTYPE || error "enable ost quota failed"
}
run_test 56 "lfs quota -t should work well"
+test_57() {
+ setup_quota_test || error "setup quota failed with $?"
+
+ local dir="$DIR/$tdir/dir"
+ mkdir -p $dir
+ mkfifo $dir/pipe
+ #try to change pipe file should not hang and return failure
+ wait_update_facet client "$LFS project -sp 1 $dir/pipe 2>&1 |
+ awk -F ':' '{ print \\\$2 }'" \
+ " failed to get xattr for '$dir/pipe'" || return 1
+ #command can process further if it hit some errors
+ touch $dir/aaa $dir/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"
+
+ cleanup_quota_test
+}
+run_test 57 "lfs project could tolerate errors"
+
test_59() {
if [ $(facet_fstype $SINGLEMDS) != ldiskfs ]; then
skip "ldiskfs only test"
{
int ret, fd;
- fd = open(pathname, O_RDONLY | O_NOCTTY);
+ fd = open(pathname, O_RDONLY | O_NOCTTY | O_NDELAY);
if (fd < 0) {
fprintf(stderr, "%s: failed to open '%s': %s\n",
progname, pathname, strerror(errno));
struct dirent *ent;
DIR *dir;
int ret = 0;
+ int rc;
dir = opendir(pathname);
if (dir == NULL) {
return ret;
}
- while (ret == 0 && (ent = readdir(dir)) != NULL) {
+ while ((ent = readdir(dir)) != NULL) {
/* skip "." and ".." */
if (strcmp(ent->d_name, ".") == 0 ||
strcmp(ent->d_name, "..") == 0)
continue;
- if (strlen(ent->d_name) + strlen(pathname) >=
- sizeof(fullname) + 1) {
+ if (strlen(ent->d_name) + strlen(pathname) + 1 >=
+ sizeof(fullname)) {
ret = -ENAMETOOLONG;
errno = ENAMETOOLONG;
- break;
+ fprintf(stderr, "%s: ignored too long path: %s/%s\n",
+ progname, pathname, ent->d_name);
+ continue;
}
snprintf(fullname, PATH_MAX, "%s/%s", pathname,
ent->d_name);
- ret = func(fullname, phc);
- if (phc->recursive && ret == 0 && ent->d_type == DT_DIR)
- ret = lfs_project_item_alloc(head, fullname);
+ rc = func(fullname, phc);
+ if (rc && !ret)
+ ret = rc;
+ if (phc->recursive && ent->d_type == DT_DIR) {
+ rc = lfs_project_item_alloc(head, fullname);
+ if (rc && !ret)
+ ret = rc;
+ }
}
if (ret)
struct list_head head;
struct stat st;
int ret = 0;
- bool top_dir = true;
+ int rc = 0;
ret = stat(pathname, &st);
if (ret) {
while (!list_empty(&head)) {
lpi = list_entry(head.next, struct lfs_project_item, lpi_list);
list_del(&lpi->lpi_list);
- if (ret == 0) {
- ret = lfs_project_handle_dir(&head, lpi->lpi_pathname,
+ if (rc == 0) {
+ rc = lfs_project_handle_dir(&head, lpi->lpi_pathname,
phc, func);
- /* only ignore ENOENT error if this is
- * not top directory. */
- if (ret == -ENOENT && !top_dir)
- ret = 0;
+ if (!ret && rc)
+ ret = rc;
}
free(lpi);
- top_dir = false;
}
return ret;