regression fix

Merge request reports

Loading
+2 −1
Changes for include/client/rpc/forward_metadata.hpp: 2 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -77,7 +77,8 @@ forward_rename(const std::string& oldpath, const std::string& newpath,
               const gkfs::metadata::Metadata& md);

int
forward_remove(const std::string& path, bool rm_dir, const int8_t num_copies);
forward_remove(const std::string& path, bool rm_dir, const int8_t num_copies,
               int64_t size);

int
forward_decr_size(const std::string& path, size_t length, const int copy);
+0 −2
Changes for include/client/open_file_map.hpp: 0 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -200,8 +200,6 @@ public:
    int
    get_fd_idx();

    std::vector<int>
    get_range(unsigned int first, unsigned int last);

    bool
    empty() const;
+24 −6
Changes for src/client/rpc/forward_metadata.cpp: 24 added lines, 6 removed lines.
Original line number Diff line number Diff line
@@ -115,7 +115,8 @@ forward_stat(const std::string& path, string& attr, string& inline_data,
}

int
forward_remove(const std::string& path, bool rm_dir, int8_t num_copies) {
forward_remove(const std::string& path, bool rm_dir, int8_t num_copies,
               int64_t size) {
    int err = 0;

    // Step 1: Remove metadata from the responsible server(s)
@@ -145,23 +146,40 @@ forward_remove(const std::string& path, bool rm_dir, int8_t num_copies) {
    // clean up whatever chunks it holds for this file.
    // NOTE: When using the proxy, the proxy handles this broadcast itself, so
    // we skip it here (CTX->use_proxy() is checked by the caller).
    // We send remove_data unconditionally for non-directory removes.
    // Daemons handle the no-op case safely (empty chunk dir == nothing to do).
    if(!rm_dir) {
        bool is_inline = gkfs::config::metadata::use_inline_data &&
                         size <= gkfs::config::metadata::inline_data_size;

        if(size > 0 && !is_inline) {
            auto rpc_remove_data =
                    CTX->rpc_engine()->define(gkfs::rpc::tag::remove_data);

            gkfs::rpc::rpc_rm_node_in_t rm_in;
            rm_in.path = path;
        rm_in.rm_dir = true; // tells daemon to remove the whole chunk directory
            rm_in.rm_dir =
                    true; // tells daemon to remove the whole chunk directory

            auto chunk_size = gkfs::config::rpc::chunksize;
            auto num_chunks = size / chunk_size;
            if(size % chunk_size != 0) {
                num_chunks++;
            }

        for(std::size_t i = 0; i < CTX->hosts().size(); i++) {
            std::unordered_set<uint64_t> host_ids;
            for(uint64_t chnk_id = 0; chnk_id < num_chunks; chnk_id++) {
                host_ids.insert(
                        CTX->distributor()->locate_data(path, chnk_id, 0));
            }

            for(auto host_id : host_ids) {
                try {
                rpc_remove_data.on(CTX->hosts().at(i)).async(rm_in);
                    rpc_remove_data.on(CTX->hosts().at(host_id)).async(rm_in);
                } catch(const std::exception& e) {
                    LOG(WARNING,
                        "{}() Failed to send remove_data RPC to host {}: {}",
                    __func__, i, e.what());
                        __func__, host_id, e.what());
                }
            }
        }
    }
+12 −10
Changes for src/client/gkfs_metadata.cpp: 12 added lines, 10 removed lines.
Original line number Diff line number Diff line
@@ -162,7 +162,7 @@ generate_lock_file(const std::string& path, bool increase) {
        if(md) {
            if(md->size() == 1 || md->size() == 0) {
                LOG(DEBUG, "Deleting Lock file {}", lock_path);
                gkfs::rpc::forward_remove(lock_path, false, 0);
                gkfs::rpc::forward_remove(lock_path, false, 0, md->size());
            } else {
                gkfs::rpc::forward_decr_size(lock_path, md.value().size() - 1,
                                             0);
@@ -471,13 +471,13 @@ gkfs_libcremove(const std::string& path) {
 */
int
gkfs_remove(const std::string& path) {

    if(gkfs::config::metadata::rename_support) {
    auto md = gkfs::utils::get_metadata(path);
    if(!md) {
        return -1;
    }

    if(gkfs::config::metadata::rename_support) {

        if(S_ISDIR(md->mode())) {
            LOG(ERROR, "Cannot remove directory '{}'", path);
            errno = EISDIR;
@@ -502,8 +502,8 @@ gkfs_remove(const std::string& path) {
                            return -1;
                        }
                    }
                    auto err = gkfs::rpc::forward_remove(new_path, false,
                                                         CTX->get_replicas());
                    auto err = gkfs::rpc::forward_remove(
                            new_path, false, CTX->get_replicas(), md->size());
                    if(err) {
                        errno = err;
                        return -1;
@@ -517,7 +517,8 @@ gkfs_remove(const std::string& path) {
    if(gkfs::config::proxy::fwd_remove && CTX->use_proxy()) {
        err = gkfs::rpc::forward_remove_proxy(path, false);
    } else {
        err = gkfs::rpc::forward_remove(path, false, CTX->get_replicas());
        err = gkfs::rpc::forward_remove(path, false, CTX->get_replicas(),
                                        md->size());
    }
    if(err) {
        errno = err;
@@ -601,8 +602,8 @@ gkfs_rename(const string& old_path, const string& new_path) {
            auto is_dir = false;
            if(S_ISDIR(md_old->mode()))
                is_dir = true;
            err = gkfs::rpc::forward_remove(old_path, is_dir,
                                            CTX->get_replicas());
            err = gkfs::rpc::forward_remove(
                    old_path, is_dir, CTX->get_replicas(), md_old->size());
            if(err) {
                errno = err;
                return -1;
@@ -636,7 +637,8 @@ gkfs_rename(const string& old_path, const string& new_path) {
            if(S_ISDIR(md_old->mode()))
                is_dir = true;
            // Remove intermediate file
            gkfs::rpc::forward_remove(old_path, is_dir, CTX->get_replicas());
            gkfs::rpc::forward_remove(old_path, is_dir, CTX->get_replicas(),
                                      md_old->size());
        }
        int err = 0;
        if(!S_ISLNK(md_old->mode())) {
@@ -1365,7 +1367,7 @@ gkfs_rmdir(const std::string& path) {
    if(gkfs::config::proxy::fwd_remove && CTX->use_proxy()) {
        err = gkfs::rpc::forward_remove_proxy(path, true);
    } else {
        err = gkfs::rpc::forward_remove(path, true, CTX->get_replicas());
        err = gkfs::rpc::forward_remove(path, true, CTX->get_replicas(), 0);
    }
    if(err) {
        errno = err;
+8 −10
Changes for src/client/intercept.cpp: 8 added lines, 10 removed lines.
Original line number Diff line number Diff line
@@ -593,18 +593,16 @@ hook(long syscall_number, long arg0, long arg1, long arg2, long arg3, long arg4,
            auto last = static_cast<unsigned int>(arg1);
            auto flags = static_cast<unsigned int>(arg2);

            // Close any GekkoFS virtual fds in the range ourselves.
            // Iterate only over our tracked fds to avoid touching native fds.
            auto to_close = CTX->file_map()->get_range(first, last);
            for(auto fd : to_close) {
            auto fds = get_open_fds();
            for(auto fd : fds) {
                if(fd < first || fd > last)
                    continue;
                if(CTX->file_map()->exist(fd)) {
                    gkfs::syscall::gkfs_close(fd);
                } else
                    close(fd);
            }

            // Forward the range to the kernel for all native fds.
            // The kernel handles O_CLOEXEC semantics and won't touch our
            // internal fds (which live in the upper fd range).
            *result = syscall_no_intercept_wrapper(SYS_close_range, first, last,
                                                   flags);
            *result = 0;
            break;
        }
#endif // SYS_close_range
Loading
Loading