Loading .gitlab-ci.yml +1 −1 Original line number Diff line number Diff line Loading @@ -137,7 +137,7 @@ gkfs:integration: needs: ['gkfs'] parallel: matrix: - SUBTEST: [ data, status, syscalls, directories, operations, position, shell ] - SUBTEST: [ data, status, syscalls, directories, operations, position, shell, rename ] script: ## run tests Loading include/client/gkfs_functions.hpp +6 −1 Original line number Diff line number Diff line Loading @@ -41,7 +41,7 @@ struct linux_dirent64; namespace gkfs::syscall { int gkfs_open(const std::string& path, mode_t mode, int flags); gkfs_open(const std::string& path, mode_t mode, int flags, bool rename = false); int gkfs_create(const std::string& path, mode_t mode); Loading Loading @@ -149,6 +149,11 @@ gkfs_getdents64(unsigned int fd, struct linux_dirent64* dirp, int gkfs_rmdir(const std::string& path); int gkfs_rename(const std::string& old_path_resolved, const std::string& new_path_resolved); } // namespace gkfs::syscall // gkfs_getsingleserverdir is using extern "C" to demangle it for C usage Loading include/client/rpc/forward_metadata.hpp +4 −0 Original line number Diff line number Diff line Loading @@ -55,6 +55,10 @@ forward_create(const std::string& path, mode_t mode); int forward_stat(const std::string& path, std::string& attr); int forward_rename(const std::string& path, const std::string& path2, const gkfs::metadata::Metadata& md); int forward_remove(const std::string& path); Loading include/config.hpp +1 −1 Original line number Diff line number Diff line Loading @@ -66,7 +66,7 @@ constexpr auto use_atime = false; constexpr auto use_ctime = false; constexpr auto use_mtime = false; constexpr auto use_link_cnt = false; constexpr auto use_blocks = false; constexpr auto use_blocks = true; /* * If true, all chunks on the same host are removed during a metadata remove * rpc. This is a technical optimization that reduces the number of RPCs for Loading src/client/gkfs_functions.cpp +54 −3 Original line number Diff line number Diff line Loading @@ -130,7 +130,7 @@ namespace gkfs::syscall { * @return 0 on success, -1 on failure */ int gkfs_open(const std::string& path, mode_t mode, int flags) { gkfs_open(const std::string& path, mode_t mode, int flags, bool rename) { if(flags & O_PATH) { LOG(ERROR, "`O_PATH` flag is not supported"); Loading Loading @@ -172,6 +172,12 @@ gkfs_open(const std::string& path, mode_t mode, int flags) { return -1; } md = *md_; if(rename == false && md.blocks() == -1) { LOG(ERROR, "File is renamed '{}': '{}' - rename: {}", path, rename); return -1; } } else { LOG(ERROR, "Error creating file: '{}'", strerror(errno)); return -1; Loading Loading @@ -202,8 +208,25 @@ gkfs_open(const std::string& path, mode_t mode, int flags) { } return gkfs_open(md.target_path(), mode, flags); } /// The file is a renamed file, so we need to get the metadata of the /// original file. /// This does not work as we will check that this is a -1. if(!md.target_path().empty()) { LOG(ERROR, "File '{}' is renamed, reentering with '{}'", path, md.target_path()); return gkfs_open(md.target_path(), mode, flags, true); } #endif if(rename == false && md.blocks() == -1) { LOG(ERROR, "File '{}' is renamed __", path); errno = ENOENT; return -1; } if(S_ISDIR(md.mode())) { return gkfs_opendir(path); } Loading Loading @@ -309,6 +332,33 @@ gkfs_access(const std::string& path, const int mask, bool follow_links) { return 0; } /** * gkfs wrapper for rename() system calls * errno may be set * @param old_path * @param new_path * @return 0 on success, -1 on failure */ int gkfs_rename(const string& old_path, const string& new_path) { auto md = gkfs::utils::get_metadata(old_path, false); if(!md) { return -1; } auto md2 = gkfs::utils::get_metadata(new_path, false); if(md2) { return -1; } auto err = gkfs::rpc::forward_rename(old_path, new_path, md.value()); if(err) { errno = err; return -1; } return 0; } /** * gkfs wrapper for stat() system calls * errno may be set Loading @@ -320,7 +370,7 @@ gkfs_access(const std::string& path, const int mask, bool follow_links) { int gkfs_stat(const string& path, struct stat* buf, bool follow_links) { auto md = gkfs::utils::get_metadata(path, follow_links); if(!md) { if(!md or md.value().blocks() == -1) { return -1; } gkfs::utils::metadata_to_stat(path, *md, *buf); Loading @@ -344,7 +394,8 @@ int gkfs_statx(int dirfs, const std::string& path, int flags, unsigned int mask, struct statx* buf, bool follow_links) { auto md = gkfs::utils::get_metadata(path, follow_links); if(!md) { if(!md or md.value().blocks() == -1) { return -1; } Loading Loading
.gitlab-ci.yml +1 −1 Original line number Diff line number Diff line Loading @@ -137,7 +137,7 @@ gkfs:integration: needs: ['gkfs'] parallel: matrix: - SUBTEST: [ data, status, syscalls, directories, operations, position, shell ] - SUBTEST: [ data, status, syscalls, directories, operations, position, shell, rename ] script: ## run tests Loading
include/client/gkfs_functions.hpp +6 −1 Original line number Diff line number Diff line Loading @@ -41,7 +41,7 @@ struct linux_dirent64; namespace gkfs::syscall { int gkfs_open(const std::string& path, mode_t mode, int flags); gkfs_open(const std::string& path, mode_t mode, int flags, bool rename = false); int gkfs_create(const std::string& path, mode_t mode); Loading Loading @@ -149,6 +149,11 @@ gkfs_getdents64(unsigned int fd, struct linux_dirent64* dirp, int gkfs_rmdir(const std::string& path); int gkfs_rename(const std::string& old_path_resolved, const std::string& new_path_resolved); } // namespace gkfs::syscall // gkfs_getsingleserverdir is using extern "C" to demangle it for C usage Loading
include/client/rpc/forward_metadata.hpp +4 −0 Original line number Diff line number Diff line Loading @@ -55,6 +55,10 @@ forward_create(const std::string& path, mode_t mode); int forward_stat(const std::string& path, std::string& attr); int forward_rename(const std::string& path, const std::string& path2, const gkfs::metadata::Metadata& md); int forward_remove(const std::string& path); Loading
include/config.hpp +1 −1 Original line number Diff line number Diff line Loading @@ -66,7 +66,7 @@ constexpr auto use_atime = false; constexpr auto use_ctime = false; constexpr auto use_mtime = false; constexpr auto use_link_cnt = false; constexpr auto use_blocks = false; constexpr auto use_blocks = true; /* * If true, all chunks on the same host are removed during a metadata remove * rpc. This is a technical optimization that reduces the number of RPCs for Loading
src/client/gkfs_functions.cpp +54 −3 Original line number Diff line number Diff line Loading @@ -130,7 +130,7 @@ namespace gkfs::syscall { * @return 0 on success, -1 on failure */ int gkfs_open(const std::string& path, mode_t mode, int flags) { gkfs_open(const std::string& path, mode_t mode, int flags, bool rename) { if(flags & O_PATH) { LOG(ERROR, "`O_PATH` flag is not supported"); Loading Loading @@ -172,6 +172,12 @@ gkfs_open(const std::string& path, mode_t mode, int flags) { return -1; } md = *md_; if(rename == false && md.blocks() == -1) { LOG(ERROR, "File is renamed '{}': '{}' - rename: {}", path, rename); return -1; } } else { LOG(ERROR, "Error creating file: '{}'", strerror(errno)); return -1; Loading Loading @@ -202,8 +208,25 @@ gkfs_open(const std::string& path, mode_t mode, int flags) { } return gkfs_open(md.target_path(), mode, flags); } /// The file is a renamed file, so we need to get the metadata of the /// original file. /// This does not work as we will check that this is a -1. if(!md.target_path().empty()) { LOG(ERROR, "File '{}' is renamed, reentering with '{}'", path, md.target_path()); return gkfs_open(md.target_path(), mode, flags, true); } #endif if(rename == false && md.blocks() == -1) { LOG(ERROR, "File '{}' is renamed __", path); errno = ENOENT; return -1; } if(S_ISDIR(md.mode())) { return gkfs_opendir(path); } Loading Loading @@ -309,6 +332,33 @@ gkfs_access(const std::string& path, const int mask, bool follow_links) { return 0; } /** * gkfs wrapper for rename() system calls * errno may be set * @param old_path * @param new_path * @return 0 on success, -1 on failure */ int gkfs_rename(const string& old_path, const string& new_path) { auto md = gkfs::utils::get_metadata(old_path, false); if(!md) { return -1; } auto md2 = gkfs::utils::get_metadata(new_path, false); if(md2) { return -1; } auto err = gkfs::rpc::forward_rename(old_path, new_path, md.value()); if(err) { errno = err; return -1; } return 0; } /** * gkfs wrapper for stat() system calls * errno may be set Loading @@ -320,7 +370,7 @@ gkfs_access(const std::string& path, const int mask, bool follow_links) { int gkfs_stat(const string& path, struct stat* buf, bool follow_links) { auto md = gkfs::utils::get_metadata(path, follow_links); if(!md) { if(!md or md.value().blocks() == -1) { return -1; } gkfs::utils::metadata_to_stat(path, *md, *buf); Loading @@ -344,7 +394,8 @@ int gkfs_statx(int dirfs, const std::string& path, int flags, unsigned int mask, struct statx* buf, bool follow_links) { auto md = gkfs::utils::get_metadata(path, follow_links); if(!md) { if(!md or md.value().blocks() == -1) { return -1; } Loading