Whamcloud - gitweb
git://git.whamcloud.com
/
fs
/
lustre-release.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
| inline |
side by side
LU-10070 tests: Fix replay-single test_85b
[fs/lustre-release.git]
/
lustre
/
utils
/
lfs_project.c
diff --git
a/lustre/utils/lfs_project.c
b/lustre/utils/lfs_project.c
index
180447a
..
03de7d5
100644
(file)
--- a/
lustre/utils/lfs_project.c
+++ b/
lustre/utils/lfs_project.c
@@
-79,7
+79,7
@@
static int project_get_xattr(const char *pathname, struct fsxattr *fsx)
{
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));
@@
-119,7
+119,7
@@
project_check_one(const char *pathname, struct project_handle_control *phc)
phc->projid = fsx.fsx_projid;
}
- if (!(fsx.fsx_xflags &
LL_PROJINHERIT_FL
)) {
+ if (!(fsx.fsx_xflags &
FS_XFLAG_PROJINHERIT
)) {
if (!phc->newline) {
printf("%s%c", pathname, '\0');
goto out;
@@
-152,7
+152,7
@@
project_list_one(const char *pathname, struct project_handle_control *phc)
return ret;
printf("%5u %c %s\n", fsx.fsx_projid,
- (fsx.fsx_xflags &
LL_PROJINHERIT_FL
) ?
+ (fsx.fsx_xflags &
FS_XFLAG_PROJINHERIT
) ?
'P' : '-', pathname);
close(ret);
@@
-170,11
+170,11
@@
project_set_one(const char *pathname, struct project_handle_control *phc)
return fd;
if ((!phc->set_projid || fsx.fsx_projid == phc->projid) &&
- (!phc->set_inherit || (fsx.fsx_xflags &
LL_PROJINHERIT_FL
)))
+ (!phc->set_inherit || (fsx.fsx_xflags &
FS_XFLAG_PROJINHERIT
)))
goto out;
if (phc->set_inherit)
- fsx.fsx_xflags |=
LL_PROJINHERIT_FL
;
+ fsx.fsx_xflags |=
FS_XFLAG_PROJINHERIT
;
if (phc->set_projid)
fsx.fsx_projid = phc->projid;
@@
-197,11
+197,11
@@
project_clear_one(const char *pathname, struct project_handle_control *phc)
if (fd < 0)
return fd;
- if ((!(fsx.fsx_xflags &
LL_PROJINHERIT_FL
)) &&
+ if ((!(fsx.fsx_xflags &
FS_XFLAG_PROJINHERIT
)) &&
(fsx.fsx_projid == 0 || phc->keep_projid))
goto out;
- fsx.fsx_xflags &= ~
LL_PROJINHERIT_FL
;
+ fsx.fsx_xflags &= ~
FS_XFLAG_PROJINHERIT
;
if (!phc->keep_projid)
fsx.fsx_projid = 0;
@@
-224,6
+224,7
@@
lfs_project_handle_dir(struct list_head *head, const char *pathname,
struct dirent *ent;
DIR *dir;
int ret = 0;
+ int rc;
dir = opendir(pathname);
if (dir == NULL) {
@@
-233,30
+234,33
@@
lfs_project_handle_dir(struct list_head *head, const char *pathname,
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)
- fprintf(stderr, "%s: failed to handle dir '%s': %s\n",
- progname, pathname, strerror(errno));
-
closedir(dir);
return ret;
}
@@
-270,7
+274,7
@@
static int lfs_project_iterate(const char *pathname,
struct list_head head;
struct stat st;
int ret = 0;
-
bool top_dir = true
;
+
int rc = 0
;
ret = stat(pathname, &st);
if (ret) {
@@
-296,16
+300,11
@@
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 (ret == 0) {
- ret = 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;
- }
+ rc = lfs_project_handle_dir(&head, lpi->lpi_pathname,
+ phc, func);
+ if (!ret && rc)
+ ret = rc;
free(lpi);
- top_dir = false;
}
return ret;