Loading .gitlab-ci.yml +1 −1 Original line number Diff line number Diff line Loading @@ -22,7 +22,7 @@ variables: LIBGKFS_LOG: "all" LIBGKFS_LOG_OUTPUT: "${CI_PROJECT_DIR}/logs/gkfs_client.log" GIT_SUBMODULE_STRATEGY: recursive CCACHE_DIR: "$CI_PROJECT_DIR/ccache" CCACHE_DIR: "${CI_PROJECT_DIR}/ccache" # SONAR_USER_HOME: "${CI_PROJECT_DIR}/.sonar" # Defines the location of the analysis task cache # GIT_DEPTH: "0" # Tells git to fetch all the branches of the project, required by the analysis task Loading include/client/gkfs_libc.hpp +3 −1 Original line number Diff line number Diff line Loading @@ -90,7 +90,6 @@ ssize_t dlsym_read(int fd, void* buf, size_t nbyte); ssize_t dlsym_write(int fd, void* buf, size_t nbyte); ssize_t dlsym_pread(int fd, void* buf, size_t count, off_t offset); ssize_t Loading @@ -107,6 +106,7 @@ dlsym_lseek64(int fd, off64_t offset, int whence); int dlsym_fstat(int ver, int fd, struct stat* buf); int dlsym_fxstat64(int ver, int fd, struct stat64* buf); int Loading @@ -120,6 +120,8 @@ dlsym_xstat64(int ver, const char* path, struct stat64* buf); int dlsym_fstatat(int dfd, const char* path, struct stat* buf, int flags); int dlsym_fxstatat(int ver, int dfd, const char* path, struct stat* buf, int flags); int dlsym_fstatat64(int dfd, const char* path, struct stat64* buf, int flags); int Loading src/client/gkfs_libc.cpp +40 −11 Original line number Diff line number Diff line Loading @@ -53,7 +53,6 @@ std::atomic<bool> initializing{false}; #define debug_info(...) // #endif int (*real_open)(char*, int, mode_t) = NULL; int (*real_open64)(char*, int, mode_t) = NULL; int (*real___open_2)(char*, int) = NULL; Loading @@ -80,6 +79,7 @@ int (*real_lxstat64)(int, const char*, struct stat64*) = NULL; int (*real_fstat)(int, int, struct stat*) = NULL; int (*real_fxstat64)(int, int, struct stat64*) = NULL; int (*real_fstatat)(int, const char*, struct stat*, int) = NULL; int (*real_fxstatat)(int, int, const char*, struct stat*, int) = NULL; int (*real_fstatat64)(int, const char*, struct stat64*, int) = NULL; int (*real_rename)(const char*, const char*) = NULL; Loading Loading @@ -469,6 +469,22 @@ dlsym_fstat(int ver, int fd, struct stat* buf) { return ret; } int dlsym_fxstatat(int ver, int dfd, const char* path, struct stat* buf, int flags) { if(real_fxstatat == NULL) { real_fxstatat = (int (*)(int, int, const char*, struct stat*, int)) dlsym(RTLD_NEXT, "__fxstatat"); } int ret = real_fxstatat(ver, dfd, (char*) path, buf, flags); return ret; } int dlsym_fstatat(int dfd, const char* path, struct stat* buf, int flags) { Loading Loading @@ -905,6 +921,7 @@ stat64_to_stat(struct stat* buf, struct stat64* st) { // File API int open(const char* path, int flags, ...) { int ret, fd; va_list ap; mode_t mode = 0; Loading Loading @@ -943,6 +960,7 @@ open(const char* path, int flags, ...) { int open64(const char* path, int flags, ...) { int fd, ret; va_list ap; mode_t mode = 0; Loading Loading @@ -985,6 +1003,7 @@ open64(const char* path, int flags, ...) { int openat(int dirfd, const char* path, int flags, ...) { int ret, fd; va_list ap; mode_t mode = 0; Loading Loading @@ -1022,6 +1041,7 @@ openat(int dirfd, const char* path, int flags, ...) { int openat64(int dirfd, const char* path, int flags, ...) { va_list ap; mode_t mode = 0; initializeGekko(); Loading Loading @@ -1076,6 +1096,7 @@ close_range(unsigned low, unsigned high, int flags) { int creat(const char* path, mode_t mode) { debug_info("[BYPASS] >> Begin creat....%s %o\n", path, mode); // Is path from gekkofs? Loading Loading @@ -1108,6 +1129,7 @@ creat(const char* path, mode_t mode) { int ftruncate(int fd, off_t length) { debug_info("[BYPASS] >> Begin ftruncate.... %d %ld\n", fd, length); int ret = dlsym_ftruncate(fd, length); Loading @@ -1119,6 +1141,7 @@ ftruncate(int fd, off_t length) { ssize_t read(int fd, void* buf, size_t nbyte) { initializeGekko(); if(CTX->file_map()->exist(fd)) { debug_info("[READ from GKFS]....%d %ld\n", fd, nbyte); Loading @@ -1133,6 +1156,7 @@ read(int fd, void* buf, size_t nbyte) { ssize_t write(int fd, const void* buf, size_t nbyte) { initializeGekko(); if(CTX->file_map()->exist(fd)) { debug_info("[WRITE from GKFS]....%d \n", fd); Loading Loading @@ -1369,13 +1393,15 @@ unlink(const char* path) { // fill missing stat functions int __xstat(int ver, const char* path, struct stat* buf) { debug_info("[BYPASS] >> Begin __xstat....%s\n", path); initializeGekko(); // Is path from GekkoFS? if(CTX->interception_enabled()) { std::string resolved; auto rstatus = CTX->relativize_fd_path(AT_FDCWD, path, resolved); // There is an issue with relatici auto rstatus = CTX->relativize_fd_path(AT_FDCWD, path, resolved, 0, false); switch(rstatus) { case gkfs::preload::RelativizeStatus::fd_not_a_dir: Loading Loading @@ -1437,23 +1463,25 @@ statx(int dirfd, const char* path, int flags, unsigned int mask, int __lxstat(int ver, const char* path, struct stat* buf) { debug_info("[__lxstat ? (A)]....%s \n", path); int res; initializeGekko(); // Is path from GekkoFS? if(CTX->interception_enabled()) { std::string resolved; auto rstatus = CTX->relativize_fd_path(AT_FDCWD, path, resolved); auto rstatus = CTX->relativize_fd_path(AT_FDCWD, path, resolved, 0, false); switch(rstatus) { case gkfs::preload::RelativizeStatus::fd_not_a_dir: return -ENOTDIR; case gkfs::preload::RelativizeStatus::internal: debug_info("[__lxstat64 from GKFS]....%s \n", resolved.c_str()); res = gkfs::syscall::gkfs_stat(resolved, buf); debug_info("[__lxstat from GKFS]....%s \n", resolved.c_str()); res = gkfs::syscall::gkfs_stat(resolved, buf, false); return res; default: Loading @@ -1461,7 +1489,6 @@ __lxstat(int ver, const char* path, struct stat* buf) { break; } } res = dlsym_lstat(ver, (const char*) path, buf); return res; } Loading @@ -1469,6 +1496,7 @@ __lxstat(int ver, const char* path, struct stat* buf) { int __lxstat64(int ver, const char* path, struct stat64* buf) { int res; initializeGekko(); Loading Loading @@ -1530,7 +1558,8 @@ __fxstatat(int ver, int dfd, const char* path, struct stat* buf, int flags) { if(CTX->interception_enabled()) { std::string resolved; auto rstatus = CTX->relativize_fd_path(dfd, path, resolved, flags); auto rstatus = CTX->relativize_fd_path(dfd, path, resolved, flags, false); switch(rstatus) { case gkfs::preload::RelativizeStatus::fd_not_a_dir: Loading @@ -1547,8 +1576,8 @@ __fxstatat(int ver, int dfd, const char* path, struct stat* buf, int flags) { break; } } int ret = dlsym_fstatat(dfd, path, buf, flags); // Using fstatat produces SEGFAULT in ci testing, we should use fxstatat int ret = dlsym_fxstatat(ver, dfd, path, buf, flags); return ret; } Loading Loading
.gitlab-ci.yml +1 −1 Original line number Diff line number Diff line Loading @@ -22,7 +22,7 @@ variables: LIBGKFS_LOG: "all" LIBGKFS_LOG_OUTPUT: "${CI_PROJECT_DIR}/logs/gkfs_client.log" GIT_SUBMODULE_STRATEGY: recursive CCACHE_DIR: "$CI_PROJECT_DIR/ccache" CCACHE_DIR: "${CI_PROJECT_DIR}/ccache" # SONAR_USER_HOME: "${CI_PROJECT_DIR}/.sonar" # Defines the location of the analysis task cache # GIT_DEPTH: "0" # Tells git to fetch all the branches of the project, required by the analysis task Loading
include/client/gkfs_libc.hpp +3 −1 Original line number Diff line number Diff line Loading @@ -90,7 +90,6 @@ ssize_t dlsym_read(int fd, void* buf, size_t nbyte); ssize_t dlsym_write(int fd, void* buf, size_t nbyte); ssize_t dlsym_pread(int fd, void* buf, size_t count, off_t offset); ssize_t Loading @@ -107,6 +106,7 @@ dlsym_lseek64(int fd, off64_t offset, int whence); int dlsym_fstat(int ver, int fd, struct stat* buf); int dlsym_fxstat64(int ver, int fd, struct stat64* buf); int Loading @@ -120,6 +120,8 @@ dlsym_xstat64(int ver, const char* path, struct stat64* buf); int dlsym_fstatat(int dfd, const char* path, struct stat* buf, int flags); int dlsym_fxstatat(int ver, int dfd, const char* path, struct stat* buf, int flags); int dlsym_fstatat64(int dfd, const char* path, struct stat64* buf, int flags); int Loading
src/client/gkfs_libc.cpp +40 −11 Original line number Diff line number Diff line Loading @@ -53,7 +53,6 @@ std::atomic<bool> initializing{false}; #define debug_info(...) // #endif int (*real_open)(char*, int, mode_t) = NULL; int (*real_open64)(char*, int, mode_t) = NULL; int (*real___open_2)(char*, int) = NULL; Loading @@ -80,6 +79,7 @@ int (*real_lxstat64)(int, const char*, struct stat64*) = NULL; int (*real_fstat)(int, int, struct stat*) = NULL; int (*real_fxstat64)(int, int, struct stat64*) = NULL; int (*real_fstatat)(int, const char*, struct stat*, int) = NULL; int (*real_fxstatat)(int, int, const char*, struct stat*, int) = NULL; int (*real_fstatat64)(int, const char*, struct stat64*, int) = NULL; int (*real_rename)(const char*, const char*) = NULL; Loading Loading @@ -469,6 +469,22 @@ dlsym_fstat(int ver, int fd, struct stat* buf) { return ret; } int dlsym_fxstatat(int ver, int dfd, const char* path, struct stat* buf, int flags) { if(real_fxstatat == NULL) { real_fxstatat = (int (*)(int, int, const char*, struct stat*, int)) dlsym(RTLD_NEXT, "__fxstatat"); } int ret = real_fxstatat(ver, dfd, (char*) path, buf, flags); return ret; } int dlsym_fstatat(int dfd, const char* path, struct stat* buf, int flags) { Loading Loading @@ -905,6 +921,7 @@ stat64_to_stat(struct stat* buf, struct stat64* st) { // File API int open(const char* path, int flags, ...) { int ret, fd; va_list ap; mode_t mode = 0; Loading Loading @@ -943,6 +960,7 @@ open(const char* path, int flags, ...) { int open64(const char* path, int flags, ...) { int fd, ret; va_list ap; mode_t mode = 0; Loading Loading @@ -985,6 +1003,7 @@ open64(const char* path, int flags, ...) { int openat(int dirfd, const char* path, int flags, ...) { int ret, fd; va_list ap; mode_t mode = 0; Loading Loading @@ -1022,6 +1041,7 @@ openat(int dirfd, const char* path, int flags, ...) { int openat64(int dirfd, const char* path, int flags, ...) { va_list ap; mode_t mode = 0; initializeGekko(); Loading Loading @@ -1076,6 +1096,7 @@ close_range(unsigned low, unsigned high, int flags) { int creat(const char* path, mode_t mode) { debug_info("[BYPASS] >> Begin creat....%s %o\n", path, mode); // Is path from gekkofs? Loading Loading @@ -1108,6 +1129,7 @@ creat(const char* path, mode_t mode) { int ftruncate(int fd, off_t length) { debug_info("[BYPASS] >> Begin ftruncate.... %d %ld\n", fd, length); int ret = dlsym_ftruncate(fd, length); Loading @@ -1119,6 +1141,7 @@ ftruncate(int fd, off_t length) { ssize_t read(int fd, void* buf, size_t nbyte) { initializeGekko(); if(CTX->file_map()->exist(fd)) { debug_info("[READ from GKFS]....%d %ld\n", fd, nbyte); Loading @@ -1133,6 +1156,7 @@ read(int fd, void* buf, size_t nbyte) { ssize_t write(int fd, const void* buf, size_t nbyte) { initializeGekko(); if(CTX->file_map()->exist(fd)) { debug_info("[WRITE from GKFS]....%d \n", fd); Loading Loading @@ -1369,13 +1393,15 @@ unlink(const char* path) { // fill missing stat functions int __xstat(int ver, const char* path, struct stat* buf) { debug_info("[BYPASS] >> Begin __xstat....%s\n", path); initializeGekko(); // Is path from GekkoFS? if(CTX->interception_enabled()) { std::string resolved; auto rstatus = CTX->relativize_fd_path(AT_FDCWD, path, resolved); // There is an issue with relatici auto rstatus = CTX->relativize_fd_path(AT_FDCWD, path, resolved, 0, false); switch(rstatus) { case gkfs::preload::RelativizeStatus::fd_not_a_dir: Loading Loading @@ -1437,23 +1463,25 @@ statx(int dirfd, const char* path, int flags, unsigned int mask, int __lxstat(int ver, const char* path, struct stat* buf) { debug_info("[__lxstat ? (A)]....%s \n", path); int res; initializeGekko(); // Is path from GekkoFS? if(CTX->interception_enabled()) { std::string resolved; auto rstatus = CTX->relativize_fd_path(AT_FDCWD, path, resolved); auto rstatus = CTX->relativize_fd_path(AT_FDCWD, path, resolved, 0, false); switch(rstatus) { case gkfs::preload::RelativizeStatus::fd_not_a_dir: return -ENOTDIR; case gkfs::preload::RelativizeStatus::internal: debug_info("[__lxstat64 from GKFS]....%s \n", resolved.c_str()); res = gkfs::syscall::gkfs_stat(resolved, buf); debug_info("[__lxstat from GKFS]....%s \n", resolved.c_str()); res = gkfs::syscall::gkfs_stat(resolved, buf, false); return res; default: Loading @@ -1461,7 +1489,6 @@ __lxstat(int ver, const char* path, struct stat* buf) { break; } } res = dlsym_lstat(ver, (const char*) path, buf); return res; } Loading @@ -1469,6 +1496,7 @@ __lxstat(int ver, const char* path, struct stat* buf) { int __lxstat64(int ver, const char* path, struct stat64* buf) { int res; initializeGekko(); Loading Loading @@ -1530,7 +1558,8 @@ __fxstatat(int ver, int dfd, const char* path, struct stat* buf, int flags) { if(CTX->interception_enabled()) { std::string resolved; auto rstatus = CTX->relativize_fd_path(dfd, path, resolved, flags); auto rstatus = CTX->relativize_fd_path(dfd, path, resolved, flags, false); switch(rstatus) { case gkfs::preload::RelativizeStatus::fd_not_a_dir: Loading @@ -1547,8 +1576,8 @@ __fxstatat(int ver, int dfd, const char* path, struct stat* buf, int flags) { break; } } int ret = dlsym_fstatat(dfd, path, buf, flags); // Using fstatat produces SEGFAULT in ci testing, we should use fxstatat int ret = dlsym_fxstatat(ver, dfd, path, buf, flags); return ret; } Loading