Verified Commit 43f24116 authored by Tunahan Kaya's avatar Tunahan Kaya Committed by Marc Vef
Browse files

Mountdir existence is no longer required for clients

Previously, an empty mountdir directory must have existed for no reason. As a result, the daemon created and removed this empty directory. This has been removed
parent c47e1f4c
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -161,8 +161,11 @@ bool resolve(const string& path, string& resolved, bool resolve_last_link) {
        resolved.push_back(path::separator);
        last_slash_pos = resolved.size() - 1;
        resolved.append(path, start, comp_size);

        if (matched_components < mnt_components.size()) {
        /*
         * This will be true for all path components outside of GKFS and up to the mountdir's parent path
         * The mountdir directory is considered to be inside GKFS as it is entirely virtual and does not need to exist
         */
        if (matched_components < mnt_components.size() - 1) {
            // Outside GekkoFS
            if (matched_components == resolved_components &&
                path.compare(start, comp_size, mnt_components.at(matched_components)) == 0) {
+11 −7
Original line number Diff line number Diff line
@@ -245,9 +245,6 @@ void agios_initialize() {
 * Destroys the margo, argobots, and mercury environments
 */
void destroy_enviroment() {
    GKFS_DATA->spdlogger()->debug("{}() Removing mount directory", __func__);
    boost::system::error_code ecode;
    bfs::remove_all(GKFS_DATA->mountdir(), ecode);
    GKFS_DATA->spdlogger()->debug("{}() Freeing I/O executions streams", __func__);
    for (unsigned int i = 0; i < RPC_DATA->io_streams().size(); i++) {
        ABT_xstream_join(RPC_DATA->io_streams().at(i));
@@ -358,10 +355,17 @@ void parse_input(const po::variables_map& vm) {
    GKFS_DATA->hosts_file(hosts_file);

    assert(vm.count("mountdir"));
    auto mountdir = vm["mountdir"].as<string>();
    // Create mountdir. We use this dir to get some information on the underlying fs with statfs in gkfs_statfs
    bfs::create_directories(mountdir);
    GKFS_DATA->mountdir(bfs::canonical(mountdir).native());
    // Store mountdir and ensure parent dir exists as it is required for path resolution on the client
    try {
        bfs::path mountdir(vm["mountdir"].as<string>());
        auto mountdir_parent = bfs::canonical(mountdir.parent_path());
        GKFS_DATA->mountdir(fmt::format("{}/{}", mountdir_parent.native(), mountdir.leaf().native()));
        GKFS_DATA->spdlogger()->info("{}() Mountdir '{}'", __func__, GKFS_DATA->mountdir());
    } catch (const std::exception& e) {
        auto emsg = fmt::format("Parent directory for given mountdir does not exist. err '{}' Exiting ...", e.what());
        cerr << emsg << endl;
        exit(EXIT_FAILURE);
    }

    assert(vm.count("rootdir"));
    auto rootdir = vm["rootdir"].as<string>();