Check if already mounted before mounting
Test / buildenv (push) Successful in 9s
Details
Test / make_test (push) Has been cancelled
Details
Test / test_add_osd (push) Has been cancelled
Details
Test / test_cas (push) Has been cancelled
Details
Test / test_change_pg_count (push) Has been cancelled
Details
Test / test_change_pg_count_ec (push) Has been cancelled
Details
Test / test_change_pg_size (push) Has been cancelled
Details
Test / test_create_nomaxid (push) Has been cancelled
Details
Test / test_etcd_fail (push) Has been cancelled
Details
Test / test_interrupted_rebalance (push) Has been cancelled
Details
Test / test_interrupted_rebalance_imm (push) Has been cancelled
Details
Test / test_interrupted_rebalance_ec (push) Has been cancelled
Details
Test / test_interrupted_rebalance_ec_imm (push) Has been cancelled
Details
Test / test_failure_domain (push) Has been cancelled
Details
Test / test_snapshot (push) Has been cancelled
Details
Test / test_snapshot_ec (push) Has been cancelled
Details
Test / test_minsize_1 (push) Has been cancelled
Details
Test / test_move_reappear (push) Has been cancelled
Details
Test / build (push) Has been cancelled
Details
Test / test_rm (push) Has been cancelled
Details
Test / test_snapshot_chain (push) Has been cancelled
Details
Test / test_snapshot_chain_ec (push) Has been cancelled
Details
Test / test_snapshot_down (push) Has been cancelled
Details
Test / test_snapshot_down_ec (push) Has been cancelled
Details
Test / test_splitbrain (push) Has been cancelled
Details
Test / test_rebalance_verify (push) Has been cancelled
Details
Test / test_rebalance_verify_imm (push) Has been cancelled
Details
Test / test_rebalance_verify_ec (push) Has been cancelled
Details
Test / test_rebalance_verify_ec_imm (push) Has been cancelled
Details
Test / test_switch_primary (push) Has been cancelled
Details
Test / test_write (push) Has been cancelled
Details
Test / test_write_xor (push) Has been cancelled
Details
Test / test_write_no_same (push) Has been cancelled
Details
Test / test_heal_pg_size_2 (push) Has been cancelled
Details
Test / test_heal_ec (push) Has been cancelled
Details
Test / test_heal_csum_32k_dmj (push) Has been cancelled
Details
Test / test_heal_csum_32k_dj (push) Has been cancelled
Details
Test / test_heal_csum_32k (push) Has been cancelled
Details
Test / test_heal_csum_4k_dmj (push) Has been cancelled
Details
Test / test_heal_csum_4k_dj (push) Has been cancelled
Details
Test / test_heal_csum_4k (push) Has been cancelled
Details
Test / test_scrub (push) Has been cancelled
Details
Test / test_scrub_zero_osd_2 (push) Has been cancelled
Details
Test / test_scrub_xor (push) Has been cancelled
Details
Test / test_scrub_pg_size_3 (push) Has been cancelled
Details
Test / test_scrub_pg_size_6_pg_minsize_4_osd_count_6_ec (push) Has been cancelled
Details
Test / test_scrub_ec (push) Has been cancelled
Details
Test / test_nfs (push) Has been cancelled
Details
Test / buildenv (push) Successful in 9s
Details
Test / make_test (push) Has been cancelled
Details
Test / test_add_osd (push) Has been cancelled
Details
Test / test_cas (push) Has been cancelled
Details
Test / test_change_pg_count (push) Has been cancelled
Details
Test / test_change_pg_count_ec (push) Has been cancelled
Details
Test / test_change_pg_size (push) Has been cancelled
Details
Test / test_create_nomaxid (push) Has been cancelled
Details
Test / test_etcd_fail (push) Has been cancelled
Details
Test / test_interrupted_rebalance (push) Has been cancelled
Details
Test / test_interrupted_rebalance_imm (push) Has been cancelled
Details
Test / test_interrupted_rebalance_ec (push) Has been cancelled
Details
Test / test_interrupted_rebalance_ec_imm (push) Has been cancelled
Details
Test / test_failure_domain (push) Has been cancelled
Details
Test / test_snapshot (push) Has been cancelled
Details
Test / test_snapshot_ec (push) Has been cancelled
Details
Test / test_minsize_1 (push) Has been cancelled
Details
Test / test_move_reappear (push) Has been cancelled
Details
Test / build (push) Has been cancelled
Details
Test / test_rm (push) Has been cancelled
Details
Test / test_snapshot_chain (push) Has been cancelled
Details
Test / test_snapshot_chain_ec (push) Has been cancelled
Details
Test / test_snapshot_down (push) Has been cancelled
Details
Test / test_snapshot_down_ec (push) Has been cancelled
Details
Test / test_splitbrain (push) Has been cancelled
Details
Test / test_rebalance_verify (push) Has been cancelled
Details
Test / test_rebalance_verify_imm (push) Has been cancelled
Details
Test / test_rebalance_verify_ec (push) Has been cancelled
Details
Test / test_rebalance_verify_ec_imm (push) Has been cancelled
Details
Test / test_switch_primary (push) Has been cancelled
Details
Test / test_write (push) Has been cancelled
Details
Test / test_write_xor (push) Has been cancelled
Details
Test / test_write_no_same (push) Has been cancelled
Details
Test / test_heal_pg_size_2 (push) Has been cancelled
Details
Test / test_heal_ec (push) Has been cancelled
Details
Test / test_heal_csum_32k_dmj (push) Has been cancelled
Details
Test / test_heal_csum_32k_dj (push) Has been cancelled
Details
Test / test_heal_csum_32k (push) Has been cancelled
Details
Test / test_heal_csum_4k_dmj (push) Has been cancelled
Details
Test / test_heal_csum_4k_dj (push) Has been cancelled
Details
Test / test_heal_csum_4k (push) Has been cancelled
Details
Test / test_scrub (push) Has been cancelled
Details
Test / test_scrub_zero_osd_2 (push) Has been cancelled
Details
Test / test_scrub_xor (push) Has been cancelled
Details
Test / test_scrub_pg_size_3 (push) Has been cancelled
Details
Test / test_scrub_pg_size_6_pg_minsize_4_osd_count_6_ec (push) Has been cancelled
Details
Test / test_scrub_ec (push) Has been cancelled
Details
Test / test_nfs (push) Has been cancelled
Details
parent
df8f5bd69e
commit
21e56fa73a
|
@ -132,7 +132,6 @@ void disk_tool_simple_offsets(json11::Json cfg, bool json_output);
|
|||
|
||||
uint64_t sscanf_json(const char *fmt, const json11::Json & str);
|
||||
void fromhexstr(const std::string & from, int bytes, uint8_t *to);
|
||||
std::string realpath_str(std::string path, bool nofail = true);
|
||||
int disable_cache(std::string dev);
|
||||
std::string get_parent_device(std::string dev);
|
||||
bool json_is_true(const json11::Json & val);
|
||||
|
|
|
@ -42,19 +42,6 @@ void fromhexstr(const std::string & from, int bytes, uint8_t *to)
|
|||
}
|
||||
}
|
||||
|
||||
std::string realpath_str(std::string path, bool nofail)
|
||||
{
|
||||
char *p = realpath((char*)path.c_str(), NULL);
|
||||
if (!p)
|
||||
{
|
||||
fprintf(stderr, "Failed to resolve %s: %s\n", path.c_str(), strerror(errno));
|
||||
return nofail ? path : "";
|
||||
}
|
||||
std::string rp(p);
|
||||
free(p);
|
||||
return rp;
|
||||
}
|
||||
|
||||
// returns 1 = check error, 0 = write through, -1 = write back
|
||||
// (similar to 1 = warning, -1 = error, 0 = success in disable_cache)
|
||||
static int check_queue_cache(std::string dev, std::string parent_dev)
|
||||
|
|
|
@ -1032,6 +1032,7 @@ void single_child_handler(int signal)
|
|||
|
||||
void nfs_proxy_t::mount_fs()
|
||||
{
|
||||
check_already_mounted();
|
||||
signal(SIGCHLD, single_child_handler);
|
||||
auto pid = fork();
|
||||
if (pid < 0)
|
||||
|
@ -1072,6 +1073,30 @@ void nfs_proxy_t::mount_fs()
|
|||
}
|
||||
}
|
||||
|
||||
void nfs_proxy_t::check_already_mounted()
|
||||
{
|
||||
std::string realpoint = realpath_str(mountpoint, false);
|
||||
if (realpoint == "")
|
||||
{
|
||||
return;
|
||||
}
|
||||
std::string mountstr = read_file("/proc/mounts");
|
||||
if (mountstr == "")
|
||||
{
|
||||
return;
|
||||
}
|
||||
auto mounts = explode("\n", mountstr, true);
|
||||
for (auto & str: mounts)
|
||||
{
|
||||
auto mnt = explode(" ", str, true);
|
||||
if (mnt[1] == realpoint)
|
||||
{
|
||||
fprintf(stderr, "%s is already mounted\n", mountpoint.c_str());
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void nfs_proxy_t::check_exit()
|
||||
{
|
||||
if (active_connections || !exit_on_umount)
|
||||
|
@ -1084,7 +1109,7 @@ void nfs_proxy_t::check_exit()
|
|||
return;
|
||||
}
|
||||
auto port_opt = "port="+std::to_string(listening_port);
|
||||
auto mountport_opt = "port="+std::to_string(listening_port);
|
||||
auto mountport_opt = "mountport="+std::to_string(listening_port);
|
||||
auto mounts = explode("\n", mountstr, true);
|
||||
for (auto & str: mounts)
|
||||
{
|
||||
|
|
|
@ -66,6 +66,7 @@ public:
|
|||
void daemonize();
|
||||
void write_pid();
|
||||
void mount_fs();
|
||||
void check_already_mounted();
|
||||
void check_exit();
|
||||
};
|
||||
|
||||
|
|
|
@ -428,3 +428,16 @@ std::string auto_addslashes(const std::string & str)
|
|||
}
|
||||
return res+"\"";
|
||||
}
|
||||
|
||||
std::string realpath_str(std::string path, bool nofail)
|
||||
{
|
||||
char *p = realpath((char*)path.c_str(), NULL);
|
||||
if (!p)
|
||||
{
|
||||
fprintf(stderr, "Failed to resolve %s: %s\n", path.c_str(), strerror(errno));
|
||||
return nofail ? path : "";
|
||||
}
|
||||
std::string rp(p);
|
||||
free(p);
|
||||
return rp;
|
||||
}
|
||||
|
|
|
@ -25,3 +25,4 @@ size_t utf8_length(const char *s);
|
|||
std::vector<std::string> explode(const std::string & sep, const std::string & value, bool trim);
|
||||
std::string scan_escaped(const std::string & cmd, size_t & pos);
|
||||
std::string auto_addslashes(const std::string & str);
|
||||
std::string realpath_str(std::string path, bool nofail = true);
|
||||
|
|
Loading…
Reference in New Issue