Loading CHANGELOG.md +2 −0 Original line number Original line Diff line number Diff line Loading @@ -8,6 +8,8 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] ## [Unreleased] ### New ### New - Added intercepton of `fadvise64()` and `fallocate()` ([!161](https://storage.bsc.es/gitlab/hpc/gekkofs/-/merge_request/161)). - Added user library `gkfs_user_lib` that can be used to directly link to an - Added user library `gkfs_user_lib` that can be used to directly link to an application ([!171](https://storage.bsc.es/gitlab/hpc/gekkofs/-/merge_request/171)). application ([!171](https://storage.bsc.es/gitlab/hpc/gekkofs/-/merge_request/171)). - FMT10 and date removal, several dependencies updated. ([!172](https://storage.bsc.es/gitlab/hpc/gekkofs/-/merge_request/172)). - FMT10 and date removal, several dependencies updated. ([!172](https://storage.bsc.es/gitlab/hpc/gekkofs/-/merge_request/172)). Loading include/client/hooks.hpp +6 −0 Original line number Original line Diff line number Diff line Loading @@ -205,6 +205,12 @@ hook_fsync(unsigned int fd); int int hook_getxattr(const char* path, const char* name, void* value, size_t size); hook_getxattr(const char* path, const char* name, void* value, size_t size); int hook_fallocate(int fd, int mode, off_t offset, off_t len); int hook_fadvise64(int fd, off_t offset, off_t len, int advice); } // namespace gkfs::hook } // namespace gkfs::hook #endif #endif src/client/hooks.cpp +24 −0 Original line number Original line Diff line number Diff line Loading @@ -983,4 +983,28 @@ hook_getxattr(const char* path, const char* name, void* value, size_t size) { return syscall_no_intercept_wrapper(SYS_getxattr, path, name, value, size); return syscall_no_intercept_wrapper(SYS_getxattr, path, name, value, size); } } int hook_fallocate(int fd, int mode, off_t offset, off_t len) { LOG(DEBUG, "{}() called with fd '{}' mode '{}' offset '{}' len '{}'", __func__, fd, mode, offset, len); if(CTX->file_map()->exist(fd)) { return -ENOTSUP; } return syscall_no_intercept_wrapper(SYS_fallocate, fd, mode, offset, len); } int hook_fadvise64(int fd, off_t offset, off_t len, int advice) { LOG(DEBUG, "{}() called with fd '{}' offset '{}' len '{}' advice '{}'", __func__, fd, offset, len, advice); if(CTX->file_map()->exist(fd)) { return -ENOTSUP; } return syscall_no_intercept_wrapper(SYS_fadvise64, fd, offset, len, advice); } } // namespace gkfs::hook } // namespace gkfs::hook src/client/intercept.cpp +12 −0 Original line number Original line Diff line number Diff line Loading @@ -785,6 +785,18 @@ hook(long syscall_number, long arg0, long arg1, long arg2, long arg3, long arg4, reinterpret_cast<void*>(arg2), static_cast<size_t>(arg4)); reinterpret_cast<void*>(arg2), static_cast<size_t>(arg4)); break; break; case SYS_fallocate: *result = gkfs::hook::hook_fallocate( static_cast<int>(arg0), static_cast<int>(arg1), static_cast<off_t>(arg2), static_cast<off_t>(arg3)); break; case SYS_fadvise64: *result = gkfs::hook::hook_fadvise64( static_cast<int>(arg0), static_cast<off_t>(arg1), static_cast<off_t>(arg2), static_cast<int>(arg4)); break; default: default: // ignore any other syscalls, i.e.: pass them on to the kernel // ignore any other syscalls, i.e.: pass them on to the kernel // (syscalls forwarded to the kernel that return are logged in // (syscalls forwarded to the kernel that return are logged in Loading Loading
CHANGELOG.md +2 −0 Original line number Original line Diff line number Diff line Loading @@ -8,6 +8,8 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] ## [Unreleased] ### New ### New - Added intercepton of `fadvise64()` and `fallocate()` ([!161](https://storage.bsc.es/gitlab/hpc/gekkofs/-/merge_request/161)). - Added user library `gkfs_user_lib` that can be used to directly link to an - Added user library `gkfs_user_lib` that can be used to directly link to an application ([!171](https://storage.bsc.es/gitlab/hpc/gekkofs/-/merge_request/171)). application ([!171](https://storage.bsc.es/gitlab/hpc/gekkofs/-/merge_request/171)). - FMT10 and date removal, several dependencies updated. ([!172](https://storage.bsc.es/gitlab/hpc/gekkofs/-/merge_request/172)). - FMT10 and date removal, several dependencies updated. ([!172](https://storage.bsc.es/gitlab/hpc/gekkofs/-/merge_request/172)). Loading
include/client/hooks.hpp +6 −0 Original line number Original line Diff line number Diff line Loading @@ -205,6 +205,12 @@ hook_fsync(unsigned int fd); int int hook_getxattr(const char* path, const char* name, void* value, size_t size); hook_getxattr(const char* path, const char* name, void* value, size_t size); int hook_fallocate(int fd, int mode, off_t offset, off_t len); int hook_fadvise64(int fd, off_t offset, off_t len, int advice); } // namespace gkfs::hook } // namespace gkfs::hook #endif #endif
src/client/hooks.cpp +24 −0 Original line number Original line Diff line number Diff line Loading @@ -983,4 +983,28 @@ hook_getxattr(const char* path, const char* name, void* value, size_t size) { return syscall_no_intercept_wrapper(SYS_getxattr, path, name, value, size); return syscall_no_intercept_wrapper(SYS_getxattr, path, name, value, size); } } int hook_fallocate(int fd, int mode, off_t offset, off_t len) { LOG(DEBUG, "{}() called with fd '{}' mode '{}' offset '{}' len '{}'", __func__, fd, mode, offset, len); if(CTX->file_map()->exist(fd)) { return -ENOTSUP; } return syscall_no_intercept_wrapper(SYS_fallocate, fd, mode, offset, len); } int hook_fadvise64(int fd, off_t offset, off_t len, int advice) { LOG(DEBUG, "{}() called with fd '{}' offset '{}' len '{}' advice '{}'", __func__, fd, offset, len, advice); if(CTX->file_map()->exist(fd)) { return -ENOTSUP; } return syscall_no_intercept_wrapper(SYS_fadvise64, fd, offset, len, advice); } } // namespace gkfs::hook } // namespace gkfs::hook
src/client/intercept.cpp +12 −0 Original line number Original line Diff line number Diff line Loading @@ -785,6 +785,18 @@ hook(long syscall_number, long arg0, long arg1, long arg2, long arg3, long arg4, reinterpret_cast<void*>(arg2), static_cast<size_t>(arg4)); reinterpret_cast<void*>(arg2), static_cast<size_t>(arg4)); break; break; case SYS_fallocate: *result = gkfs::hook::hook_fallocate( static_cast<int>(arg0), static_cast<int>(arg1), static_cast<off_t>(arg2), static_cast<off_t>(arg3)); break; case SYS_fadvise64: *result = gkfs::hook::hook_fadvise64( static_cast<int>(arg0), static_cast<off_t>(arg1), static_cast<off_t>(arg2), static_cast<int>(arg4)); break; default: default: // ignore any other syscalls, i.e.: pass them on to the kernel // ignore any other syscalls, i.e.: pass them on to the kernel // (syscalls forwarded to the kernel that return are logged in // (syscalls forwarded to the kernel that return are logged in Loading