#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
+ " unable to get xattr for fifo '$dir/pipe'" || return 1
#command can process further if it hit some errors
touch $dir/aaa $dir/bbb
mkdir $dir/subdir -p
}
run_test 63 "quota on DoM tests"
+test_64() {
+ ! is_project_quota_supported &&
+ skip "Project quota is not supported"
+ setup_quota_test || error "setup quota failed with $?"
+ local dir1="$DIR/$tdir/"
+
+ touch $dir1/file
+ ln -s $dir1/file $dir1/file_link
+
+ $LFS project -sp $TSTPRJID $dir1/file_link >&/dev/null &&
+ error "set symlink file's project should fail"
+
+ $LFS project $TSTPRJID $dir1/file_link >&/dev/null &&
+ error "get symlink file's project should fail"
+
+ cleanup_quota_test
+}
+run_test 64 "lfs project on symlink files should fail"
+
quota_fini()
{
do_nodes $(comma_list $(nodes_list)) "lctl set_param debug=-quota"
return 0;
}
+static const char *mode_to_type(mode_t mode)
+{
+ switch (mode & S_IFMT) {
+ case S_IFDIR: return "dir";
+ case S_IFREG: return "regular";
+ case S_IFLNK: return "symlink";
+ case S_IFCHR: return "char device";
+ case S_IFBLK: return "block device";
+ case S_IFIFO: return "fifo";
+ case S_IFSOCK: return "sock";
+ }
+
+ return "unknown";
+}
+
static int project_get_xattr(const char *pathname, struct fsxattr *fsx)
{
int ret, fd;
+ struct stat st;
+
+ ret = lstat(pathname, &st);
+ if (ret) {
+ fprintf(stderr, "%s: failed to stat '%s': %s\n",
+ progname, pathname, strerror(errno));
+ return -errno;
+ }
+
+ /* currently, only file and dir supported */
+ if (!S_ISREG(st.st_mode) && !S_ISDIR(st.st_mode)) {
+ errno = ENOTSUP;
+ fprintf(stderr, "%s: unable to get xattr for %s '%s': %s\n",
+ progname, mode_to_type(st.st_mode), pathname,
+ strerror(errno));
+ return -errno;
+ }
fd = open(pathname, O_RDONLY | O_NOCTTY | O_NDELAY);
if (fd < 0) {
project_check_one(const char *pathname, struct project_handle_control *phc)
{
struct fsxattr fsx;
- struct stat st;
int ret;
- ret = stat(pathname, &st);
- if (ret) {
- fprintf(stderr, "%s: failed to stat '%s': %s\n",
- progname, pathname, strerror(errno));
- return -errno;
- }
-
ret = project_get_xattr(pathname, &fsx);
if (ret < 0)
return ret;