Compare commits

..

17 Commits

Author SHA1 Message Date
Vitaliy Filippov f8397e1a03 Allow to specify additional NFS mount options
Test / test_interrupted_rebalance_ec (push) Successful in 1m58s Details
Test / test_rm (push) Successful in 13s Details
Test / test_snapshot_down (push) Successful in 27s Details
Test / test_snapshot_down_ec (push) Successful in 30s Details
Test / test_splitbrain (push) Successful in 23s Details
Test / test_snapshot_chain (push) Successful in 2m22s Details
Test / test_snapshot_chain_ec (push) Successful in 2m53s Details
Test / test_rebalance_verify_imm (push) Successful in 4m7s Details
Test / test_rebalance_verify (push) Successful in 4m37s Details
Test / test_switch_primary (push) Successful in 36s Details
Test / test_write (push) Successful in 41s Details
Test / test_write_no_same (push) Successful in 17s Details
Test / test_write_xor (push) Successful in 1m5s Details
Test / test_rebalance_verify_ec_imm (push) Successful in 4m17s Details
Test / test_rebalance_verify_ec (push) Successful in 7m13s Details
Test / test_heal_pg_size_2 (push) Successful in 3m18s Details
Test / test_heal_ec (push) Successful in 5m4s Details
Test / test_heal_csum_32k_dmj (push) Successful in 4m40s Details
Test / test_heal_csum_32k_dj (push) Successful in 6m14s Details
Test / test_heal_csum_32k (push) Successful in 6m13s Details
Test / test_scrub (push) Successful in 1m34s Details
Test / test_heal_csum_4k_dmj (push) Successful in 6m43s Details
Test / test_heal_csum_4k_dj (push) Successful in 6m42s Details
Test / test_scrub_zero_osd_2 (push) Successful in 1m28s Details
Test / test_scrub_xor (push) Successful in 50s Details
Test / test_scrub_pg_size_6_pg_minsize_4_osd_count_6_ec (push) Successful in 1m10s Details
Test / test_scrub_ec (push) Successful in 57s Details
Test / test_scrub_pg_size_3 (push) Successful in 1m46s Details
Test / test_nfs (push) Successful in 24s Details
Test / test_heal_csum_4k (push) Successful in 5m35s Details
2024-03-11 23:30:42 +03:00
Vitaliy Filippov b1129c171b Stop then retry, not retry then stop 2024-03-11 14:17:16 +03:00
Vitaliy Filippov 8f077bc67c Fix malloc/free in nfs_kv_read/write 2024-03-11 14:17:16 +03:00
Vitaliy Filippov 5624a67c67 Fix another rare OSD hang on zeroing out entries on start 2024-03-11 14:17:16 +03:00
Vitaliy Filippov e0f36d47cc Fix "bad key in etcd" in mon for FS pools 2024-03-11 14:17:16 +03:00
Vitaliy Filippov 5b34ffa9b6 Check if already mounted before mounting 2024-03-11 14:17:16 +03:00
Vitaliy Filippov 94de5618e6 Fix zero used space, update mtime when moving/changing inode 2024-03-11 14:17:16 +03:00
Vitaliy Filippov 551160c693 Ignore ECANCELED in nfs-proxy (happens in io_uring on fork) 2024-03-11 14:17:16 +03:00
Vitaliy Filippov 462845c44b Support unaligned shared_offsets, align shared file data instead of header 2024-03-11 14:17:16 +03:00
Vitaliy Filippov 7b75a9bf1b Implement auto-unmount local NFS server mode for vitastor-nfs 2024-03-11 14:17:16 +03:00
Vitaliy Filippov 08fc67de05 Return error on failed shrink 2024-03-11 14:17:16 +03:00
Vitaliy Filippov c8a2082dc7 Implement rename over an existing file/directory 2024-03-11 14:17:16 +03:00
Vitaliy Filippov 871db8fe31 Support --logfile in nfs-proxy 2024-03-11 14:17:16 +03:00
Vitaliy Filippov 6aed77041f Fix shared file overlap, add FIXMEs 2024-03-11 14:17:16 +03:00
Vitaliy Filippov 03d5f512bf Create inode, then direntry, not direntry, then inode; retry ID collisions 2024-03-11 14:17:16 +03:00
Vitaliy Filippov 127ce8c104 Fix NFS shared/aligned write FIXMEs 2024-03-11 14:17:16 +03:00
Vitaliy Filippov 654386e447 Allow to disable per-inode stats for VitastorFS pools 2024-03-11 14:17:16 +03:00
5 changed files with 45 additions and 21 deletions

View File

@ -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
{

View File

@ -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)

View File

@ -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",

View File

@ -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;

View File

@ -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();
}