Loading CMakeLists.txt +6 −2 Original line number Diff line number Diff line Loading @@ -100,18 +100,22 @@ find_package(Threads REQUIRED) find_package(Date REQUIRED) set(RPC_PROTOCOL "ofi+tcp" CACHE STRING "Communication plugin used for RPCs") set(RPC_PROTOCOL "ofi+sockets" CACHE STRING "Communication plugin used for RPCs") set_property(CACHE RPC_PROTOCOL PROPERTY STRINGS "bmi+tcp" "ofi+sockets" "ofi+tcp" "ofi+verbs" "ofi+psm2" ) message(STATUS "[gekkofs] RPC protocol: '${RPC_PROTOCOL}'") option(USE_SHM "Use shared memory for intra-node communication" ON) option(USE_SHM "Use shared memory for intra-node communication" OFF) message(STATUS "[gekkofs] Shared-memory communication: ${USE_SHM}") option(CREATE_CHECK_PARENTS "Check parent directory existance before creating child node" ON) message(STATUS "Create checks parents: ${CREATE_CHECK_PARENTS}") option(SYMLINK_SUPPORT "Compile with support for symlinks" ON) if(SYMLINK_SUPPORT) add_definitions(-DHAS_SYMLINKS) Loading include/client/adafs_functions.hpp +2 −0 Original line number Diff line number Diff line Loading @@ -23,6 +23,8 @@ int adafs_open(const std::string& path, mode_t mode, int flags); int adafs_mk_node(const std::string& path, mode_t mode); int check_parent_dir(const std::string& path); int adafs_rm_node(const std::string& path); int adafs_access(const std::string& path, int mask, bool follow_links = true); Loading include/global/configure.hpp.in +1 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ #define RPC_PROTOCOL "@RPC_PROTOCOL@" #cmakedefine01 USE_SHM #cmakedefine01 CREATE_CHECK_PARENTS #define CHUNKSIZE 524288 // in bytes 512KB Loading scripts/dl_dep.sh +4 −4 Original line number Diff line number Diff line Loading @@ -268,14 +268,14 @@ if [[ ( "${DEPENDENCY}" == "" ) || ( "${DEPENDENCY}" == "ofi" ) ]]; then if [ "${NA_LAYER}" == "ofi" ] || [ "${NA_LAYER}" == "all" ]; then # No need to get libfabric for mogon2 as it is already installed if [[ ("${CLUSTER}" != "mogon2") ]]; then wgetdeps "libfabric" "https://github.com/ofiwg/libfabric/releases/download/v1.7.2/libfabric-1.7.2.tar.gz" & wgetdeps "libfabric" "https://github.com/ofiwg/libfabric/releases/download/v1.8.1/libfabric-1.8.1.tar.bz2" & fi fi fi # get Mercury if [[ ( "${DEPENDENCY}" == "" ) || ( "${DEPENDENCY}" == "mercury" ) ]]; then clonedeps "mercury" "https://github.com/mercury-hpc/mercury" "9906f25b6f9c52079d57006f199b3ea47960c435" "--recurse-submodules" & clonedeps "mercury" "https://github.com/mercury-hpc/mercury" "fd410dfb9852b2b98d21113531f3058f45bfcd64" "--recurse-submodules" & fi # get Argobots Loading @@ -285,12 +285,12 @@ fi # get Margo if [[ ( "${DEPENDENCY}" == "" ) || ( "${DEPENDENCY}" == "margo" ) ]]; then clonedeps "margo" "https://xgitlab.cels.anl.gov/sds/margo.git" "6ed94e4f3a4d526b0a3b4e57be075461e86d3666" & clonedeps "margo" "https://xgitlab.cels.anl.gov/sds/margo.git" "016dbdce22da3fe4f97b46c20a53bced9370a217" & fi # get rocksdb if [[ ( "${DEPENDENCY}" == "" ) || ( "${DEPENDENCY}" == "rocksdb" ) ]]; then wgetdeps "rocksdb" "https://github.com/facebook/rocksdb/archive/v6.1.2.tar.gz" & wgetdeps "rocksdb" "https://github.com/facebook/rocksdb/archive/v6.2.2.tar.gz" & fi # get syscall_intercept Loading src/client/adafs_functions.cpp +26 −24 Original line number Diff line number Diff line Loading @@ -89,7 +89,7 @@ int adafs_open(const std::string& path, mode_t mode, int flags) { // no access check required here. If one is using our FS they have the permissions. if(adafs_mk_node(path, mode | S_IFREG)) { LOG(ERROR, "Error creating non-existent file"); LOG(ERROR, "Error creating non-existent file: {}", strerror(errno)); return -1; } } else { Loading Loading @@ -131,6 +131,27 @@ int adafs_open(const std::string& path, mode_t mode, int flags) { return CTX->file_map()->add(std::make_shared<OpenFile>(path, flags)); } int check_parent_dir(const std::string& path) { #if CREATE_CHECK_PARENTS auto p_comp = dirname(path); auto md = adafs_metadata(p_comp); if (!md) { if (errno == ENOENT) { LOG(DEBUG, "Parent component does not exist: '{}'", p_comp); } else { LOG(ERROR, "Failed to get metadata for parent component '{}': {}", path, strerror(errno)); } return -1; } if (!S_ISDIR(md->mode())) { LOG(DEBUG, "Parent component is not a directory: '{}'", p_comp); errno = ENOTDIR; return -1; } #endif // CREATE_CHECK_PARENTS return 0; } int adafs_mk_node(const std::string& path, mode_t mode) { //file type must be set Loading @@ -154,18 +175,10 @@ int adafs_mk_node(const std::string& path, mode_t mode) { return -1; } auto p_comp = dirname(path); auto md = adafs_metadata(p_comp); if (!md) { LOG(DEBUG, "Parent component does not exist: '{}'", p_comp); errno = ENOENT; return -1; } if (!S_ISDIR(md->mode())) { LOG(DEBUG, "Parent component is not a directory: '{}'", p_comp); errno = ENOTDIR; if (check_parent_dir(path)) { return -1; } return rpc_send::mk_node(path, mode); } Loading Loading @@ -605,8 +618,6 @@ int getdents64(unsigned int fd, current_dirp->d_reclen = total_size; current_dirp->d_type = ((de.type() == FileType::regular)? DT_REG : DT_DIR); LOG(DEBUG, "name {}: {}", pos, de.name()); std::strcpy(&(current_dirp->d_name[0]), de.name().c_str()); ++pos; Loading Loading @@ -643,22 +654,13 @@ int adafs_mk_symlink(const std::string& path, const std::string& target_path) { } } auto p_comp = dirname(path); auto md = adafs_metadata(p_comp, false); if (md == nullptr) { LOG(DEBUG, "Parent component does not exist: '{}'", p_comp); errno = ENOENT; return -1; } if (!S_ISDIR(md->mode())) { LOG(DEBUG, "Parent component is not a directory: '{}'", p_comp); errno = ENOTDIR; if (check_parent_dir(path)) { return -1; } auto link_md = adafs_metadata(path, false); if (link_md != nullptr) { LOG(DEBUG, "Link exists: '{}'", p_comp); LOG(DEBUG, "Link exists: '{}'", path); errno = EEXIST; return -1; } Loading Loading
CMakeLists.txt +6 −2 Original line number Diff line number Diff line Loading @@ -100,18 +100,22 @@ find_package(Threads REQUIRED) find_package(Date REQUIRED) set(RPC_PROTOCOL "ofi+tcp" CACHE STRING "Communication plugin used for RPCs") set(RPC_PROTOCOL "ofi+sockets" CACHE STRING "Communication plugin used for RPCs") set_property(CACHE RPC_PROTOCOL PROPERTY STRINGS "bmi+tcp" "ofi+sockets" "ofi+tcp" "ofi+verbs" "ofi+psm2" ) message(STATUS "[gekkofs] RPC protocol: '${RPC_PROTOCOL}'") option(USE_SHM "Use shared memory for intra-node communication" ON) option(USE_SHM "Use shared memory for intra-node communication" OFF) message(STATUS "[gekkofs] Shared-memory communication: ${USE_SHM}") option(CREATE_CHECK_PARENTS "Check parent directory existance before creating child node" ON) message(STATUS "Create checks parents: ${CREATE_CHECK_PARENTS}") option(SYMLINK_SUPPORT "Compile with support for symlinks" ON) if(SYMLINK_SUPPORT) add_definitions(-DHAS_SYMLINKS) Loading
include/client/adafs_functions.hpp +2 −0 Original line number Diff line number Diff line Loading @@ -23,6 +23,8 @@ int adafs_open(const std::string& path, mode_t mode, int flags); int adafs_mk_node(const std::string& path, mode_t mode); int check_parent_dir(const std::string& path); int adafs_rm_node(const std::string& path); int adafs_access(const std::string& path, int mask, bool follow_links = true); Loading
include/global/configure.hpp.in +1 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ #define RPC_PROTOCOL "@RPC_PROTOCOL@" #cmakedefine01 USE_SHM #cmakedefine01 CREATE_CHECK_PARENTS #define CHUNKSIZE 524288 // in bytes 512KB Loading
scripts/dl_dep.sh +4 −4 Original line number Diff line number Diff line Loading @@ -268,14 +268,14 @@ if [[ ( "${DEPENDENCY}" == "" ) || ( "${DEPENDENCY}" == "ofi" ) ]]; then if [ "${NA_LAYER}" == "ofi" ] || [ "${NA_LAYER}" == "all" ]; then # No need to get libfabric for mogon2 as it is already installed if [[ ("${CLUSTER}" != "mogon2") ]]; then wgetdeps "libfabric" "https://github.com/ofiwg/libfabric/releases/download/v1.7.2/libfabric-1.7.2.tar.gz" & wgetdeps "libfabric" "https://github.com/ofiwg/libfabric/releases/download/v1.8.1/libfabric-1.8.1.tar.bz2" & fi fi fi # get Mercury if [[ ( "${DEPENDENCY}" == "" ) || ( "${DEPENDENCY}" == "mercury" ) ]]; then clonedeps "mercury" "https://github.com/mercury-hpc/mercury" "9906f25b6f9c52079d57006f199b3ea47960c435" "--recurse-submodules" & clonedeps "mercury" "https://github.com/mercury-hpc/mercury" "fd410dfb9852b2b98d21113531f3058f45bfcd64" "--recurse-submodules" & fi # get Argobots Loading @@ -285,12 +285,12 @@ fi # get Margo if [[ ( "${DEPENDENCY}" == "" ) || ( "${DEPENDENCY}" == "margo" ) ]]; then clonedeps "margo" "https://xgitlab.cels.anl.gov/sds/margo.git" "6ed94e4f3a4d526b0a3b4e57be075461e86d3666" & clonedeps "margo" "https://xgitlab.cels.anl.gov/sds/margo.git" "016dbdce22da3fe4f97b46c20a53bced9370a217" & fi # get rocksdb if [[ ( "${DEPENDENCY}" == "" ) || ( "${DEPENDENCY}" == "rocksdb" ) ]]; then wgetdeps "rocksdb" "https://github.com/facebook/rocksdb/archive/v6.1.2.tar.gz" & wgetdeps "rocksdb" "https://github.com/facebook/rocksdb/archive/v6.2.2.tar.gz" & fi # get syscall_intercept Loading
src/client/adafs_functions.cpp +26 −24 Original line number Diff line number Diff line Loading @@ -89,7 +89,7 @@ int adafs_open(const std::string& path, mode_t mode, int flags) { // no access check required here. If one is using our FS they have the permissions. if(adafs_mk_node(path, mode | S_IFREG)) { LOG(ERROR, "Error creating non-existent file"); LOG(ERROR, "Error creating non-existent file: {}", strerror(errno)); return -1; } } else { Loading Loading @@ -131,6 +131,27 @@ int adafs_open(const std::string& path, mode_t mode, int flags) { return CTX->file_map()->add(std::make_shared<OpenFile>(path, flags)); } int check_parent_dir(const std::string& path) { #if CREATE_CHECK_PARENTS auto p_comp = dirname(path); auto md = adafs_metadata(p_comp); if (!md) { if (errno == ENOENT) { LOG(DEBUG, "Parent component does not exist: '{}'", p_comp); } else { LOG(ERROR, "Failed to get metadata for parent component '{}': {}", path, strerror(errno)); } return -1; } if (!S_ISDIR(md->mode())) { LOG(DEBUG, "Parent component is not a directory: '{}'", p_comp); errno = ENOTDIR; return -1; } #endif // CREATE_CHECK_PARENTS return 0; } int adafs_mk_node(const std::string& path, mode_t mode) { //file type must be set Loading @@ -154,18 +175,10 @@ int adafs_mk_node(const std::string& path, mode_t mode) { return -1; } auto p_comp = dirname(path); auto md = adafs_metadata(p_comp); if (!md) { LOG(DEBUG, "Parent component does not exist: '{}'", p_comp); errno = ENOENT; return -1; } if (!S_ISDIR(md->mode())) { LOG(DEBUG, "Parent component is not a directory: '{}'", p_comp); errno = ENOTDIR; if (check_parent_dir(path)) { return -1; } return rpc_send::mk_node(path, mode); } Loading Loading @@ -605,8 +618,6 @@ int getdents64(unsigned int fd, current_dirp->d_reclen = total_size; current_dirp->d_type = ((de.type() == FileType::regular)? DT_REG : DT_DIR); LOG(DEBUG, "name {}: {}", pos, de.name()); std::strcpy(&(current_dirp->d_name[0]), de.name().c_str()); ++pos; Loading Loading @@ -643,22 +654,13 @@ int adafs_mk_symlink(const std::string& path, const std::string& target_path) { } } auto p_comp = dirname(path); auto md = adafs_metadata(p_comp, false); if (md == nullptr) { LOG(DEBUG, "Parent component does not exist: '{}'", p_comp); errno = ENOENT; return -1; } if (!S_ISDIR(md->mode())) { LOG(DEBUG, "Parent component is not a directory: '{}'", p_comp); errno = ENOTDIR; if (check_parent_dir(path)) { return -1; } auto link_md = adafs_metadata(path, false); if (link_md != nullptr) { LOG(DEBUG, "Link exists: '{}'", p_comp); LOG(DEBUG, "Link exists: '{}'", path); errno = EEXIST; return -1; } Loading