Add O_NONBLOCK flag on opening special files lest it hang.
Since '--printf' requires gather_all, and in check_projid case and
gather_all case, it open the special file and try to get project id
from it, we shouldn't error out on only gather_all case.
Signed-off-by: Bobi Jam <bobijam@whamcloud.com>
Change-Id: Ic2afff7bbccf73ff94c64c62799f9b37b18d10a1
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/50905
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Thomas Bertschinger <bertschinger@lanl.gov>
}
run_test 56rc "check lfs find --mdt-count/--mdt-hash works"
+test_56rd() {
+ local dir=$DIR/$tdir
+
+ test_mkdir $dir
+
+ mkfifo $dir/fifo || error "failed to create fifo file"
+ found=$($LFS find $dir -t p --printf "%y")
+ [[ "p" = $found ]] || error "found $found, expect p"
+
+ mknod $dir/chardev c 1 5 ||
+ error "failed to create character device file"
+ found=$($LFS find $dir -t c --printf "%y")
+ [[ "c" = $found ]] || error "found $found, expect c"
+}
+run_test 56rd "check lfs find --printf special files"
+
test_56s() { # LU-611 #LU-9369
[[ $OSTCOUNT -lt 2 ]] && skip_env "need at least 2 OSTs"
int projid = 0;
if (fd == -2)
- fd = open(path, O_RDONLY);
+ fd = open(path, O_RDONLY | O_NONBLOCK);
if (fd > 0)
ret = fget_projid(fd, &projid);
else
ret = -errno;
- if (ret)
- goto out;
- if (projid == param->fp_projid) {
- if (param->fp_exclude_projid)
- goto decided;
- } else {
- if (!param->fp_exclude_projid)
- goto decided;
+ if (param->fp_check_projid) {
+ if (ret)
+ goto out;
+ if (projid == param->fp_projid) {
+ if (param->fp_exclude_projid)
+ goto decided;
+ } else {
+ if (!param->fp_exclude_projid)
+ goto decided;
+ }
}
}