Skip to content

Commit 3581e5f

Browse files
committed
ignore FS_IOC_FIEMAP failure with ENOTSUPP
Lustre 2.15.6 can return ENOTSUPP (524) in response to an FS_IOC_FIEMAP ioctl() call, for a file striped a certain way. This is a bug, it should return EOPNOTSUPP (95). The file can still be copied, fiemap just can't tell us where the holes are. A brief survey using google searches suggests ENOTSUPP (524) was historically intended for use internal to the kernel or drivers, but has occasionally been returned to users by different software, in ways that have meaning similar to ENOTSUP. Ignore the error as with ENOTSUP (95) so the file is copied without the use of fiemap. Notify the user that the copied file is not sparse. Fixes #644 Signed-off-by: Olaf Faaland <[email protected]>
1 parent 55f9aa5 commit 3581e5f

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

src/common/mfu_errors.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ static inline int mfu_errno2rc(int err)
2020
return -1;
2121
}
2222

23+
/* Non-standard error code returned by syscalls or external libs */
24+
/* Returned by ioctl(FIEMAP) with Lustre 2.15.6, should be 95 ENOTSUP */
25+
#define MFU_ERR_ENOTSUPP 524
26+
2327
/* Generic error codes */
2428
#define MFU_ERR 1000
2529
#define MFU_ERR_INVAL_ARG 1001

src/common/mfu_flist_copy.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757

5858
#include "mfu.h"
5959
#include "mfu_flist_internal.h"
60+
#include "mfu_errors.h"
6061
#include "strmap.h"
6162

6263
#ifdef LUSTRE_SUPPORT
@@ -1933,8 +1934,9 @@ static int mfu_copy_file_fiemap(
19331934
}
19341935

19351936
if (ioctl(mfu_src_file->fd, FS_IOC_FIEMAP, fiemap) < 0) {
1936-
if (errno == ENOTSUP) {
1937-
/* silently ignore */
1937+
if (errno == ENOTSUP || errno == MFU_ERR_ENOTSUPP) {
1938+
MFU_LOG(MFU_LOG_INFO, "Destination file not sparse; FIEMAP not supported for src '%s'",
1939+
src, errno, strerror(errno));
19381940
} else {
19391941
MFU_LOG(MFU_LOG_ERR, "fiemap ioctl() failed for src '%s' (errno=%d %s)",
19401942
src, errno, strerror(errno));

0 commit comments

Comments
 (0)