summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPranith Kumar K <pkarampu@redhat.com>2020-05-06 17:36:20 +0530
committerPranith Kumar K <pkarampu@redhat.com>2020-05-06 17:42:53 +0530
commitb85f01abab658d1d704cd6caf84dd64eddafbff7 (patch)
tree2f1c4d986ce6ca8c1f4e5a00a38d5514dbc8aa21
parent251e43ca9fcf216d8f045d9e2937ad9870be15d8 (diff)
tests: skip tests on absence of reflink in xfs
Fixes: #1223 Change-Id: I36cb72d920ffd77405051546615c5262c392daef Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
-rw-r--r--libglusterfs/src/syscall.c3
-rw-r--r--tests/basic/gfapi/gfapi-copy-file-range.t16
-rw-r--r--xlators/storage/posix/src/posix-inode-fd-ops.c3
3 files changed, 12 insertions, 10 deletions
diff --git a/libglusterfs/src/syscall.c b/libglusterfs/src/syscall.c
index 49f782a..007e3e8 100644
--- a/libglusterfs/src/syscall.c
+++ b/libglusterfs/src/syscall.c
@@ -849,7 +849,8 @@ sys_copy_file_range(int fd_in, off64_t *off_in, int fd_out, off64_t *off_out,
return syscall(SYS_copy_file_range, fd_in, off_in, fd_out, off_out, len,
flags);
#else
- return -ENOSYS;
+ errno = ENOSYS;
+ return -1;
#endif /* HAVE_COPY_FILE_RANGE_SYS */
#endif /* HAVE_COPY_FILE_RANGE */
}
diff --git a/tests/basic/gfapi/gfapi-copy-file-range.t b/tests/basic/gfapi/gfapi-copy-file-range.t
index c24c143..a56d3a5 100644
--- a/tests/basic/gfapi/gfapi-copy-file-range.t
+++ b/tests/basic/gfapi/gfapi-copy-file-range.t
@@ -5,20 +5,22 @@
cleanup;
+mkfs.xfs 2>&1 | grep reflink
+if [ $? -ne 0 ]; then
+ SKIP_TESTS
+ exit
+fi
+
+
TEST glusterd
+TEST truncate -s 2G $B0/xfs_image
# for now, a xfs filesystem with reflink support is created.
# In future, better to make changes in MKFS_LOOP so that,
# once can create a xfs filesystem with reflink enabled in
# generic and simple way, instead of doing below steps each
# time.
-TEST truncate -s 2G $B0/xfs_image
-mkfs.xfs 2>&1 | grep reflink
-if [ $? -eq 0 ]; then
- mkfs.xfs -f -i size=512 -m reflink=1 $B0/xfs_image;
-else
- mkfs.xfs -f -i size=512 $B0/xfs_image;
-fi
+TEST mkfs.xfs -f -i size=512 -m reflink=1 $B0/xfs_image;
TEST mkdir $B0/bricks
TEST mount -t xfs -o loop $B0/xfs_image $B0/bricks
diff --git a/xlators/storage/posix/src/posix-inode-fd-ops.c b/xlators/storage/posix/src/posix-inode-fd-ops.c
index 439a436..904dbe5 100644
--- a/xlators/storage/posix/src/posix-inode-fd-ops.c
+++ b/xlators/storage/posix/src/posix-inode-fd-ops.c
@@ -2294,8 +2294,7 @@ posix_copy_file_range(call_frame_t *frame, xlator_t *this, fd_t *fd_in,
flags);
if (op_ret < 0) {
- op_errno = -op_ret;
- op_ret = -1;
+ op_errno = errno;
gf_msg(this->name, GF_LOG_ERROR, op_errno, P_MSG_COPY_FILE_RANGE_FAILED,
"copy_file_range failed: fd_in: %p (gfid: %s) ,"
" fd_out %p (gfid:%s)",