From 778d280b938d4dd8407f603c76b456f7db89c4aa Mon Sep 17 00:00:00 2001 From: Ramon Nou Date: Thu, 28 May 2020 13:42:16 +0200 Subject: [PATCH 1/2] Fsync bypass for ior --- src/client/intercept.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/client/intercept.cpp b/src/client/intercept.cpp index 708cafe6d..d3f9ddab6 100644 --- a/src/client/intercept.cpp +++ b/src/client/intercept.cpp @@ -726,6 +726,10 @@ int hook(long syscall_number, reinterpret_cast(arg1)); break; + case SYS_fsync: + *result = 0; + break; + default: // ignore any other syscalls, i.e.: pass them on to the kernel // (syscalls forwarded to the kernel that return are logged in -- GitLab From d264cd68308d6b94a58b008eb1388c2c3fc1af20 Mon Sep 17 00:00:00 2001 From: Ramon Nou Date: Thu, 28 May 2020 15:09:00 +0200 Subject: [PATCH 2/2] Extended implementation, checking fd --- include/client/hooks.hpp | 2 ++ src/client/hooks.cpp | 14 ++++++++++++++ src/client/intercept.cpp | 2 +- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/include/client/hooks.hpp b/include/client/hooks.hpp index 9af366dd4..fcc043717 100644 --- a/include/client/hooks.hpp +++ b/include/client/hooks.hpp @@ -105,6 +105,8 @@ int hook_statfs(const char* path, struct statfs* buf); int hook_fstatfs(unsigned int fd, struct statfs* buf); +int hook_fsync(unsigned int fd); + } // namespace hook } // namespace gkfs diff --git a/src/client/hooks.cpp b/src/client/hooks.cpp index 7ca89a4fe..a16d9ea96 100644 --- a/src/client/hooks.cpp +++ b/src/client/hooks.cpp @@ -814,5 +814,19 @@ int hook_fstatfs(unsigned int fd, struct statfs* buf) { return syscall_no_intercept(SYS_fstatfs, fd, buf); } +/* The function should broadcast a flush message (pmem_persist i.e.) if the application needs the capabilities*/ +int hook_fsync(unsigned int fd) { + + LOG(DEBUG, "{}() called with fd: {}", + __func__, fd); + + if (CTX->file_map()->exist(fd)) { + errno = 0; + return 0; + } + + return syscall_no_intercept(SYS_fsync, fd); +} + } // namespace hook } // namespace gkfs diff --git a/src/client/intercept.cpp b/src/client/intercept.cpp index d3f9ddab6..19f786a9b 100644 --- a/src/client/intercept.cpp +++ b/src/client/intercept.cpp @@ -727,7 +727,7 @@ int hook(long syscall_number, break; case SYS_fsync: - *result = 0; + *result = gkfs::hook::hook_fsync(static_cast(arg0)); break; default: -- GitLab