Loading include/common/rpc/rpc_types_thallium.hpp +72 −32 Original line number Diff line number Diff line Loading @@ -45,12 +45,23 @@ #include <thallium.hpp> #include <thallium/serialization/stl/string.hpp> #include <thallium/serialization/stl/vector.hpp> #include <common/trace.hpp> namespace tl = thallium; namespace gkfs::rpc { // misc generic rpc types struct rpc_trace_in_t { uint64_t trace_id{gkfs::trace::next()}; template <class Archive> void serialize(Archive& ar) { ar(trace_id); } }; struct rpc_err_out_t { int32_t err; Loading Loading @@ -87,22 +98,24 @@ struct rpc_mutate_detailed_status_out_t { struct rpc_mk_node_in_t { std::string path; uint32_t mode; uint64_t trace_id{gkfs::trace::next()}; template <class Archive> void serialize(Archive& ar) { ar(path, mode); ar(path, mode, trace_id); } }; struct rpc_batch_mk_node_in_t { std::vector<std::string> paths; std::vector<uint32_t> modes; uint64_t trace_id{gkfs::trace::next()}; template <class Archive> void serialize(Archive& ar) { ar(paths, modes); ar(paths, modes, trace_id); } }; Loading @@ -120,11 +133,12 @@ struct rpc_batch_mk_node_out_t { struct rpc_path_only_in_t { std::string path; bool include_inline; uint64_t trace_id{gkfs::trace::next()}; template <class Archive> void serialize(Archive& ar) { ar(path, include_inline); ar(path, include_inline, trace_id); } }; Loading Loading @@ -154,11 +168,12 @@ struct rpc_rm_node_in_t { std::string path; bool rm_dir; bool is_rename_stub; uint64_t trace_id{gkfs::trace::next()}; template <class Archive> void serialize(Archive& ar) { ar(path, rm_dir, is_rename_stub); ar(path, rm_dir, is_rename_stub, trace_id); } }; Loading @@ -178,11 +193,12 @@ struct rpc_rm_metadata_out_t { struct rpc_trunc_in_t { std::string path; uint64_t length; uint64_t trace_id{gkfs::trace::next()}; template <class Archive> void serialize(Archive& ar) { ar(path, length); ar(path, length, trace_id); } }; Loading @@ -204,13 +220,14 @@ struct rpc_update_metadentry_in_t { bool atime_flag; bool mtime_flag; bool ctime_flag; uint64_t trace_id{gkfs::trace::next()}; template <class Archive> void serialize(Archive& ar) { ar(path, nlink, mode, uid, gid, size, blocks, atime, mtime, ctime, nlink_flag, mode_flag, size_flag, block_flag, atime_flag, mtime_flag, ctime_flag); ctime_flag, trace_id); } }; Loading @@ -220,11 +237,12 @@ struct rpc_update_metadentry_size_in_t { int64_t offset; bool append; bool clear_inline; uint64_t trace_id{gkfs::trace::next()}; template <class Archive> void serialize(Archive& ar) { ar(path, size, offset, append, clear_inline); ar(path, size, offset, append, clear_inline, trace_id); } }; Loading Loading @@ -253,11 +271,12 @@ struct rpc_get_metadentry_size_out_t { struct rpc_mk_symlink_in_t { std::string path; std::string target_path; uint64_t trace_id{gkfs::trace::next()}; template <class Archive> void serialize(Archive& ar) { ar(path, target_path); ar(path, target_path, trace_id); } }; Loading @@ -265,11 +284,12 @@ struct rpc_rename_in_t { std::string path; std::string target_path; bool renamed_stub; // ?? boolean uint64_t trace_id{gkfs::trace::next()}; template <class Archive> void serialize(Archive& ar) { ar(path, target_path, renamed_stub); ar(path, target_path, renamed_stub, trace_id); } }; Loading @@ -284,6 +304,7 @@ struct rpc_read_data_in_t { uint64_t chunk_start; uint64_t chunk_end; uint64_t total_chunk_size; uint64_t trace_id{gkfs::trace::next()}; tl::bulk bulk_handle; // SERIALIZATION OF BULK HANDLE? // Thallium bulk handles generally need to be exposed. // But here we are defining the input struct. Loading @@ -295,7 +316,7 @@ struct rpc_read_data_in_t { void serialize(Archive& ar) { ar(path, offset, host_id, host_size, wbitset, chunk_n, chunk_start, chunk_end, total_chunk_size, bulk_handle); chunk_end, total_chunk_size, trace_id, bulk_handle); } }; Loading @@ -321,25 +342,27 @@ struct rpc_write_data_in_t { uint64_t chunk_end; uint64_t total_chunk_size; bool migration{false}; uint64_t trace_id{gkfs::trace::next()}; tl::bulk bulk_handle; template <class Archive> void serialize(Archive& ar) { ar(path, offset, host_id, host_size, wbitset, chunk_n, chunk_start, chunk_end, total_chunk_size, migration, bulk_handle); chunk_end, total_chunk_size, migration, trace_id, bulk_handle); } }; struct rpc_get_dirents_in_t { std::string path; std::string start_key; uint64_t trace_id{gkfs::trace::next()}; tl::bulk bulk_handle; template <class Archive> void serialize(Archive& ar) { ar(path, start_key, bulk_handle); ar(path, start_key, trace_id, bulk_handle); } }; Loading @@ -357,17 +380,18 @@ struct rpc_get_dirents_out_t { struct rpc_get_dirents_filtered_in_t { std::string path; std::string start_key; tl::bulk bulk_handle; std::string filter_name; int64_t filter_size; int64_t filter_ctime; bool count_only; uint64_t trace_id{gkfs::trace::next()}; tl::bulk bulk_handle; template <class Archive> void serialize(Archive& ar) { ar(path, start_key, bulk_handle, filter_name, filter_size, filter_ctime, count_only); ar(path, start_key, filter_name, filter_size, filter_ctime, count_only, trace_id, bulk_handle); } }; Loading Loading @@ -406,11 +430,12 @@ struct rpc_config_out_t { struct rpc_chunk_stat_in_t { int32_t dummy; uint64_t trace_id{gkfs::trace::next()}; template <class Archive> void serialize(Archive& ar) { ar(dummy); ar(dummy, trace_id); } }; Loading Loading @@ -440,13 +465,14 @@ struct rpc_proxy_daemon_write_in_t { uint64_t chunk_start; uint64_t chunk_end; uint64_t total_chunk_size; uint64_t trace_id{gkfs::trace::next()}; tl::bulk bulk_handle; template <class Archive> void serialize(Archive& ar) { ar(path, offset, host_id, host_size, chunk_n, chunk_start, chunk_end, total_chunk_size, bulk_handle); total_chunk_size, trace_id, bulk_handle); } }; Loading @@ -459,13 +485,14 @@ struct rpc_proxy_daemon_read_in_t { uint64_t chunk_start; uint64_t chunk_end; uint64_t total_chunk_size; uint64_t trace_id{gkfs::trace::next()}; tl::bulk bulk_handle; template <class Archive> void serialize(Archive& ar) { ar(path, offset, host_id, host_size, chunk_n, chunk_start, chunk_end, total_chunk_size, bulk_handle); total_chunk_size, trace_id, bulk_handle); } }; Loading @@ -474,29 +501,32 @@ struct rpc_mutate_start_in_t { uint32_t old_server_conf; uint32_t new_server_conf; std::string new_hosts_file; uint64_t trace_id{gkfs::trace::next()}; template <class Archive> void serialize(Archive& ar) { ar(old_server_conf, new_server_conf, new_hosts_file); ar(old_server_conf, new_server_conf, new_hosts_file, trace_id); } }; struct rpc_mutate_reload_in_t { std::string hosts_file; uint64_t trace_id{gkfs::trace::next()}; template <class Archive> void serialize(Archive& ar) { ar(hosts_file); ar(hosts_file, trace_id); } }; struct rpc_migrate_metadata_in_t { std::string key; std::string value; uint64_t trace_id{gkfs::trace::next()}; template <class Archive> void serialize(Archive& ar) { ar(key, value); ar(key, value, trace_id); } }; Loading @@ -507,11 +537,12 @@ struct rpc_write_inline_in_t { std::string data; // rpc_inline_data_t -> string uint64_t count; bool append; uint64_t trace_id{gkfs::trace::next()}; template <class Archive> void serialize(Archive& ar) { ar(path, offset, data, count, append); ar(path, offset, data, count, append, trace_id); } }; Loading @@ -538,17 +569,18 @@ struct rpc_create_write_inline_in_t { uint32_t mode; std::vector<char> data; uint64_t count; uint64_t trace_id{gkfs::trace::next()}; template <typename Archive> void save(Archive& ar) const { ar(path, mode, data, count); ar(path, mode, data, count, trace_id); } template <typename Archive> void load(Archive& ar) { ar(path, mode, data, count); ar(path, mode, data, count, trace_id); } }; Loading @@ -573,11 +605,12 @@ struct rpc_read_inline_in_t { std::string path; uint64_t offset; uint64_t count; uint64_t trace_id{gkfs::trace::next()}; template <class Archive> void serialize(Archive& ar) { ar(path, offset, count); ar(path, offset, count, trace_id); } }; Loading @@ -597,12 +630,13 @@ struct rpc_client_proxy_write_in_t { std::string path; int64_t offset; uint64_t write_size; uint64_t trace_id{gkfs::trace::next()}; tl::bulk bulk_handle; template <class Archive> void serialize(Archive& ar) { ar(path, offset, write_size, bulk_handle); ar(path, offset, write_size, trace_id, bulk_handle); } }; Loading @@ -610,12 +644,13 @@ struct rpc_client_proxy_read_in_t { std::string path; int64_t offset; uint64_t read_size; uint64_t trace_id{gkfs::trace::next()}; tl::bulk bulk_handle; template <class Archive> void serialize(Archive& ar) { ar(path, offset, read_size, bulk_handle); ar(path, offset, read_size, trace_id, bulk_handle); } }; Loading @@ -623,11 +658,12 @@ struct rpc_client_proxy_trunc_in_t { std::string path; uint64_t current_size; uint64_t new_size; uint64_t trace_id{gkfs::trace::next()}; template <class Archive> void serialize(Archive& ar) { ar(path, current_size, new_size); ar(path, current_size, new_size, trace_id); } }; Loading @@ -635,32 +671,35 @@ struct rpc_client_proxy_get_dirents_in_t { std::string path; int32_t server_id; std::string start_key; uint64_t trace_id{gkfs::trace::next()}; tl::bulk bulk_handle; template <class Archive> void serialize(Archive& ar) { ar(path, server_id, start_key, bulk_handle); ar(path, server_id, start_key, trace_id, bulk_handle); } }; struct rpc_client_proxy_stat_in_t { std::string path; uint64_t trace_id{gkfs::trace::next()}; template <class Archive> void serialize(Archive& ar) { ar(path); ar(path, trace_id); } }; struct rpc_client_proxy_get_size_in_t { std::string path; uint64_t trace_id{gkfs::trace::next()}; template <class Archive> void serialize(Archive& ar) { ar(path); ar(path, trace_id); } }; Loading @@ -669,11 +708,12 @@ struct rpc_client_proxy_update_size_in_t { uint64_t size; int64_t offset; bool append; uint64_t trace_id{gkfs::trace::next()}; template <class Archive> void serialize(Archive& ar) { ar(path, size, offset, append); ar(path, size, offset, append, trace_id); } }; Loading src/client/gkfs_functions.cpp +4 −42 Original line number Diff line number Diff line Loading @@ -263,49 +263,11 @@ gkfs_utimensat(const std::string& path, const struct timespec times[2]) { errno = ENOENT; return -1; } auto resolved_path = path; gkfs::metadata::Metadata md{}; gkfs::metadata::MetadentryUpdateFlags flags{}; // Protocol: times[0] = atime, times[1] = mtime // If times is NULL, both are set to current time // If times is not NULL, check UTIME_NOW and UTIME_OMIT time_t current_time = std::time(nullptr); if(times == nullptr) { md.atime(current_time); flags.atime = true; md.mtime(current_time); flags.mtime = true; } else { // atime if(times[0].tv_nsec != UTIME_OMIT) { flags.atime = true; if(times[0].tv_nsec == UTIME_NOW) { md.atime(current_time); } else { md.atime(times[0].tv_sec); } } // mtime if(times[1].tv_nsec != UTIME_OMIT) { flags.mtime = true; if(times[1].tv_nsec == UTIME_NOW) { md.mtime(current_time); } else { md.mtime(times[1].tv_sec); } } } if(!flags.atime && !flags.mtime) { return 0; // Nothing to update } return gkfs::rpc::forward_update_metadentry(resolved_path, md, flags, 0); LOG(WARNING, "{}() utimensat on GekkoFS path '{}' ignored; returning success", __func__, path); return 0; } std::tuple<int, Loading src/client/gkfs_libc.cpp +11 −12 Original line number Diff line number Diff line Loading @@ -2431,10 +2431,10 @@ chmod(const char* path, mode_t mode) throw() { std::string resolved; if(resolve_gkfs_path(AT_FDCWD, path, resolved) == PathStatus::Internal) { LOG(WARNING, "{}() chmod is not supported for GekkoFS paths", LOG(WARNING, "{}() chmod on GekkoFS path ignored; returning success", __func__); errno = ENOTSUP; return -1; return 0; } if(errno != 0 && (errno == ENOTDIR || errno == EBADF)) return -1; Loading @@ -2446,10 +2446,9 @@ int fchmod(int fd, mode_t mode) throw() { gkfs_init_routine_placeholder(); if(CTX->interception_enabled() && is_gkfs_fd(fd)) { LOG(WARNING, "{}() chmod is not supported for GekkoFS fd '{}'", LOG(WARNING, "{}() chmod on GekkoFS fd '{}' ignored; returning success", __func__, fd); errno = ENOTSUP; return -1; return 0; } GKFS_FALLBACK(fchmod, fd, mode); } Loading @@ -2465,10 +2464,10 @@ fchmodat(int dfd, const char* path, mode_t mode, int flags) throw() { int resolve_flags = (flags & AT_EMPTY_PATH); if(resolve_gkfs_path(dfd, path, resolved, resolve_flags, follow) == PathStatus::Internal) { LOG(WARNING, "{}() chmod is not supported for GekkoFS paths", LOG(WARNING, "{}() chmod on GekkoFS path ignored; returning success", __func__); errno = ENOTSUP; return -1; return 0; } if(errno != 0 && (errno == ENOTDIR || errno == EBADF)) return -1; Loading @@ -2489,10 +2488,10 @@ __fchmodat(int dfd, const char* path, mode_t mode, int flags) throw() { int resolve_flags = (flags & AT_EMPTY_PATH); if(resolve_gkfs_path(dfd, path, resolved, resolve_flags, follow) == PathStatus::Internal) { LOG(WARNING, "__fchmodat is not supported for GekkoFS paths", LOG(WARNING, "{}() chmod on GekkoFS path ignored; returning success", __func__); errno = ENOTSUP; return -1; return 0; } if(errno != 0 && (errno == ENOTDIR || errno == EBADF)) return -1; Loading src/client/hooks.cpp +8 −9 Original line number Diff line number Diff line Loading @@ -907,9 +907,9 @@ hook_fchmodat(int dirfd, const char* cpath, mode_t mode, int flags) { std::string resolved; const auto rstatus = CTX->relativize_fd_path(dirfd, cpath, resolved, false); if(rstatus == gkfs::preload::RelativizeStatus::internal) { LOG(WARNING, "{}() chmod is not supported for GekkoFS paths", __func__); errno = ENOTSUP; return -1; LOG(WARNING, "{}() chmod on GekkoFS path ignored; returning success", __func__); return 0; } if(rstatus == gkfs::preload::RelativizeStatus::fd_not_a_dir) { return -ENOTDIR; Loading @@ -923,10 +923,9 @@ hook_fchmod(unsigned int fd, mode_t mode) { LOG(DEBUG, "{}() called with fd: {}, mode: {}", __func__, fd, mode); if(CTX->file_map()->exist(fd)) { LOG(WARNING, "{}() chmod is not supported for GekkoFS fd '{}'", LOG(WARNING, "{}() chmod on GekkoFS fd '{}' ignored; returning success", __func__, fd); errno = ENOTSUP; return -1; return 0; } return syscall_no_intercept_wrapper(SYS_fchmod, fd, mode); } Loading @@ -940,9 +939,9 @@ hook_chmod(const char* path, mode_t mode) { LOG(DEBUG, "{}() called with path: \"{}\", mode: {}", __func__, path, mode); std::string resolved; if(CTX->relativize_path(path, resolved)) { LOG(WARNING, "{}() chmod is not supported for GekkoFS paths", __func__); errno = ENOTSUP; return -1; LOG(WARNING, "{}() chmod on GekkoFS path ignored; returning success", __func__); return 0; } return syscall_no_intercept_wrapper(SYS_chmod, path, mode); } Loading src/proxy/rpc/srv_data.cpp +25 −1 Original line number Diff line number Diff line Loading @@ -28,6 +28,7 @@ #include <common/rpc/rpc_types_thallium.hpp> #include <common/rpc/handler_util.hpp> #include <common/trace.hpp> using namespace std; using namespace gkfs::rpc; Loading @@ -35,7 +36,12 @@ using namespace gkfs::rpc; void proxy_rpc_srv_write(const tl::request& req, const gkfs::rpc::rpc_client_proxy_write_in_t& in) { const gkfs::trace::Scope trace_scope{in.trace_id}; if(in.trace_id != 0) { PROXY_DATA->log()->debug( "trace_event=proxy_rpc_start trace_id={} rpc_name={}", in.trace_id, __func__); } rpc_data_out_t out{}; out.err = EIO; out.io_size = 0; Loading Loading @@ -85,11 +91,22 @@ proxy_rpc_srv_write(const tl::request& req, } gkfs::utils::safe_respond(req, out, __func__); if(in.trace_id != 0) { PROXY_DATA->log()->debug( "trace_event=proxy_rpc_end trace_id={} rpc_name={} err={}", in.trace_id, __func__, out.err); } } void proxy_rpc_srv_read(const tl::request& req, const gkfs::rpc::rpc_client_proxy_read_in_t& in) { const gkfs::trace::Scope trace_scope{in.trace_id}; if(in.trace_id != 0) { PROXY_DATA->log()->debug( "trace_event=proxy_rpc_start trace_id={} rpc_name={}", in.trace_id, __func__); } rpc_data_out_t out{}; out.err = EIO; out.io_size = 0; Loading Loading @@ -149,11 +166,17 @@ proxy_rpc_srv_read(const tl::request& req, } gkfs::utils::safe_respond(req, out, __func__); if(in.trace_id != 0) { PROXY_DATA->log()->debug( "trace_event=proxy_rpc_end trace_id={} rpc_name={} err={}", in.trace_id, __func__, out.err); } } void proxy_rpc_srv_truncate(const tl::request& req, const gkfs::rpc::rpc_client_proxy_trunc_in_t& in) { const gkfs::trace::Scope trace_scope{in.trace_id}; rpc_err_out_t out{}; PROXY_DATA->log()->debug( Loading @@ -179,6 +202,7 @@ proxy_rpc_srv_truncate(const tl::request& req, void proxy_rpc_srv_chunk_stat(const tl::request& req, const gkfs::rpc::rpc_chunk_stat_in_t& in) { const gkfs::trace::Scope trace_scope{in.trace_id}; rpc_chunk_stat_out_t out{}; PROXY_DATA->log()->debug("{}() Got chunk stat RPC ", __func__); Loading Loading
include/common/rpc/rpc_types_thallium.hpp +72 −32 Original line number Diff line number Diff line Loading @@ -45,12 +45,23 @@ #include <thallium.hpp> #include <thallium/serialization/stl/string.hpp> #include <thallium/serialization/stl/vector.hpp> #include <common/trace.hpp> namespace tl = thallium; namespace gkfs::rpc { // misc generic rpc types struct rpc_trace_in_t { uint64_t trace_id{gkfs::trace::next()}; template <class Archive> void serialize(Archive& ar) { ar(trace_id); } }; struct rpc_err_out_t { int32_t err; Loading Loading @@ -87,22 +98,24 @@ struct rpc_mutate_detailed_status_out_t { struct rpc_mk_node_in_t { std::string path; uint32_t mode; uint64_t trace_id{gkfs::trace::next()}; template <class Archive> void serialize(Archive& ar) { ar(path, mode); ar(path, mode, trace_id); } }; struct rpc_batch_mk_node_in_t { std::vector<std::string> paths; std::vector<uint32_t> modes; uint64_t trace_id{gkfs::trace::next()}; template <class Archive> void serialize(Archive& ar) { ar(paths, modes); ar(paths, modes, trace_id); } }; Loading @@ -120,11 +133,12 @@ struct rpc_batch_mk_node_out_t { struct rpc_path_only_in_t { std::string path; bool include_inline; uint64_t trace_id{gkfs::trace::next()}; template <class Archive> void serialize(Archive& ar) { ar(path, include_inline); ar(path, include_inline, trace_id); } }; Loading Loading @@ -154,11 +168,12 @@ struct rpc_rm_node_in_t { std::string path; bool rm_dir; bool is_rename_stub; uint64_t trace_id{gkfs::trace::next()}; template <class Archive> void serialize(Archive& ar) { ar(path, rm_dir, is_rename_stub); ar(path, rm_dir, is_rename_stub, trace_id); } }; Loading @@ -178,11 +193,12 @@ struct rpc_rm_metadata_out_t { struct rpc_trunc_in_t { std::string path; uint64_t length; uint64_t trace_id{gkfs::trace::next()}; template <class Archive> void serialize(Archive& ar) { ar(path, length); ar(path, length, trace_id); } }; Loading @@ -204,13 +220,14 @@ struct rpc_update_metadentry_in_t { bool atime_flag; bool mtime_flag; bool ctime_flag; uint64_t trace_id{gkfs::trace::next()}; template <class Archive> void serialize(Archive& ar) { ar(path, nlink, mode, uid, gid, size, blocks, atime, mtime, ctime, nlink_flag, mode_flag, size_flag, block_flag, atime_flag, mtime_flag, ctime_flag); ctime_flag, trace_id); } }; Loading @@ -220,11 +237,12 @@ struct rpc_update_metadentry_size_in_t { int64_t offset; bool append; bool clear_inline; uint64_t trace_id{gkfs::trace::next()}; template <class Archive> void serialize(Archive& ar) { ar(path, size, offset, append, clear_inline); ar(path, size, offset, append, clear_inline, trace_id); } }; Loading Loading @@ -253,11 +271,12 @@ struct rpc_get_metadentry_size_out_t { struct rpc_mk_symlink_in_t { std::string path; std::string target_path; uint64_t trace_id{gkfs::trace::next()}; template <class Archive> void serialize(Archive& ar) { ar(path, target_path); ar(path, target_path, trace_id); } }; Loading @@ -265,11 +284,12 @@ struct rpc_rename_in_t { std::string path; std::string target_path; bool renamed_stub; // ?? boolean uint64_t trace_id{gkfs::trace::next()}; template <class Archive> void serialize(Archive& ar) { ar(path, target_path, renamed_stub); ar(path, target_path, renamed_stub, trace_id); } }; Loading @@ -284,6 +304,7 @@ struct rpc_read_data_in_t { uint64_t chunk_start; uint64_t chunk_end; uint64_t total_chunk_size; uint64_t trace_id{gkfs::trace::next()}; tl::bulk bulk_handle; // SERIALIZATION OF BULK HANDLE? // Thallium bulk handles generally need to be exposed. // But here we are defining the input struct. Loading @@ -295,7 +316,7 @@ struct rpc_read_data_in_t { void serialize(Archive& ar) { ar(path, offset, host_id, host_size, wbitset, chunk_n, chunk_start, chunk_end, total_chunk_size, bulk_handle); chunk_end, total_chunk_size, trace_id, bulk_handle); } }; Loading @@ -321,25 +342,27 @@ struct rpc_write_data_in_t { uint64_t chunk_end; uint64_t total_chunk_size; bool migration{false}; uint64_t trace_id{gkfs::trace::next()}; tl::bulk bulk_handle; template <class Archive> void serialize(Archive& ar) { ar(path, offset, host_id, host_size, wbitset, chunk_n, chunk_start, chunk_end, total_chunk_size, migration, bulk_handle); chunk_end, total_chunk_size, migration, trace_id, bulk_handle); } }; struct rpc_get_dirents_in_t { std::string path; std::string start_key; uint64_t trace_id{gkfs::trace::next()}; tl::bulk bulk_handle; template <class Archive> void serialize(Archive& ar) { ar(path, start_key, bulk_handle); ar(path, start_key, trace_id, bulk_handle); } }; Loading @@ -357,17 +380,18 @@ struct rpc_get_dirents_out_t { struct rpc_get_dirents_filtered_in_t { std::string path; std::string start_key; tl::bulk bulk_handle; std::string filter_name; int64_t filter_size; int64_t filter_ctime; bool count_only; uint64_t trace_id{gkfs::trace::next()}; tl::bulk bulk_handle; template <class Archive> void serialize(Archive& ar) { ar(path, start_key, bulk_handle, filter_name, filter_size, filter_ctime, count_only); ar(path, start_key, filter_name, filter_size, filter_ctime, count_only, trace_id, bulk_handle); } }; Loading Loading @@ -406,11 +430,12 @@ struct rpc_config_out_t { struct rpc_chunk_stat_in_t { int32_t dummy; uint64_t trace_id{gkfs::trace::next()}; template <class Archive> void serialize(Archive& ar) { ar(dummy); ar(dummy, trace_id); } }; Loading Loading @@ -440,13 +465,14 @@ struct rpc_proxy_daemon_write_in_t { uint64_t chunk_start; uint64_t chunk_end; uint64_t total_chunk_size; uint64_t trace_id{gkfs::trace::next()}; tl::bulk bulk_handle; template <class Archive> void serialize(Archive& ar) { ar(path, offset, host_id, host_size, chunk_n, chunk_start, chunk_end, total_chunk_size, bulk_handle); total_chunk_size, trace_id, bulk_handle); } }; Loading @@ -459,13 +485,14 @@ struct rpc_proxy_daemon_read_in_t { uint64_t chunk_start; uint64_t chunk_end; uint64_t total_chunk_size; uint64_t trace_id{gkfs::trace::next()}; tl::bulk bulk_handle; template <class Archive> void serialize(Archive& ar) { ar(path, offset, host_id, host_size, chunk_n, chunk_start, chunk_end, total_chunk_size, bulk_handle); total_chunk_size, trace_id, bulk_handle); } }; Loading @@ -474,29 +501,32 @@ struct rpc_mutate_start_in_t { uint32_t old_server_conf; uint32_t new_server_conf; std::string new_hosts_file; uint64_t trace_id{gkfs::trace::next()}; template <class Archive> void serialize(Archive& ar) { ar(old_server_conf, new_server_conf, new_hosts_file); ar(old_server_conf, new_server_conf, new_hosts_file, trace_id); } }; struct rpc_mutate_reload_in_t { std::string hosts_file; uint64_t trace_id{gkfs::trace::next()}; template <class Archive> void serialize(Archive& ar) { ar(hosts_file); ar(hosts_file, trace_id); } }; struct rpc_migrate_metadata_in_t { std::string key; std::string value; uint64_t trace_id{gkfs::trace::next()}; template <class Archive> void serialize(Archive& ar) { ar(key, value); ar(key, value, trace_id); } }; Loading @@ -507,11 +537,12 @@ struct rpc_write_inline_in_t { std::string data; // rpc_inline_data_t -> string uint64_t count; bool append; uint64_t trace_id{gkfs::trace::next()}; template <class Archive> void serialize(Archive& ar) { ar(path, offset, data, count, append); ar(path, offset, data, count, append, trace_id); } }; Loading @@ -538,17 +569,18 @@ struct rpc_create_write_inline_in_t { uint32_t mode; std::vector<char> data; uint64_t count; uint64_t trace_id{gkfs::trace::next()}; template <typename Archive> void save(Archive& ar) const { ar(path, mode, data, count); ar(path, mode, data, count, trace_id); } template <typename Archive> void load(Archive& ar) { ar(path, mode, data, count); ar(path, mode, data, count, trace_id); } }; Loading @@ -573,11 +605,12 @@ struct rpc_read_inline_in_t { std::string path; uint64_t offset; uint64_t count; uint64_t trace_id{gkfs::trace::next()}; template <class Archive> void serialize(Archive& ar) { ar(path, offset, count); ar(path, offset, count, trace_id); } }; Loading @@ -597,12 +630,13 @@ struct rpc_client_proxy_write_in_t { std::string path; int64_t offset; uint64_t write_size; uint64_t trace_id{gkfs::trace::next()}; tl::bulk bulk_handle; template <class Archive> void serialize(Archive& ar) { ar(path, offset, write_size, bulk_handle); ar(path, offset, write_size, trace_id, bulk_handle); } }; Loading @@ -610,12 +644,13 @@ struct rpc_client_proxy_read_in_t { std::string path; int64_t offset; uint64_t read_size; uint64_t trace_id{gkfs::trace::next()}; tl::bulk bulk_handle; template <class Archive> void serialize(Archive& ar) { ar(path, offset, read_size, bulk_handle); ar(path, offset, read_size, trace_id, bulk_handle); } }; Loading @@ -623,11 +658,12 @@ struct rpc_client_proxy_trunc_in_t { std::string path; uint64_t current_size; uint64_t new_size; uint64_t trace_id{gkfs::trace::next()}; template <class Archive> void serialize(Archive& ar) { ar(path, current_size, new_size); ar(path, current_size, new_size, trace_id); } }; Loading @@ -635,32 +671,35 @@ struct rpc_client_proxy_get_dirents_in_t { std::string path; int32_t server_id; std::string start_key; uint64_t trace_id{gkfs::trace::next()}; tl::bulk bulk_handle; template <class Archive> void serialize(Archive& ar) { ar(path, server_id, start_key, bulk_handle); ar(path, server_id, start_key, trace_id, bulk_handle); } }; struct rpc_client_proxy_stat_in_t { std::string path; uint64_t trace_id{gkfs::trace::next()}; template <class Archive> void serialize(Archive& ar) { ar(path); ar(path, trace_id); } }; struct rpc_client_proxy_get_size_in_t { std::string path; uint64_t trace_id{gkfs::trace::next()}; template <class Archive> void serialize(Archive& ar) { ar(path); ar(path, trace_id); } }; Loading @@ -669,11 +708,12 @@ struct rpc_client_proxy_update_size_in_t { uint64_t size; int64_t offset; bool append; uint64_t trace_id{gkfs::trace::next()}; template <class Archive> void serialize(Archive& ar) { ar(path, size, offset, append); ar(path, size, offset, append, trace_id); } }; Loading
src/client/gkfs_functions.cpp +4 −42 Original line number Diff line number Diff line Loading @@ -263,49 +263,11 @@ gkfs_utimensat(const std::string& path, const struct timespec times[2]) { errno = ENOENT; return -1; } auto resolved_path = path; gkfs::metadata::Metadata md{}; gkfs::metadata::MetadentryUpdateFlags flags{}; // Protocol: times[0] = atime, times[1] = mtime // If times is NULL, both are set to current time // If times is not NULL, check UTIME_NOW and UTIME_OMIT time_t current_time = std::time(nullptr); if(times == nullptr) { md.atime(current_time); flags.atime = true; md.mtime(current_time); flags.mtime = true; } else { // atime if(times[0].tv_nsec != UTIME_OMIT) { flags.atime = true; if(times[0].tv_nsec == UTIME_NOW) { md.atime(current_time); } else { md.atime(times[0].tv_sec); } } // mtime if(times[1].tv_nsec != UTIME_OMIT) { flags.mtime = true; if(times[1].tv_nsec == UTIME_NOW) { md.mtime(current_time); } else { md.mtime(times[1].tv_sec); } } } if(!flags.atime && !flags.mtime) { return 0; // Nothing to update } return gkfs::rpc::forward_update_metadentry(resolved_path, md, flags, 0); LOG(WARNING, "{}() utimensat on GekkoFS path '{}' ignored; returning success", __func__, path); return 0; } std::tuple<int, Loading
src/client/gkfs_libc.cpp +11 −12 Original line number Diff line number Diff line Loading @@ -2431,10 +2431,10 @@ chmod(const char* path, mode_t mode) throw() { std::string resolved; if(resolve_gkfs_path(AT_FDCWD, path, resolved) == PathStatus::Internal) { LOG(WARNING, "{}() chmod is not supported for GekkoFS paths", LOG(WARNING, "{}() chmod on GekkoFS path ignored; returning success", __func__); errno = ENOTSUP; return -1; return 0; } if(errno != 0 && (errno == ENOTDIR || errno == EBADF)) return -1; Loading @@ -2446,10 +2446,9 @@ int fchmod(int fd, mode_t mode) throw() { gkfs_init_routine_placeholder(); if(CTX->interception_enabled() && is_gkfs_fd(fd)) { LOG(WARNING, "{}() chmod is not supported for GekkoFS fd '{}'", LOG(WARNING, "{}() chmod on GekkoFS fd '{}' ignored; returning success", __func__, fd); errno = ENOTSUP; return -1; return 0; } GKFS_FALLBACK(fchmod, fd, mode); } Loading @@ -2465,10 +2464,10 @@ fchmodat(int dfd, const char* path, mode_t mode, int flags) throw() { int resolve_flags = (flags & AT_EMPTY_PATH); if(resolve_gkfs_path(dfd, path, resolved, resolve_flags, follow) == PathStatus::Internal) { LOG(WARNING, "{}() chmod is not supported for GekkoFS paths", LOG(WARNING, "{}() chmod on GekkoFS path ignored; returning success", __func__); errno = ENOTSUP; return -1; return 0; } if(errno != 0 && (errno == ENOTDIR || errno == EBADF)) return -1; Loading @@ -2489,10 +2488,10 @@ __fchmodat(int dfd, const char* path, mode_t mode, int flags) throw() { int resolve_flags = (flags & AT_EMPTY_PATH); if(resolve_gkfs_path(dfd, path, resolved, resolve_flags, follow) == PathStatus::Internal) { LOG(WARNING, "__fchmodat is not supported for GekkoFS paths", LOG(WARNING, "{}() chmod on GekkoFS path ignored; returning success", __func__); errno = ENOTSUP; return -1; return 0; } if(errno != 0 && (errno == ENOTDIR || errno == EBADF)) return -1; Loading
src/client/hooks.cpp +8 −9 Original line number Diff line number Diff line Loading @@ -907,9 +907,9 @@ hook_fchmodat(int dirfd, const char* cpath, mode_t mode, int flags) { std::string resolved; const auto rstatus = CTX->relativize_fd_path(dirfd, cpath, resolved, false); if(rstatus == gkfs::preload::RelativizeStatus::internal) { LOG(WARNING, "{}() chmod is not supported for GekkoFS paths", __func__); errno = ENOTSUP; return -1; LOG(WARNING, "{}() chmod on GekkoFS path ignored; returning success", __func__); return 0; } if(rstatus == gkfs::preload::RelativizeStatus::fd_not_a_dir) { return -ENOTDIR; Loading @@ -923,10 +923,9 @@ hook_fchmod(unsigned int fd, mode_t mode) { LOG(DEBUG, "{}() called with fd: {}, mode: {}", __func__, fd, mode); if(CTX->file_map()->exist(fd)) { LOG(WARNING, "{}() chmod is not supported for GekkoFS fd '{}'", LOG(WARNING, "{}() chmod on GekkoFS fd '{}' ignored; returning success", __func__, fd); errno = ENOTSUP; return -1; return 0; } return syscall_no_intercept_wrapper(SYS_fchmod, fd, mode); } Loading @@ -940,9 +939,9 @@ hook_chmod(const char* path, mode_t mode) { LOG(DEBUG, "{}() called with path: \"{}\", mode: {}", __func__, path, mode); std::string resolved; if(CTX->relativize_path(path, resolved)) { LOG(WARNING, "{}() chmod is not supported for GekkoFS paths", __func__); errno = ENOTSUP; return -1; LOG(WARNING, "{}() chmod on GekkoFS path ignored; returning success", __func__); return 0; } return syscall_no_intercept_wrapper(SYS_chmod, path, mode); } Loading
src/proxy/rpc/srv_data.cpp +25 −1 Original line number Diff line number Diff line Loading @@ -28,6 +28,7 @@ #include <common/rpc/rpc_types_thallium.hpp> #include <common/rpc/handler_util.hpp> #include <common/trace.hpp> using namespace std; using namespace gkfs::rpc; Loading @@ -35,7 +36,12 @@ using namespace gkfs::rpc; void proxy_rpc_srv_write(const tl::request& req, const gkfs::rpc::rpc_client_proxy_write_in_t& in) { const gkfs::trace::Scope trace_scope{in.trace_id}; if(in.trace_id != 0) { PROXY_DATA->log()->debug( "trace_event=proxy_rpc_start trace_id={} rpc_name={}", in.trace_id, __func__); } rpc_data_out_t out{}; out.err = EIO; out.io_size = 0; Loading Loading @@ -85,11 +91,22 @@ proxy_rpc_srv_write(const tl::request& req, } gkfs::utils::safe_respond(req, out, __func__); if(in.trace_id != 0) { PROXY_DATA->log()->debug( "trace_event=proxy_rpc_end trace_id={} rpc_name={} err={}", in.trace_id, __func__, out.err); } } void proxy_rpc_srv_read(const tl::request& req, const gkfs::rpc::rpc_client_proxy_read_in_t& in) { const gkfs::trace::Scope trace_scope{in.trace_id}; if(in.trace_id != 0) { PROXY_DATA->log()->debug( "trace_event=proxy_rpc_start trace_id={} rpc_name={}", in.trace_id, __func__); } rpc_data_out_t out{}; out.err = EIO; out.io_size = 0; Loading Loading @@ -149,11 +166,17 @@ proxy_rpc_srv_read(const tl::request& req, } gkfs::utils::safe_respond(req, out, __func__); if(in.trace_id != 0) { PROXY_DATA->log()->debug( "trace_event=proxy_rpc_end trace_id={} rpc_name={} err={}", in.trace_id, __func__, out.err); } } void proxy_rpc_srv_truncate(const tl::request& req, const gkfs::rpc::rpc_client_proxy_trunc_in_t& in) { const gkfs::trace::Scope trace_scope{in.trace_id}; rpc_err_out_t out{}; PROXY_DATA->log()->debug( Loading @@ -179,6 +202,7 @@ proxy_rpc_srv_truncate(const tl::request& req, void proxy_rpc_srv_chunk_stat(const tl::request& req, const gkfs::rpc::rpc_chunk_stat_in_t& in) { const gkfs::trace::Scope trace_scope{in.trace_id}; rpc_chunk_stat_out_t out{}; PROXY_DATA->log()->debug("{}() Got chunk stat RPC ", __func__); Loading