LLNL / UnifyFS

UnifyFS: A file system for burst buffers
Other
102 stars 31 forks source link

preload: copy timestamps with cp -p #729

Open adammoody opened 2 years ago

adammoody commented 2 years ago

A cp with the -p option fails when accessing a file descriptor while trying to copy the file timestamps. Here is an strace output for cp -pr file.foo file.bar on NFS.

stat("file.bar", 0x7fffffffbed0)        = -1 ENOENT (No such file or directory)
lstat("file.foo", {st_mode=S_IFREG|0600, st_size=0, ...}) = 0
stat("file.bar", 0x7fffffffbc30)        = -1 ENOENT (No such file or directory)
open("file.foo", O_RDONLY|O_NOFOLLOW)   = 3
fstat(3, {st_mode=S_IFREG|0600, st_size=0, ...}) = 0
open("file.bar", O_WRONLY|O_CREAT|O_EXCL, 0600) = 4
fstat(4, {st_mode=S_IFREG|0600, st_size=0, ...}) = 0
fadvise64(3, 0, 0, POSIX_FADV_SEQUENTIAL) = 0
read(3, "", 65536)                      = 0
utimensat(4, NULL, [{tv_sec=1659649206, tv_nsec=800501000} /* 2022-08-04T14:40:06.800501000-0700 */, {tv_sec=1659649206, tv_nsec=800501000} /* 2022-08-04T14:40:06.800501000-0700 */], 0) = 0
fgetxattr(3, "system.posix_acl_access", 0x7fffffffb870, 132) = -1 EOPNOTSUPP (Operation not supported)
fsetxattr(4, "system.posix_acl_access", "\2\0\0\0\1\0\6\0\377\377\377\377\4\0\0\0\377\377\377\377 \0\0\0\377\377\377\377", 28, 0) = -1 EOPNOTSUPP (Operation not supported)
fchmod(4, 0100600)                      = 0
close(4)                                = 0
close(3)                                = 0
lseek(0, 0, SEEK_CUR)                   = -1 ESPIPE (Illegal seek)
close(0)                                = 0
close(1)                                = 0
close(2)                                = 0

It looks to be due to a missing wrapper for utimensat.

We should also check fadvise64, fgetxattr, fgetxattr.

adammoody commented 2 years ago

Actually it seems, cp -p calls futimens. I added wrappers for this and and "not supported" wrapper for utimensat in https://github.com/LLNL/UnifyFS/commit/64977810a18351ed438bb59cff791943ea55636e

adammoody commented 2 years ago

Noticing a segfault on a touch /unifyfs/file1:

2022-08-05T13:14:54 tid=51630 @ __wrap_close() [unifyfs-sysio.c:2287] closing (internal=0, exposed=1024)
2022-08-05T13:14:54 tid=51630 @ __wrap_close() [unifyfs-sysio.c:2324] syncing fid=1
2022-08-05T13:14:54 tid=51630 @ unifyfs_intercept_fd() [posix_client.c:289] Changing fd from exposed dup2=0 to internal 0
./runme_preload: line 68: 51630 Segmentation fault      (core dumped) touch /unifyfs/file1