Loading CHANGELOG.md +2 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,8 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). - Support for increasing file size via `truncate()` added ([!159](https://storage.bsc.es/gitlab/hpc/gekkofs/-/merge_requests/159) - Added PowerPC support ([!151](https://storage.bsc.es/gitlab/hpc/gekkofs/-/merge_requests/151)). - RENAME_SUPPORT adds support for renaming files. It includes the use case of renaming opened files using the fd - FLOCK and fcntl functions for locks, are not supported, but they are available. ### Changed Loading README.md +3 −0 Original line number Diff line number Diff line Loading @@ -287,6 +287,9 @@ instead or in addition to the output file. It must be enabled at compile time vi argument `-DGKFS_ENABLE_PROMETHEUS` and the daemon argument `--enable-prometheus`. The corresponding statistics are then pushed to the Prometheus instance. ### Rename `-DRENAME_SUPPORT` allows the application to rename files. This is an experimental feature, and some scenarios may not work properly. Support for fstat in renamed files is included. ### Acknowledgment This software was partially supported by the EC H2020 funded NEXTGenIO project (Project ID: 671951, www.nextgenio.eu). Loading include/client/hooks.hpp +3 −0 Original line number Diff line number Diff line Loading @@ -120,6 +120,9 @@ hook_unlinkat(int dirfd, const char* cpath, int flags); int hook_symlinkat(const char* oldname, int newdfd, const char* newname); int hook_flock(unsigned long fd, int flags); int hook_access(const char* path, int mask); Loading include/common/metadata.hpp +12 −0 Original line number Diff line number Diff line Loading @@ -53,6 +53,10 @@ private: blkcnt_t blocks_{}; // allocated file system blocks_ #ifdef HAS_SYMLINKS std::string target_path_; // For links this is the path of the target file #ifdef HAS_RENAME std::string rename_path_; // In some cases fd is maintained so we need the // renamed path #endif #endif Loading Loading @@ -133,6 +137,14 @@ public: bool is_link() const; #ifdef HAS_RENAME std::string rename_path() const; void rename_path(const std::string& rename_path); #endif #endif }; Loading src/client/hooks.cpp +27 −0 Original line number Diff line number Diff line Loading @@ -178,6 +178,16 @@ hook_fstat(unsigned int fd, struct stat* buf) { if(CTX->file_map()->exist(fd)) { auto path = CTX->file_map()->get(fd)->path(); #ifdef HAS_RENAME // Special case for fstat and rename, fd points new file... // We can change file_map and recall auto md = gkfs::utils::get_metadata(path, false); if(md.has_value() and md.value().blocks() == -1) { path = md.value().rename_path(); std::cout << " Fstat " << path << std::endl; } #endif return with_errno(gkfs::syscall::gkfs_stat(path, buf)); } return syscall_no_intercept_wrapper(SYS_fstat, fd, buf); Loading Loading @@ -395,6 +405,16 @@ hook_symlinkat(const char* oldname, int newdfd, const char* newname) { } } int hook_flock(unsigned long fd, int flags) { LOG(ERROR, "{}() called flock (Not Supported) with fd: {}, flags: {}", __func__, fd, flags); if(CTX->file_map()->exist(fd)) { return 0; } else return -EBADF; } int hook_access(const char* path, int mask) { Loading Loading @@ -831,6 +851,13 @@ hook_fcntl(unsigned int fd, unsigned int cmd, unsigned long arg) { gkfs::filemap::OpenFile_flags::cloexec, (arg & FD_CLOEXEC)); return 0; case F_GETLK: LOG(ERROR, "{}() F_GETLK on fd (Not Supported) {}", __func__, fd); return 0; case F_SETLK: LOG(ERROR, "{}() F_SETLK on fd (Not Supported) {}", __func__, fd); return 0; default: LOG(ERROR, "{}() unrecognized command {} on fd {}", __func__, cmd, Loading Loading
CHANGELOG.md +2 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,8 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). - Support for increasing file size via `truncate()` added ([!159](https://storage.bsc.es/gitlab/hpc/gekkofs/-/merge_requests/159) - Added PowerPC support ([!151](https://storage.bsc.es/gitlab/hpc/gekkofs/-/merge_requests/151)). - RENAME_SUPPORT adds support for renaming files. It includes the use case of renaming opened files using the fd - FLOCK and fcntl functions for locks, are not supported, but they are available. ### Changed Loading
README.md +3 −0 Original line number Diff line number Diff line Loading @@ -287,6 +287,9 @@ instead or in addition to the output file. It must be enabled at compile time vi argument `-DGKFS_ENABLE_PROMETHEUS` and the daemon argument `--enable-prometheus`. The corresponding statistics are then pushed to the Prometheus instance. ### Rename `-DRENAME_SUPPORT` allows the application to rename files. This is an experimental feature, and some scenarios may not work properly. Support for fstat in renamed files is included. ### Acknowledgment This software was partially supported by the EC H2020 funded NEXTGenIO project (Project ID: 671951, www.nextgenio.eu). Loading
include/client/hooks.hpp +3 −0 Original line number Diff line number Diff line Loading @@ -120,6 +120,9 @@ hook_unlinkat(int dirfd, const char* cpath, int flags); int hook_symlinkat(const char* oldname, int newdfd, const char* newname); int hook_flock(unsigned long fd, int flags); int hook_access(const char* path, int mask); Loading
include/common/metadata.hpp +12 −0 Original line number Diff line number Diff line Loading @@ -53,6 +53,10 @@ private: blkcnt_t blocks_{}; // allocated file system blocks_ #ifdef HAS_SYMLINKS std::string target_path_; // For links this is the path of the target file #ifdef HAS_RENAME std::string rename_path_; // In some cases fd is maintained so we need the // renamed path #endif #endif Loading Loading @@ -133,6 +137,14 @@ public: bool is_link() const; #ifdef HAS_RENAME std::string rename_path() const; void rename_path(const std::string& rename_path); #endif #endif }; Loading
src/client/hooks.cpp +27 −0 Original line number Diff line number Diff line Loading @@ -178,6 +178,16 @@ hook_fstat(unsigned int fd, struct stat* buf) { if(CTX->file_map()->exist(fd)) { auto path = CTX->file_map()->get(fd)->path(); #ifdef HAS_RENAME // Special case for fstat and rename, fd points new file... // We can change file_map and recall auto md = gkfs::utils::get_metadata(path, false); if(md.has_value() and md.value().blocks() == -1) { path = md.value().rename_path(); std::cout << " Fstat " << path << std::endl; } #endif return with_errno(gkfs::syscall::gkfs_stat(path, buf)); } return syscall_no_intercept_wrapper(SYS_fstat, fd, buf); Loading Loading @@ -395,6 +405,16 @@ hook_symlinkat(const char* oldname, int newdfd, const char* newname) { } } int hook_flock(unsigned long fd, int flags) { LOG(ERROR, "{}() called flock (Not Supported) with fd: {}, flags: {}", __func__, fd, flags); if(CTX->file_map()->exist(fd)) { return 0; } else return -EBADF; } int hook_access(const char* path, int mask) { Loading Loading @@ -831,6 +851,13 @@ hook_fcntl(unsigned int fd, unsigned int cmd, unsigned long arg) { gkfs::filemap::OpenFile_flags::cloexec, (arg & FD_CLOEXEC)); return 0; case F_GETLK: LOG(ERROR, "{}() F_GETLK on fd (Not Supported) {}", __func__, fd); return 0; case F_SETLK: LOG(ERROR, "{}() F_SETLK on fd (Not Supported) {}", __func__, fd); return 0; default: LOG(ERROR, "{}() unrecognized command {} on fd {}", __func__, cmd, Loading