{
f->open_object_section("result");
{
- std::lock_guard l{m_client->client_lock};
+ std::scoped_lock l{m_client->client_lock};
if (command == "mds_requests")
m_client->dump_mds_requests(f);
else if (command == "mds_sessions")
vinodeno_t Client::map_faked_ino(ino_t ino)
{
- std::lock_guard lock(client_lock);
+ std::scoped_lock lock(client_lock);
return _map_faked_ino(ino);
}
// It is necessary to hold client_lock, because any inode destruction
// may call into ObjectCacher, which asserts that it's lock (which is
// client_lock) is held.
- std::lock_guard l{client_lock};
+ std::scoped_lock l{client_lock};
tear_down_cache();
}
inodeno_t Client::get_root_ino()
{
- std::lock_guard l(client_lock);
+ std::scoped_lock l(client_lock);
if (use_faked_inos())
return root->faked_ino;
else
Inode *Client::get_root()
{
- std::lock_guard l(client_lock);
+ std::scoped_lock l(client_lock);
root->ll_get();
return root;
}
_pre_init();
{
- std::lock_guard l{client_lock};
+ std::scoped_lock l{client_lock};
messenger->add_dispatcher_tail(this);
}
_finish_init();
void Client::_finish_init()
{
{
- std::lock_guard l{client_lock};
+ std::scoped_lock l{client_lock};
// logger
PerfCountersBuilder plb(cct, "client", l_c_first, l_c_last);
plb.add_time_avg(l_c_reply, "reply", "Latency of receiving a reply on metadata request");
// If we were not mounted, but were being used for sending
// MDS commands, we may have sessions that need closing.
{
- std::lock_guard l{client_lock};
+ std::scoped_lock l{client_lock};
_close_sessions();
}
cct->_conf.remove_observer(this);
RWRef_t iref_reader(initialize_state, CLIENT_INITIALIZED);
ceph_assert(iref_reader.is_state_satisfied());
- std::lock_guard l(client_lock);
+ std::scoped_lock l(client_lock);
auto it = metadata.find(k);
if (it != metadata.end()) {
// if (!is_initialized())
// return true;
- std::lock_guard l(client_lock);
+ std::scoped_lock l(client_lock);
switch (m->get_type()) {
// mounting and mds sessions
void Client::flush_set_callback(ObjectCacher::ObjectSet *oset)
{
- // std::lock_guard l(client_lock);
+ // std::scoped_lock l(client_lock);
ceph_assert(ceph_mutex_is_locked(client_lock)); // will be called via dispatch() -> objecter -> ...
Inode *in = static_cast<Inode *>(oset->parent);
ceph_assert(in);
if (!mref_reader.is_state_satisfied())
return;
- std::lock_guard lock(client_lock);
+ std::scoped_lock lock(client_lock);
dir_result_t *d = static_cast<dir_result_t*>(dirp);
_readdir_drop_dirp_buffer(d);
d->reset();
if (!mref_reader.is_state_satisfied())
return;
- std::lock_guard lock(client_lock);
+ std::scoped_lock lock(client_lock);
if (offset == dirp->offset)
return;
if (!mref_reader.is_state_satisfied())
return -ENOTCONN;
- std::lock_guard lock(client_lock);
+ std::scoped_lock lock(client_lock);
dir_result_t *dirp = static_cast<dir_result_t*>(d);
if (!mref_reader.is_state_satisfied())
return -ENOTCONN;
- std::lock_guard lock(client_lock);
+ std::scoped_lock lock(client_lock);
MetaRequest *req = new MetaRequest(CEPH_MDS_OP_LOOKUPHASH);
filepath path(ino);
req->set_filepath(path);
int Client::lookup_ino(inodeno_t ino, const UserPerm& perms, Inode **inode)
{
- std::lock_guard lock(client_lock);
+ std::scoped_lock lock(client_lock);
return _lookup_ino(ino, perms, inode);
}
int Client::lookup_name(Inode *ino, Inode *parent, const UserPerm& perms)
{
- std::lock_guard lock(client_lock);
+ std::scoped_lock lock(client_lock);
return _lookup_name(ino, parent, perms);
}
if (!mref_reader.is_state_satisfied())
return;
- std::lock_guard l(client_lock);
+ std::scoped_lock l(client_lock);
_getcwd(dir, perms);
}
{
if (!args)
return;
- std::lock_guard l(client_lock);
+ std::scoped_lock l(client_lock);
ldout(cct, 10) << __func__ << " cb " << args->handle
<< " invalidate_ino_cb " << args->ino_cb
<< " invalidate_dentry_cb " << args->dentry_cb
if (!mref_reader.is_state_satisfied())
return -ENOTCONN;
- std::lock_guard l(client_lock);
+ std::scoped_lock l(client_lock);
return _sync_fs();
}
int64_t Client::drop_caches()
{
- std::lock_guard l(client_lock);
+ std::scoped_lock l(client_lock);
return objectcacher->release_all();
}
int Client::lazyio(int fd, int enable)
{
- std::lock_guard l(client_lock);
+ std::scoped_lock l(client_lock);
Fh *f = get_filehandle(fd);
if (!f)
return -EBADF;
int Client::lazyio_propagate(int fd, loff_t offset, size_t count)
{
- std::lock_guard l(client_lock);
+ std::scoped_lock l(client_lock);
ldout(cct, 3) << "op: client->lazyio_propagate(" << fd
<< ", " << offset << ", " << count << ")" << dendl;
int Client::lazyio_synchronize(int fd, loff_t offset, size_t count)
{
- std::lock_guard l(client_lock);
+ std::scoped_lock l(client_lock);
ldout(cct, 3) << "op: client->lazyio_synchronize(" << fd
<< ", " << offset << ", " << count << ")" << dendl;
if (!mref_reader.is_state_satisfied())
return -ENOTCONN;
- std::lock_guard l(client_lock);
+ std::scoped_lock l(client_lock);
filepath path(relpath);
InodeRef in;
if (!mref_reader.is_state_satisfied())
return -ENOTCONN;
- std::lock_guard l(client_lock);
+ std::scoped_lock l(client_lock);
filepath path(relpath);
InodeRef in;
if (!mref_reader.is_state_satisfied())
return -ENOTCONN;
- std::lock_guard lock(client_lock);
+ std::scoped_lock lock(client_lock);
Fh *f = get_filehandle(fd);
if (!f)
if (!mref_reader.is_state_satisfied())
return -ENOTCONN;
- std::lock_guard lock(client_lock);
+ std::scoped_lock lock(client_lock);
filepath p(path);
InodeRef in;
if (!mref_reader.is_state_satisfied())
return -ENOTCONN;
- std::lock_guard lock(client_lock);
+ std::scoped_lock lock(client_lock);
ldout(cct, 3) << "ll_lookup_inode " << ino << dendl;
// Num1: get inode and *inode
bool Client::ll_forget(Inode *in, uint64_t count)
{
- std::lock_guard lock(client_lock);
+ std::scoped_lock lock(client_lock);
return _ll_forget(in, count);
}
int Client::ll_get_snap_ref(snapid_t snap)
{
- std::lock_guard lock(client_lock);
+ std::scoped_lock lock(client_lock);
auto p = ll_snap_ref.find(snap);
if (p != ll_snap_ref.end())
return p->second;
snapid_t Client::ll_get_snapid(Inode *in)
{
- std::lock_guard lock(client_lock);
+ std::scoped_lock lock(client_lock);
return in->snapid;
}
if (!mref_reader.is_state_satisfied())
return NULL;
- std::lock_guard lock(client_lock);
+ std::scoped_lock lock(client_lock);
vinodeno_t vino = _map_faked_ino(ino);
unordered_map<vinodeno_t,Inode*>::iterator p = inode_map.find(vino);
if (!mref_reader.is_state_satisfied())
return NULL;
- std::lock_guard lock(client_lock);
+ std::scoped_lock lock(client_lock);
unordered_map<vinodeno_t,Inode*>::iterator p = inode_map.find(vino);
if (p == inode_map.end())
if (!mref_reader.is_state_satisfied())
return -ENOTCONN;
- std::lock_guard lock(client_lock);
+ std::scoped_lock lock(client_lock);
int res = _ll_getattr(in, CEPH_STAT_CAP_INODE_ALL, perms);
if (!mref_reader.is_state_satisfied())
return -ENOTCONN;
- std::lock_guard lock(client_lock);
+ std::scoped_lock lock(client_lock);
int res = 0;
unsigned mask = statx_to_mask(flags, want);
if (!mref_reader.is_state_satisfied())
return -ENOTCONN;
- std::lock_guard lock(client_lock);
+ std::scoped_lock lock(client_lock);
InodeRef target(in);
int res = _ll_setattrx(in, stx, mask, perms, &target);
if (!mref_reader.is_state_satisfied())
return -ENOTCONN;
- std::lock_guard lock(client_lock);
+ std::scoped_lock lock(client_lock);
InodeRef target(in);
int res = _ll_setattrx(in, &stx, mask, perms, &target);
if (!mref_reader.is_state_satisfied())
return -ENOTCONN;
- std::lock_guard lock(client_lock);
+ std::scoped_lock lock(client_lock);
InodeRef in;
int r = Client::path_walk(path, &in, perms, true, CEPH_STAT_CAP_XATTR);
if (!mref_reader.is_state_satisfied())
return -ENOTCONN;
- std::lock_guard lock(client_lock);
+ std::scoped_lock lock(client_lock);
InodeRef in;
int r = Client::path_walk(path, &in, perms, false, CEPH_STAT_CAP_XATTR);
if (!mref_reader.is_state_satisfied())
return -ENOTCONN;
- std::lock_guard lock(client_lock);
+ std::scoped_lock lock(client_lock);
Fh *f = get_filehandle(fd);
if (!f)
if (!mref_reader.is_state_satisfied())
return -ENOTCONN;
- std::lock_guard lock(client_lock);
+ std::scoped_lock lock(client_lock);
InodeRef in;
int r = Client::path_walk(path, &in, perms, true, CEPH_STAT_CAP_XATTR);
if (!mref_reader.is_state_satisfied())
return -ENOTCONN;
- std::lock_guard lock(client_lock);
+ std::scoped_lock lock(client_lock);
InodeRef in;
int r = Client::path_walk(path, &in, perms, false, CEPH_STAT_CAP_XATTR);
if (!mref_reader.is_state_satisfied())
return -ENOTCONN;
- std::lock_guard lock(client_lock);
+ std::scoped_lock lock(client_lock);
Fh *f = get_filehandle(fd);
if (!f)
if (!mref_reader.is_state_satisfied())
return -ENOTCONN;
- std::lock_guard lock(client_lock);
+ std::scoped_lock lock(client_lock);
InodeRef in;
int r = Client::path_walk(path, &in, perms, true);
if (!mref_reader.is_state_satisfied())
return -ENOTCONN;
- std::lock_guard lock(client_lock);
+ std::scoped_lock lock(client_lock);
InodeRef in;
int r = Client::path_walk(path, &in, perms, false);
if (!mref_reader.is_state_satisfied())
return -ENOTCONN;
- std::lock_guard lock(client_lock);
+ std::scoped_lock lock(client_lock);
Fh *f = get_filehandle(fd);
if (!f)
if (!mref_reader.is_state_satisfied())
return -ENOTCONN;
- std::lock_guard lock(client_lock);
+ std::scoped_lock lock(client_lock);
InodeRef in;
int r = Client::path_walk(path, &in, perms, true);
if (!mref_reader.is_state_satisfied())
return -ENOTCONN;
- std::lock_guard lock(client_lock);
+ std::scoped_lock lock(client_lock);
InodeRef in;
int r = Client::path_walk(path, &in, perms, false);
if (!mref_reader.is_state_satisfied())
return -ENOTCONN;
- std::lock_guard lock(client_lock);
+ std::scoped_lock lock(client_lock);
Fh *f = get_filehandle(fd);
if (!f)
int Client::ll_num_osds(void)
{
- std::lock_guard lock(client_lock);
+ std::scoped_lock lock(client_lock);
return objecter->with_osdmap(std::mem_fn(&OSDMap::get_num_osds));
}
int Client::ll_osdaddr(int osd, uint32_t *addr)
{
- std::lock_guard lock(client_lock);
+ std::scoped_lock lock(client_lock);
entity_addr_t g;
bool exists = objecter->with_osdmap([&](const OSDMap& o) {
uint32_t Client::ll_stripe_unit(Inode *in)
{
- std::lock_guard lock(client_lock);
+ std::scoped_lock lock(client_lock);
return in->layout.stripe_unit;
}
uint64_t Client::ll_snap_seq(Inode *in)
{
- std::lock_guard lock(client_lock);
+ std::scoped_lock lock(client_lock);
return in->snaprealm->seq;
}
int Client::ll_file_layout(Inode *in, file_layout_t *layout)
{
- std::lock_guard lock(client_lock);
+ std::scoped_lock lock(client_lock);
*layout = in->layout;
return 0;
}
int Client::ll_get_stripe_osd(Inode *in, uint64_t blockno,
file_layout_t* layout)
{
- std::lock_guard lock(client_lock);
+ std::scoped_lock lock(client_lock);
inodeno_t ino = in->ino;
uint32_t object_size = layout->object_size;
uint64_t Client::ll_get_internal_offset(Inode *in, uint64_t blockno)
{
- std::lock_guard lock(client_lock);
+ std::scoped_lock lock(client_lock);
file_layout_t *layout=&(in->layout);
uint32_t object_size = layout->object_size;
uint32_t su = layout->stripe_unit;
if (!mref_reader.is_state_satisfied())
return -ENOTCONN;
- std::lock_guard lock(client_lock);
+ std::scoped_lock lock(client_lock);
InodeRef in;
int r = _ll_create(parent, name, mode, flags, &in, CEPH_STAT_CAP_INODE_ALL,
if (!mref_reader.is_state_satisfied())
return -ENOTCONN;
- std::lock_guard lock(client_lock);
+ std::scoped_lock lock(client_lock);
InodeRef in;
int r = _ll_create(parent, name, mode, oflags, &in, caps, fhp, perms);
req->get();
}
void finish(int r) override {
- std::lock_guard l(client->client_lock);
+ std::scoped_lock l(client->client_lock);
ceph_assert(req->head.op == CEPH_MDS_OP_SETFILELOCK);
client->_interrupt_filelock(req);
client->put_request(req);
if (!mref_reader.is_state_satisfied())
return -ENOTCONN;
- std::lock_guard lock(client_lock);
+ std::scoped_lock lock(client_lock);
return objecter->with_osdmap(std::mem_fn(&OSDMap::lookup_pg_pool_name),
pool_name);
void Client::set_filer_flags(int flags)
{
- std::lock_guard l(client_lock);
+ std::scoped_lock l(client_lock);
ceph_assert(flags == 0 ||
flags == CEPH_OSD_FLAG_LOCALIZE_READS);
objecter->add_global_op_flags(flags);
void Client::clear_filer_flags(int flags)
{
- std::lock_guard l(client_lock);
+ std::scoped_lock l(client_lock);
ceph_assert(flags == CEPH_OSD_FLAG_LOCALIZE_READS);
objecter->clear_global_op_flag(flags);
}
RWRef_t iref_reader(initialize_state, CLIENT_INITIALIZED);
ceph_assert(iref_reader.is_state_satisfied());
- std::lock_guard l(client_lock);
+ std::scoped_lock l(client_lock);
assert(!uuid.empty());
metadata["uuid"] = uuid;
RWRef_t iref_reader(initialize_state, CLIENT_INITIALIZED);
ceph_assert(iref_reader.is_state_satisfied());
- std::lock_guard l(client_lock);
+ std::scoped_lock l(client_lock);
metadata["timeout"] = stringify(timeout);
}
void Client::handle_conf_change(const ConfigProxy& conf,
const std::set <std::string> &changed)
{
- std::lock_guard lock(client_lock);
+ std::scoped_lock lock(client_lock);
if (changed.count("client_cache_mid")) {
lru.lru_set_midpoint(cct->_conf->client_cache_mid);