Compare commits

..

16 Commits

Author SHA1 Message Date
Vitaliy Filippov e58554c298 Fix malloc/free in nfs_kv_read/write
Test / test_move_reappear (push) Successful in 22s Details
Test / test_rm (push) Successful in 16s Details
Test / test_snapshot_down (push) Successful in 30s Details
Test / test_snapshot_down_ec (push) Successful in 28s Details
Test / test_splitbrain (push) Successful in 21s Details
Test / test_snapshot_chain (push) Successful in 2m15s Details
Test / test_snapshot_chain_ec (push) Successful in 2m54s Details
Test / test_rebalance_verify_imm (push) Successful in 2m31s Details
Test / test_rebalance_verify (push) Successful in 3m14s Details
Test / test_switch_primary (push) Successful in 34s Details
Test / test_write (push) Successful in 51s Details
Test / test_write_xor (push) Successful in 51s Details
Test / test_write_no_same (push) Successful in 13s Details
Test / test_rebalance_verify_ec (push) Successful in 4m5s Details
Test / test_rebalance_verify_ec_imm (push) Successful in 4m11s Details
Test / test_heal_pg_size_2 (push) Successful in 3m39s Details
Test / test_heal_ec (push) Successful in 3m37s Details
Test / test_heal_csum_32k_dmj (push) Successful in 5m22s Details
Test / test_heal_csum_32k_dj (push) Successful in 6m42s Details
Test / test_heal_csum_32k (push) Successful in 6m52s Details
Test / test_heal_csum_4k_dmj (push) Successful in 6m50s Details
Test / test_scrub_zero_osd_2 (push) Successful in 56s Details
Test / test_scrub (push) Successful in 59s Details
Test / test_scrub_xor (push) Successful in 1m0s Details
Test / test_heal_csum_4k_dj (push) Successful in 6m44s Details
Test / test_scrub_pg_size_6_pg_minsize_4_osd_count_6_ec (push) Successful in 1m27s Details
Test / test_scrub_pg_size_3 (push) Successful in 2m34s Details
Test / test_scrub_ec (push) Successful in 47s Details
Test / test_nfs (push) Successful in 22s Details
Test / test_heal_csum_4k (push) Successful in 5m31s Details
2024-03-11 02:16:39 +03:00
Vitaliy Filippov e2f59c3885 Fix another rare OSD hang on zeroing out entries on start 2024-03-11 01:14:50 +03:00
Vitaliy Filippov 8239e4bcfe Fix "bad key in etcd" in mon for FS pools 2024-03-11 01:14:40 +03:00
Vitaliy Filippov 955ce0bb60 Support setattr guard
Test / test_move_reappear (push) Successful in 21s Details
Test / test_interrupted_rebalance_ec_imm (push) Successful in 1m35s Details
Test / test_snapshot_down (push) Successful in 29s Details
Test / test_snapshot_down_ec (push) Successful in 29s Details
Test / test_splitbrain (push) Successful in 23s Details
Test / test_snapshot_chain (push) Successful in 2m29s Details
Test / test_snapshot_chain_ec (push) Successful in 3m3s Details
Test / test_rebalance_verify_imm (push) Successful in 3m24s Details
Test / test_rebalance_verify (push) Successful in 4m7s Details
Test / test_switch_primary (push) Successful in 33s Details
Test / test_write (push) Successful in 51s Details
Test / test_write_xor (push) Successful in 51s Details
Test / test_write_no_same (push) Successful in 13s Details
Test / test_rebalance_verify_ec_imm (push) Successful in 4m14s Details
Test / test_rebalance_verify_ec (push) Successful in 5m0s Details
Test / test_heal_pg_size_2 (push) Successful in 3m28s Details
Test / test_heal_ec (push) Successful in 3m57s Details
Test / test_heal_csum_32k_dmj (push) Successful in 5m35s Details
Test / test_heal_csum_32k_dj (push) Successful in 5m34s Details
Test / test_heal_csum_32k (push) Successful in 6m44s Details
Test / test_heal_csum_4k_dmj (push) Successful in 6m20s Details
Test / test_scrub_zero_osd_2 (push) Successful in 51s Details
Test / test_scrub (push) Successful in 59s Details
Test / test_scrub_xor (push) Successful in 1m5s Details
Test / test_heal_csum_4k (push) Successful in 6m4s Details
Test / test_heal_csum_4k_dj (push) Successful in 6m6s Details
Test / test_scrub_pg_size_3 (push) Successful in 2m4s Details
Test / test_scrub_pg_size_6_pg_minsize_4_osd_count_6_ec (push) Successful in 1m7s Details
Test / test_nfs (push) Successful in 13s Details
Test / test_scrub_ec (push) Successful in 19s Details
2024-03-10 02:31:11 +03:00
Vitaliy Filippov 584ef40b16 Check if already mounted before mounting
Test / test_rm (push) Successful in 14s Details
Test / test_interrupted_rebalance_ec_imm (push) Successful in 1m29s Details
Test / test_snapshot_down (push) Successful in 27s Details
Test / test_snapshot_down_ec (push) Successful in 27s Details
Test / test_splitbrain (push) Successful in 23s Details
Test / test_snapshot_chain (push) Successful in 2m7s Details
Test / test_snapshot_chain_ec (push) Successful in 2m45s Details
Test / test_rebalance_verify_imm (push) Successful in 3m18s Details
Test / test_rebalance_verify (push) Successful in 3m51s Details
Test / test_switch_primary (push) Successful in 39s Details
Test / test_write (push) Successful in 40s Details
Test / test_write_no_same (push) Successful in 17s Details
Test / test_write_xor (push) Successful in 1m2s Details
Test / test_rebalance_verify_ec_imm (push) Successful in 3m32s Details
Test / test_rebalance_verify_ec (push) Successful in 5m36s Details
Test / test_heal_pg_size_2 (push) Successful in 3m30s Details
Test / test_heal_csum_32k_dmj (push) Successful in 4m57s Details
Test / test_heal_ec (push) Successful in 5m20s Details
Test / test_heal_csum_32k_dj (push) Successful in 6m8s Details
Test / test_heal_csum_32k (push) Successful in 6m40s Details
Test / test_scrub (push) Successful in 1m44s Details
Test / test_heal_csum_4k_dj (push) Successful in 7m4s Details
Test / test_heal_csum_4k_dmj (push) Successful in 7m6s Details
Test / test_scrub_zero_osd_2 (push) Successful in 1m35s Details
Test / test_scrub_xor (push) Successful in 1m0s Details
Test / test_scrub_pg_size_6_pg_minsize_4_osd_count_6_ec (push) Successful in 1m11s Details
Test / test_heal_csum_4k (push) Successful in 6m22s Details
Test / test_scrub_ec (push) Successful in 49s Details
Test / test_scrub_pg_size_3 (push) Successful in 1m48s Details
Test / test_nfs (push) Successful in 12s Details
2024-03-10 00:53:38 +03:00
Vitaliy Filippov df8f5bd69e Fix zero used space, update mtime when moving/changing inode
Test / test_rm (push) Successful in 15s Details
Test / test_move_reappear (push) Successful in 20s Details
Test / test_snapshot_down (push) Successful in 31s Details
Test / test_snapshot_down_ec (push) Successful in 29s Details
Test / test_splitbrain (push) Successful in 26s Details
Test / test_snapshot_chain (push) Successful in 2m19s Details
Test / test_snapshot_chain_ec (push) Successful in 2m51s Details
Test / test_rebalance_verify_imm (push) Successful in 3m30s Details
Test / test_rebalance_verify (push) Successful in 4m16s Details
Test / test_switch_primary (push) Successful in 34s Details
Test / test_write (push) Successful in 53s Details
Test / test_write_xor (push) Successful in 53s Details
Test / test_rebalance_verify_ec_imm (push) Successful in 3m13s Details
Test / test_write_no_same (push) Successful in 13s Details
Test / test_rebalance_verify_ec (push) Successful in 6m16s Details
Test / test_heal_csum_32k_dmj (push) Successful in 4m32s Details
Test / test_heal_pg_size_2 (push) Successful in 4m37s Details
Test / test_heal_ec (push) Successful in 4m50s Details
Test / test_heal_csum_32k_dj (push) Successful in 5m53s Details
Test / test_heal_csum_32k (push) Successful in 6m28s Details
Test / test_heal_csum_4k_dmj (push) Successful in 6m27s Details
Test / test_heal_csum_4k_dj (push) Successful in 6m13s Details
Test / test_scrub_zero_osd_2 (push) Successful in 35s Details
Test / test_scrub (push) Successful in 38s Details
Test / test_scrub_xor (push) Successful in 35s Details
Test / test_scrub_ec (push) Successful in 49s Details
Test / test_scrub_pg_size_6_pg_minsize_4_osd_count_6_ec (push) Successful in 57s Details
Test / test_nfs (push) Successful in 41s Details
Test / test_scrub_pg_size_3 (push) Successful in 1m35s Details
Test / test_heal_csum_4k (push) Successful in 6m0s Details
2024-03-09 15:25:21 +03:00
Vitaliy Filippov 4af3c61bd2 Ignore ECANCELED in nfs-proxy (happens in io_uring on fork) 2024-03-09 15:25:21 +03:00
Vitaliy Filippov d73601d7d7 Support unaligned shared_offsets, align shared file data instead of header 2024-03-09 15:25:21 +03:00
Vitaliy Filippov 558cf369c0 Implement auto-unmount local NFS server mode for vitastor-nfs
Test / test_interrupted_rebalance_ec_imm (push) Successful in 1m31s Details
Test / test_move_reappear (push) Successful in 22s Details
Test / test_snapshot_down (push) Successful in 28s Details
Test / test_snapshot_down_ec (push) Successful in 29s Details
Test / test_splitbrain (push) Successful in 23s Details
Test / test_snapshot_chain (push) Successful in 2m20s Details
Test / test_snapshot_chain_ec (push) Successful in 2m52s Details
Test / test_rebalance_verify_imm (push) Successful in 3m40s Details
Test / test_rebalance_verify (push) Successful in 4m24s Details
Test / test_switch_primary (push) Successful in 33s Details
Test / test_write (push) Successful in 57s Details
Test / test_write_xor (push) Successful in 55s Details
Test / test_write_no_same (push) Successful in 15s Details
Test / test_rebalance_verify_ec_imm (push) Successful in 3m18s Details
Test / test_rebalance_verify_ec (push) Successful in 7m15s Details
Test / test_heal_pg_size_2 (push) Successful in 4m13s Details
Test / test_heal_csum_32k_dmj (push) Successful in 4m12s Details
Test / test_heal_ec (push) Successful in 4m54s Details
Test / test_heal_csum_32k_dj (push) Successful in 6m7s Details
Test / test_heal_csum_4k_dmj (push) Successful in 5m53s Details
Test / test_heal_csum_32k (push) Successful in 6m0s Details
Test / test_scrub_zero_osd_2 (push) Successful in 1m5s Details
Test / test_scrub (push) Successful in 1m7s Details
Test / test_heal_csum_4k_dj (push) Successful in 6m36s Details
Test / test_scrub_xor (push) Successful in 59s Details
Test / test_scrub_pg_size_6_pg_minsize_4_osd_count_6_ec (push) Successful in 1m5s Details
Test / test_nfs (push) Successful in 39s Details
Test / test_scrub_ec (push) Successful in 59s Details
Test / test_scrub_pg_size_3 (push) Successful in 1m55s Details
Test / test_heal_csum_4k (push) Successful in 4m54s Details
2024-03-08 14:54:58 +03:00
Vitaliy Filippov 4d733e3159 Return error on failed shrink
Test / test_move_reappear (push) Successful in 19s Details
Test / test_rm (push) Successful in 12s Details
Test / test_snapshot_down (push) Successful in 30s Details
Test / test_snapshot_down_ec (push) Successful in 27s Details
Test / test_splitbrain (push) Successful in 25s Details
Test / test_snapshot_chain (push) Successful in 2m10s Details
Test / test_snapshot_chain_ec (push) Successful in 3m9s Details
Test / test_rebalance_verify_imm (push) Successful in 3m13s Details
Test / test_rebalance_verify (push) Successful in 3m50s Details
Test / test_switch_primary (push) Successful in 38s Details
Test / test_write (push) Successful in 43s Details
Test / test_write_no_same (push) Successful in 17s Details
Test / test_write_xor (push) Successful in 1m2s Details
Test / test_rebalance_verify_ec (push) Successful in 5m20s Details
Test / test_rebalance_verify_ec_imm (push) Successful in 4m23s Details
Test / test_heal_pg_size_2 (push) Successful in 3m27s Details
Test / test_heal_ec (push) Successful in 3m54s Details
Test / test_heal_csum_32k_dmj (push) Successful in 5m53s Details
Test / test_heal_csum_32k_dj (push) Successful in 5m47s Details
Test / test_heal_csum_32k (push) Successful in 7m2s Details
Test / test_heal_csum_4k_dmj (push) Successful in 6m45s Details
Test / test_scrub (push) Successful in 1m17s Details
Test / test_scrub_zero_osd_2 (push) Successful in 42s Details
Test / test_scrub_pg_size_3 (push) Successful in 2m2s Details
Test / test_heal_csum_4k_dj (push) Successful in 5m57s Details
Test / test_heal_csum_4k (push) Successful in 5m56s Details
Test / test_nfs (push) Successful in 16s Details
Test / test_scrub_pg_size_6_pg_minsize_4_osd_count_6_ec (push) Successful in 24s Details
Test / test_scrub_ec (push) Successful in 24s Details
Test / test_scrub_xor (push) Failing after 3m6s Details
2024-03-07 19:51:05 +03:00
Vitaliy Filippov bcb507be7a Implement rename over an existing file/directory 2024-03-07 19:51:05 +03:00
Vitaliy Filippov 70773deaf1 Support --logfile in nfs-proxy 2024-03-07 19:51:05 +03:00
Vitaliy Filippov d5e3d70851 Fix shared file overlap, add FIXMEs 2024-03-07 19:51:05 +03:00
Vitaliy Filippov 3b233eb0f4 Create inode, then direntry, not direntry, then inode; retry ID collisions 2024-03-07 19:51:05 +03:00
Vitaliy Filippov 7e6f2aa077 Fix NFS shared/aligned write FIXMEs 2024-03-07 19:51:05 +03:00
Vitaliy Filippov ffbeaf736b Allow to disable per-inode stats for VitastorFS pools 2024-03-07 19:51:05 +03:00
5 changed files with 21 additions and 45 deletions

View File

@ -1213,10 +1213,6 @@ 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)
@ -1224,6 +1220,10 @@ 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,6 +15,7 @@ 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;
@ -59,6 +60,12 @@ 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();
@ -140,6 +147,8 @@ 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,11 +58,10 @@ 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) [-o <OPT>] mount <MOUNTPOINT>\n"
"vitastor-nfs (--fs <NAME> | --block) 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"
@ -102,16 +101,6 @@ 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;
@ -180,7 +169,6 @@ 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);
@ -1076,25 +1064,7 @@ 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,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";
std::string opts = ("port="+std::to_string(listening_port)+",mountport="+std::to_string(listening_port)+",nfsvers=3,soft,nolock,tcp");
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,7 +32,6 @@ 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);
}
bool pools = changes.find(st_cli.etcd_prefix+"/config/pools") != changes.end();
if (pools)
{
apply_no_inode_stats();
}
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 (pools || pgs)
{
apply_pg_count();
@ -423,8 +423,6 @@ 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 }
@ -613,9 +611,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();
}