Do not happily NBD "map" non-existing images, do not try to benchmark them too

non-odp-rdma
Vitaliy Filippov 2022-01-23 23:02:01 +03:00
parent 2a0b881685
commit 0757ba630a
2 changed files with 12 additions and 0 deletions

View File

@ -247,6 +247,12 @@ static int sec_setup(struct thread_data *td)
vitastor_c_uring_wait_events(bsd->cli);
}
td->files[0]->real_file_size = vitastor_c_inode_get_size(bsd->watch);
if (!vitastor_c_inode_get_num(bsd->watch) ||
!td->files[0]->real_file_size)
{
td_verror(td, EINVAL, "image does not exist");
return 1;
}
}
bsd->trace = o->trace ? true : false;

View File

@ -190,6 +190,12 @@ public:
}
watch = cli->st_cli.watch_inode(image_name);
device_size = watch->cfg.size;
if (!watch->cfg.num || !device_size)
{
// Image does not exist
fprintf(stderr, "Image %s does not exist\n", image_name.c_str());
exit(1);
}
}
// Initialize NBD
int sockfd[2];