Compare commits
17 Commits
e58554c298
...
f8397e1a03
Author | SHA1 | Date |
---|---|---|
Vitaliy Filippov | f8397e1a03 | |
Vitaliy Filippov | b1129c171b | |
Vitaliy Filippov | 8f077bc67c | |
Vitaliy Filippov | 5624a67c67 | |
Vitaliy Filippov | e0f36d47cc | |
Vitaliy Filippov | 5b34ffa9b6 | |
Vitaliy Filippov | 94de5618e6 | |
Vitaliy Filippov | 551160c693 | |
Vitaliy Filippov | 462845c44b | |
Vitaliy Filippov | 7b75a9bf1b | |
Vitaliy Filippov | 08fc67de05 | |
Vitaliy Filippov | c8a2082dc7 | |
Vitaliy Filippov | 871db8fe31 | |
Vitaliy Filippov | 6aed77041f | |
Vitaliy Filippov | 03d5f512bf | |
Vitaliy Filippov | 127ce8c104 | |
Vitaliy Filippov | 654386e447 |
|
@ -1213,6 +1213,10 @@ void cluster_client_t::handle_op_part(cluster_op_part_t *part)
|
|||
op->retry_after = op->retval == -EIO ? client_eio_retry_interval : client_retry_interval;
|
||||
}
|
||||
reset_retry_timer(op->retry_after);
|
||||
if (stop_fd >= 0)
|
||||
{
|
||||
msgr.stop_client(stop_fd);
|
||||
}
|
||||
if (op->inflight_count == 0)
|
||||
{
|
||||
if (op->opcode == OSD_OP_SYNC)
|
||||
|
@ -1220,10 +1224,6 @@ void cluster_client_t::handle_op_part(cluster_op_part_t *part)
|
|||
else
|
||||
continue_rw(op);
|
||||
}
|
||||
if (stop_fd >= 0)
|
||||
{
|
||||
msgr.stop_client(stop_fd);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -15,7 +15,6 @@ struct nfs_kv_setattr_state
|
|||
rpc_op_t *rop = NULL;
|
||||
uint64_t ino = 0;
|
||||
uint64_t old_size = 0, new_size = 0;
|
||||
std::string expected_ctime;
|
||||
json11::Json::object set_attrs;
|
||||
int res = 0, cas_res = 0;
|
||||
std::string ientry_text;
|
||||
|
@ -60,12 +59,6 @@ resume_1:
|
|||
cb(-EINVAL);
|
||||
return;
|
||||
}
|
||||
if (st->expected_ctime != "" && st->ientry["ctime"].string_value() != st->expected_ctime)
|
||||
{
|
||||
auto cb = std::move(st->cb);
|
||||
cb(NFS3ERR_NOT_SYNC);
|
||||
return;
|
||||
}
|
||||
// Now we can update it
|
||||
st->new_attrs = st->ientry.object_items();
|
||||
st->old_size = st->ientry["size"].uint64_value();
|
||||
|
@ -147,8 +140,6 @@ int kv_nfs3_setattr_proc(void *opaque, rpc_op_t *rop)
|
|||
return 0;
|
||||
}
|
||||
st->ino = kv_fh_inode(fh);
|
||||
if (args->guard.check)
|
||||
st->expected_ctime = nfstime_to_str(args->guard.obj_ctime);
|
||||
if (args->new_attributes.size.set_it)
|
||||
st->set_attrs["size"] = args->new_attributes.size.size;
|
||||
if (args->new_attributes.mode.set_it)
|
||||
|
|
|
@ -58,10 +58,11 @@ static const char* help_text =
|
|||
"Vitastor NFS 3.0 proxy " VERSION "\n"
|
||||
"(c) Vitaliy Filippov, 2021+ (VNPL-1.1)\n"
|
||||
"\n"
|
||||
"vitastor-nfs (--fs <NAME> | --block) mount <MOUNTPOINT>\n"
|
||||
"vitastor-nfs (--fs <NAME> | --block) [-o <OPT>] mount <MOUNTPOINT>\n"
|
||||
" Start local filesystem server and mount file system to <MOUNTPOINT>.\n"
|
||||
" Use regular `umount <MOUNTPOINT>` to unmount the FS.\n"
|
||||
" The server will be automatically stopped when the FS is unmounted.\n"
|
||||
" -o|--options <OPT> Pass additional NFS mount options (ex.: -o async).\n"
|
||||
"\n"
|
||||
"vitastor-nfs (--fs <NAME> | --block) start\n"
|
||||
" Start network NFS server. Options:\n"
|
||||
|
@ -101,6 +102,16 @@ json11::Json::object nfs_proxy_t::parse_args(int narg, const char *args[])
|
|||
printf("%s", help_text);
|
||||
exit(0);
|
||||
}
|
||||
else if (!strcmp(args[i], "-o") || !strcmp(args[i], "--options"))
|
||||
{
|
||||
if (i >= narg-1)
|
||||
{
|
||||
printf("%s", help_text);
|
||||
exit(0);
|
||||
}
|
||||
const std::string & old = cfg["options"].string_value();
|
||||
cfg["options"] = old != "" ? old+","+args[i+1] : args[i+1];
|
||||
}
|
||||
else if (args[i][0] == '-' && args[i][1] == '-')
|
||||
{
|
||||
const char *opt = args[i]+2;
|
||||
|
@ -169,6 +180,7 @@ void nfs_proxy_t::run(json11::Json cfg)
|
|||
portmap_enabled = false;
|
||||
exit_on_umount = true;
|
||||
}
|
||||
mountopts = cfg["options"].string_value();
|
||||
fsname = cfg["fs"].string_value();
|
||||
// Create client
|
||||
ringloop = new ring_loop_t(RINGLOOP_DEFAULT_SIZE);
|
||||
|
@ -1064,7 +1076,25 @@ void nfs_proxy_t::mount_fs()
|
|||
{
|
||||
// Child
|
||||
std::string src = ("localhost:"+export_root);
|
||||
std::string opts = ("port="+std::to_string(listening_port)+",mountport="+std::to_string(listening_port)+",nfsvers=3,soft,nolock,tcp");
|
||||
std::string opts = ("port="+std::to_string(listening_port)+",mountport="+std::to_string(listening_port)+",nfsvers=3,nolock,tcp");
|
||||
bool hard = false, async = false;
|
||||
for (auto & opt: explode(",", mountopts, true))
|
||||
{
|
||||
if (opt == "hard")
|
||||
hard = true;
|
||||
else if (opt == "async")
|
||||
async = true;
|
||||
else if (opt.substr(0, 4) != "port" && opt.substr(0, 9) != "mountport" &&
|
||||
opt.substr(0, 7) != "nfsvers" && opt.substr(0, 5) != "proto" &&
|
||||
opt != "udp" && opt != "tcp" && opt != "rdma")
|
||||
{
|
||||
opts += ","+opt;
|
||||
}
|
||||
}
|
||||
if (!hard)
|
||||
opts += ",soft";
|
||||
if (!async)
|
||||
opts += ",sync";
|
||||
const char *args[] = { "mount", src.c_str(), mountpoint.c_str(), "-o", opts.c_str(), NULL };
|
||||
execvp("mount", (char* const*)args);
|
||||
fprintf(stderr, "Failed to run mount %s %s -o %s: %s (code %d)\n",
|
||||
|
|
|
@ -32,6 +32,7 @@ public:
|
|||
std::string pidfile;
|
||||
bool exit_on_umount = false;
|
||||
std::string mountpoint;
|
||||
std::string mountopts;
|
||||
std::string fsname;
|
||||
|
||||
int active_connections = 0;
|
||||
|
|
|
@ -388,14 +388,14 @@ void osd_t::on_change_etcd_state_hook(std::map<std::string, etcd_kv_t> & changes
|
|||
etcd_global_config = changes[st_cli.etcd_prefix+"/config/global"].value.object_items();
|
||||
parse_config(false);
|
||||
}
|
||||
if (run_primary)
|
||||
{
|
||||
bool pools = changes.find(st_cli.etcd_prefix+"/config/pools") != changes.end();
|
||||
bool pgs = changes.find(st_cli.etcd_prefix+"/config/pgs") != changes.end();
|
||||
if (pools)
|
||||
{
|
||||
apply_no_inode_stats();
|
||||
}
|
||||
if (run_primary)
|
||||
{
|
||||
bool pgs = changes.find(st_cli.etcd_prefix+"/config/pgs") != changes.end();
|
||||
if (pools || pgs)
|
||||
{
|
||||
apply_pg_count();
|
||||
|
@ -423,6 +423,8 @@ void osd_t::on_reload_config_hook(json11::Json::object & global_config)
|
|||
// Acquire lease
|
||||
void osd_t::acquire_lease()
|
||||
{
|
||||
// Apply no_inode_stats before the first statistics report
|
||||
apply_no_inode_stats();
|
||||
// Maximum lease TTL is (report interval) + retries * (timeout + repeat interval)
|
||||
st_cli.etcd_call("/lease/grant", json11::Json::object {
|
||||
{ "TTL", etcd_report_interval+(st_cli.max_etcd_attempts*(2*st_cli.etcd_quick_timeout)+999)/1000 }
|
||||
|
@ -611,9 +613,9 @@ void osd_t::on_load_pgs_hook(bool success)
|
|||
else
|
||||
{
|
||||
peering_state &= ~OSD_LOADING_PGS;
|
||||
apply_no_inode_stats();
|
||||
if (run_primary)
|
||||
{
|
||||
apply_no_inode_stats();
|
||||
apply_pg_count();
|
||||
apply_pg_config();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue