{
Mutex::Locker lock(client_lock);
- assert(initialized);
+ if (!initialized)
+ return -ENOTCONN;
int r;
r = authenticate();
{
Mutex::Locker lock(client_lock);
- assert(mounted); // caller is confused?
+ if (unmounting)
+ return;
ldout(cct, 2) << "unmounting" << dendl;
unmounting = true;
tout(cct) << relexisting << std::endl;
tout(cct) << relpath << std::endl;
+ if (unmounting)
+ return -ENOTCONN;
+
filepath existing(relexisting);
InodeRef in, dir;
tout(cct) << "unlink" << std::endl;
tout(cct) << relpath << std::endl;
+ if (unmounting)
+ return -ENOTCONN;
+
if (std::string(relpath) == "/")
return -EISDIR;
tout(cct) << relfrom << std::endl;
tout(cct) << relto << std::endl;
+ if (unmounting)
+ return -ENOTCONN;
+
if (std::string(relfrom) == "/" || std::string(relto) == "/")
return -EBUSY;
tout(cct) << mode << std::endl;
ldout(cct, 10) << "mkdir: " << relpath << dendl;
+ if (unmounting)
+ return -ENOTCONN;
+
if (std::string(relpath) == "/")
return -EEXIST;
tout(cct) << relpath << std::endl;
tout(cct) << mode << std::endl;
+ if (unmounting)
+ return -ENOTCONN;
+
//get through existing parts of path
filepath path(relpath);
unsigned int i;
tout(cct) << "rmdir" << std::endl;
tout(cct) << relpath << std::endl;
+ if (unmounting)
+ return -ENOTCONN;
+
if (std::string(relpath) == "/")
return -EBUSY;
tout(cct) << mode << std::endl;
tout(cct) << rdev << std::endl;
+ if (unmounting)
+ return -ENOTCONN;
+
if (std::string(relpath) == "/")
return -EEXIST;
tout(cct) << target << std::endl;
tout(cct) << relpath << std::endl;
+ if (unmounting)
+ return -ENOTCONN;
+
if (std::string(relpath) == "/")
return -EEXIST;
tout(cct) << "readlink" << std::endl;
tout(cct) << relpath << std::endl;
+ if (unmounting)
+ return -ENOTCONN;
+
filepath path(relpath);
InodeRef in;
int r = path_walk(path, &in, perms, false);
tout(cct) << relpath << std::endl;
tout(cct) << mask << std::endl;
+ if (unmounting)
+ return -ENOTCONN;
+
filepath path(relpath);
InodeRef in;
int r = path_walk(path, &in, perms);
tout(cct) << relpath << std::endl;
tout(cct) << mask << std::endl;
+ if (unmounting)
+ return -ENOTCONN;
+
filepath path(relpath);
InodeRef in;
int r = path_walk(path, &in, perms, !(flags & AT_SYMLINK_NOFOLLOW));
tout(cct) << fd << std::endl;
tout(cct) << mask << std::endl;
+ if (unmounting)
+ return -ENOTCONN;
+
Fh *f = get_filehandle(fd);
if (!f)
return -EBADF;
tout(cct) << fd << std::endl;
tout(cct) << mask << std::endl;
+ if (unmounting)
+ return -ENOTCONN;
+
Fh *f = get_filehandle(fd);
if (!f)
return -EBADF;
Mutex::Locker lock(client_lock);
tout(cct) << "stat" << std::endl;
tout(cct) << relpath << std::endl;
+
+ if (unmounting)
+ return -ENOTCONN;
+
filepath path(relpath);
InodeRef in;
int r = path_walk(path, &in, perms, true, mask);
Mutex::Locker lock(client_lock);
tout(cct) << "statx" << std::endl;
tout(cct) << relpath << std::endl;
+
+ if (unmounting)
+ return -ENOTCONN;
+
filepath path(relpath);
InodeRef in;
Mutex::Locker lock(client_lock);
tout(cct) << "lstat" << std::endl;
tout(cct) << relpath << std::endl;
+
+ if (unmounting)
+ return -ENOTCONN;
+
filepath path(relpath);
InodeRef in;
// don't follow symlinks
tout(cct) << "chmod" << std::endl;
tout(cct) << relpath << std::endl;
tout(cct) << mode << std::endl;
+
+ if (unmounting)
+ return -ENOTCONN;
+
filepath path(relpath);
InodeRef in;
int r = path_walk(path, &in, perms);
tout(cct) << "fchmod" << std::endl;
tout(cct) << fd << std::endl;
tout(cct) << mode << std::endl;
+
+ if (unmounting)
+ return -ENOTCONN;
+
Fh *f = get_filehandle(fd);
if (!f)
return -EBADF;
tout(cct) << "lchmod" << std::endl;
tout(cct) << relpath << std::endl;
tout(cct) << mode << std::endl;
+
+ if (unmounting)
+ return -ENOTCONN;
+
filepath path(relpath);
InodeRef in;
// don't follow symlinks
tout(cct) << relpath << std::endl;
tout(cct) << new_uid << std::endl;
tout(cct) << new_gid << std::endl;
+
+ if (unmounting)
+ return -ENOTCONN;
+
filepath path(relpath);
InodeRef in;
int r = path_walk(path, &in, perms);
tout(cct) << fd << std::endl;
tout(cct) << new_uid << std::endl;
tout(cct) << new_gid << std::endl;
+
+ if (unmounting)
+ return -ENOTCONN;
+
Fh *f = get_filehandle(fd);
if (!f)
return -EBADF;
tout(cct) << relpath << std::endl;
tout(cct) << new_uid << std::endl;
tout(cct) << new_gid << std::endl;
+
+ if (unmounting)
+ return -ENOTCONN;
+
filepath path(relpath);
InodeRef in;
// don't follow symlinks
tout(cct) << relpath << std::endl;
tout(cct) << buf->modtime << std::endl;
tout(cct) << buf->actime << std::endl;
+
+ if (unmounting)
+ return -ENOTCONN;
+
filepath path(relpath);
InodeRef in;
int r = path_walk(path, &in, perms);
tout(cct) << relpath << std::endl;
tout(cct) << buf->modtime << std::endl;
tout(cct) << buf->actime << std::endl;
+
+ if (unmounting)
+ return -ENOTCONN;
+
filepath path(relpath);
InodeRef in;
// don't follow symlinks
tout(cct) << fd << std::endl;
tout(cct) << operation << std::endl;
tout(cct) << owner << std::endl;
+
+ if (unmounting)
+ return -ENOTCONN;
+
Fh *f = get_filehandle(fd);
if (!f)
return -EBADF;
Mutex::Locker lock(client_lock);
tout(cct) << "opendir" << std::endl;
tout(cct) << relpath << std::endl;
+
+ if (unmounting)
+ return -ENOTCONN;
+
filepath path(relpath);
InodeRef in;
int r = path_walk(path, &in, perms, true);
void Client::rewinddir(dir_result_t *dirp)
{
Mutex::Locker lock(client_lock);
-
ldout(cct, 3) << "rewinddir(" << dirp << ")" << dendl;
+
+ if (unmounting)
+ return;
+
dir_result_t *d = static_cast<dir_result_t*>(dirp);
_readdir_drop_dirp_buffer(d);
d->reset();
ldout(cct, 3) << "seekdir(" << dirp << ", " << offset << ")" << dendl;
+ if (unmounting)
+ return;
+
if (offset == dirp->offset)
return;
Mutex::Locker lock(client_lock);
+ if (unmounting)
+ return -ENOTCONN;
+
dir_result_t *dirp = static_cast<dir_result_t*>(d);
ldout(cct, 10) << "readdir_r_cb " << *dirp->inode << " offset " << hex << dirp->offset
tout(cct) << relpath << std::endl;
tout(cct) << ceph_flags_sys2wire(flags) << std::endl;
+ if (unmounting)
+ return -ENOTCONN;
+
Fh *fh = NULL;
#if defined(__linux__) && defined(O_PATH)
Mutex::Locker lock(client_lock);
ldout(cct, 3) << "lookup_hash enter(" << ino << ", #" << dirino << "/" << name << ")" << dendl;
+ if (unmounting)
+ return -ENOTCONN;
+
MetaRequest *req = new MetaRequest(CEPH_MDS_OP_LOOKUPHASH);
filepath path(ino);
req->set_filepath(path);
Mutex::Locker lock(client_lock);
ldout(cct, 3) << "lookup_ino enter(" << ino << ")" << dendl;
+ if (unmounting)
+ return -ENOTCONN;
+
MetaRequest *req = new MetaRequest(CEPH_MDS_OP_LOOKUPINO);
filepath path(ino);
req->set_filepath(path);
Mutex::Locker lock(client_lock);
ldout(cct, 3) << "lookup_parent enter(" << ino->ino << ")" << dendl;
+ if (unmounting)
+ return -ENOTCONN;
+
if (!ino->dn_set.empty()) {
// if we exposed the parent here, we'd need to check permissions,
// but right now we just rely on the MDS doing so in make_request
Mutex::Locker lock(client_lock);
ldout(cct, 3) << "lookup_name enter(" << ino->ino << ")" << dendl;
+ if (unmounting)
+ return -ENOTCONN;
+
MetaRequest *req = new MetaRequest(CEPH_MDS_OP_LOOKUPNAME);
req->set_filepath2(filepath(parent->ino));
req->set_filepath(filepath(ino->ino));
tout(cct) << "close" << std::endl;
tout(cct) << fd << std::endl;
+ if (unmounting)
+ return -ENOTCONN;
+
Fh *fh = get_filehandle(fd);
if (!fh)
return -EBADF;
tout(cct) << offset << std::endl;
tout(cct) << whence << std::endl;
+ if (unmounting)
+ return -ENOTCONN;
+
Fh *f = get_filehandle(fd);
if (!f)
return -EBADF;
tout(cct) << size << std::endl;
tout(cct) << offset << std::endl;
+ if (unmounting)
+ return -ENOTCONN;
+
Fh *f = get_filehandle(fd);
if (!f)
return -EBADF;
tout(cct) << size << std::endl;
tout(cct) << offset << std::endl;
+ if (unmounting)
+ return -ENOTCONN;
+
Fh *fh = get_filehandle(fd);
if (!fh)
return -EBADF;
tout(cct) << fd << std::endl;
tout(cct) << offset << std::endl;
+ if (unmounting)
+ return -ENOTCONN;
+
Fh *fh = get_filehandle(fd);
if (!fh)
return -EBADF;
tout(cct) << fd << std::endl;
tout(cct) << length << std::endl;
+ if (unmounting)
+ return -ENOTCONN;
+
Fh *f = get_filehandle(fd);
if (!f)
return -EBADF;
tout(cct) << fd << std::endl;
tout(cct) << syncdataonly << std::endl;
+ if (unmounting)
+ return -ENOTCONN;
+
Fh *f = get_filehandle(fd);
if (!f)
return -EBADF;
tout(cct) << "fstat mask " << hex << mask << dec << std::endl;
tout(cct) << fd << std::endl;
+ if (unmounting)
+ return -ENOTCONN;
+
Fh *f = get_filehandle(fd);
if (!f)
return -EBADF;
tout(cct) << "fstatx flags " << hex << flags << " want " << want << dec << std::endl;
tout(cct) << fd << std::endl;
+ if (unmounting)
+ return -ENOTCONN;
+
Fh *f = get_filehandle(fd);
if (!f)
return -EBADF;
Mutex::Locker lock(client_lock);
tout(cct) << "chdir" << std::endl;
tout(cct) << relpath << std::endl;
+
+ if (unmounting)
+ return -ENOTCONN;
+
filepath path(relpath);
InodeRef in;
int r = path_walk(path, &in, perms);
void Client::getcwd(string& dir, const UserPerm& perms)
{
Mutex::Locker l(client_lock);
- _getcwd(dir, perms);
+ if (!unmounting)
+ _getcwd(dir, perms);
}
int Client::statfs(const char *path, struct statvfs *stbuf,
Mutex::Locker l(client_lock);
tout(cct) << "statfs" << std::endl;
+ if (unmounting)
+ return -ENOTCONN;
+
ceph_statfs stats;
C_SaferCond cond;
int Client::sync_fs()
{
Mutex::Locker l(client_lock);
+
+ if (unmounting)
+ return -ENOTCONN;
+
return _sync_fs();
}
int Client::mksnap(const char *relpath, const char *name, const UserPerm& perm)
{
Mutex::Locker l(client_lock);
+
+ if (unmounting)
+ return -ENOTCONN;
+
filepath path(relpath);
InodeRef in;
int r = path_walk(path, &in, perm);
Inode *snapdir = open_snapdir(in.get());
return _mkdir(snapdir, name, 0, perm);
}
+
int Client::rmsnap(const char *relpath, const char *name, const UserPerm& perms)
{
Mutex::Locker l(client_lock);
+
+ if (unmounting)
+ return -ENOTCONN;
+
filepath path(relpath);
InodeRef in;
int r = path_walk(path, &in, perms);
Mutex::Locker lock(client_lock);
+ if (unmounting)
+ return -ENOTCONN;
+
Fh *f = get_filehandle(fd);
if (!f)
return -EBADF;
int Client::get_caps_issued(const char *path, const UserPerm& perms)
{
Mutex::Locker lock(client_lock);
+
+ if (unmounting)
+ return -ENOTCONN;
+
filepath p(path);
InodeRef in;
int r = path_walk(p, &in, perms, true);
tout(cct) << "ll_lookup" << std::endl;
tout(cct) << name << std::endl;
+ if (unmounting)
+ return -ENOTCONN;
+
int r = 0;
if (!cct->_conf->fuse_default_permissions) {
r = may_lookup(parent, perms);
tout(cct) << "ll_lookupx" << std::endl;
tout(cct) << name << std::endl;
+ if (unmounting)
+ return -ENOTCONN;
+
int r = 0;
if (!cct->_conf->fuse_default_permissions) {
r = may_lookup(parent, perms);
unsigned int want, unsigned int flags, const UserPerm& perms)
{
Mutex::Locker lock(client_lock);
+
+ if (unmounting)
+ return -ENOTCONN;
+
filepath fp(name, 0);
InodeRef in;
int rc;
tout(cct) << ino.val << std::endl;
tout(cct) << count << std::endl;
+ // Ignore forget if we're no longer mounted
+ if (unmounting)
+ return true;
+
if (ino == 1) return true; // ignore forget on root.
bool last = false;
Inode *Client::ll_get_inode(ino_t ino)
{
Mutex::Locker lock(client_lock);
+
+ if (unmounting)
+ return NULL;
+
vinodeno_t vino = _map_faked_ino(ino);
unordered_map<vinodeno_t,Inode*>::iterator p = inode_map.find(vino);
if (p == inode_map.end())
Inode *Client::ll_get_inode(vinodeno_t vino)
{
Mutex::Locker lock(client_lock);
+
+ if (unmounting)
+ return NULL;
+
unordered_map<vinodeno_t,Inode*>::iterator p = inode_map.find(vino);
if (p == inode_map.end())
return NULL;
{
Mutex::Locker lock(client_lock);
+ if (unmounting)
+ return -ENOTCONN;
+
int res = _ll_getattr(in, CEPH_STAT_CAP_INODE_ALL, perms);
if (res == 0)
{
Mutex::Locker lock(client_lock);
+ if (unmounting)
+ return -ENOTCONN;
+
int res = 0;
unsigned mask = statx_to_mask(flags, want);
const UserPerm& perms)
{
Mutex::Locker lock(client_lock);
+
+ if (unmounting)
+ return -ENOTCONN;
+
InodeRef target(in);
int res = _ll_setattrx(in, stx, mask, perms, &target);
if (res == 0) {
stat_to_statx(attr, &stx);
Mutex::Locker lock(client_lock);
+
+ if (unmounting)
+ return -ENOTCONN;
+
InodeRef target(in);
int res = _ll_setattrx(in, &stx, mask, perms, &target);
if (res == 0) {
const UserPerm& perms)
{
Mutex::Locker lock(client_lock);
+
+ if (unmounting)
+ return -ENOTCONN;
+
InodeRef in;
int r = Client::path_walk(path, &in, perms, true, CEPH_STAT_CAP_XATTR);
if (r < 0)
const UserPerm& perms)
{
Mutex::Locker lock(client_lock);
+
+ if (unmounting)
+ return -ENOTCONN;
+
InodeRef in;
int r = Client::path_walk(path, &in, perms, false, CEPH_STAT_CAP_XATTR);
if (r < 0)
const UserPerm& perms)
{
Mutex::Locker lock(client_lock);
+
+ if (unmounting)
+ return -ENOTCONN;
+
Fh *f = get_filehandle(fd);
if (!f)
return -EBADF;
const UserPerm& perms)
{
Mutex::Locker lock(client_lock);
+
+ if (unmounting)
+ return -ENOTCONN;
+
InodeRef in;
int r = Client::path_walk(path, &in, perms, true, CEPH_STAT_CAP_XATTR);
if (r < 0)
const UserPerm& perms)
{
Mutex::Locker lock(client_lock);
+
+ if (unmounting)
+ return -ENOTCONN;
+
InodeRef in;
int r = Client::path_walk(path, &in, perms, false, CEPH_STAT_CAP_XATTR);
if (r < 0)
int Client::flistxattr(int fd, char *list, size_t size, const UserPerm& perms)
{
Mutex::Locker lock(client_lock);
+
+ if (unmounting)
+ return -ENOTCONN;
+
Fh *f = get_filehandle(fd);
if (!f)
return -EBADF;
const UserPerm& perms)
{
Mutex::Locker lock(client_lock);
+
+ if (unmounting)
+ return -ENOTCONN;
+
InodeRef in;
int r = Client::path_walk(path, &in, perms, true);
if (r < 0)
const UserPerm& perms)
{
Mutex::Locker lock(client_lock);
+
+ if (unmounting)
+ return -ENOTCONN;
+
InodeRef in;
int r = Client::path_walk(path, &in, perms, false);
if (r < 0)
int Client::fremovexattr(int fd, const char *name, const UserPerm& perms)
{
Mutex::Locker lock(client_lock);
+
+ if (unmounting)
+ return -ENOTCONN;
+
Fh *f = get_filehandle(fd);
if (!f)
return -EBADF;
_setxattr_maybe_wait_for_osdmap(name, value, size);
Mutex::Locker lock(client_lock);
+
+ if (unmounting)
+ return -ENOTCONN;
+
InodeRef in;
int r = Client::path_walk(path, &in, perms, true);
if (r < 0)
_setxattr_maybe_wait_for_osdmap(name, value, size);
Mutex::Locker lock(client_lock);
+
+ if (unmounting)
+ return -ENOTCONN;
+
InodeRef in;
int r = Client::path_walk(path, &in, perms, false);
if (r < 0)
_setxattr_maybe_wait_for_osdmap(name, value, size);
Mutex::Locker lock(client_lock);
+
+ if (unmounting)
+ return -ENOTCONN;
+
Fh *f = get_filehandle(fd);
if (!f)
return -EBADF;
{
Mutex::Locker lock(client_lock);
+ if (unmounting)
+ return -ENOTCONN;
+
vinodeno_t vino = _get_vino(in);
ldout(cct, 3) << "ll_getxattr " << vino << " " << name << " size " << size << dendl;
{
Mutex::Locker lock(client_lock);
+ if (unmounting)
+ return -ENOTCONN;
+
vinodeno_t vino = _get_vino(in);
ldout(cct, 3) << "ll_listxattr " << vino << " size " << size << dendl;
Mutex::Locker lock(client_lock);
+ if (unmounting)
+ return -ENOTCONN;
+
vinodeno_t vino = _get_vino(in);
ldout(cct, 3) << "ll_setxattr " << vino << " " << name << " size " << size << dendl;
{
Mutex::Locker lock(client_lock);
+ if (unmounting)
+ return -ENOTCONN;
+
vinodeno_t vino = _get_vino(in);
ldout(cct, 3) << "ll_removexattr " << vino << " " << name << dendl;
{
Mutex::Locker lock(client_lock);
+ if (unmounting)
+ return -ENOTCONN;
+
vinodeno_t vino = _get_vino(in);
ldout(cct, 3) << "ll_readlink " << vino << dendl;
{
Mutex::Locker lock(client_lock);
+ if (unmounting)
+ return -ENOTCONN;
+
vinodeno_t vparent = _get_vino(parent);
ldout(cct, 3) << "ll_mknod " << vparent << " " << name << dendl;
unsigned caps = statx_to_mask(flags, want);
Mutex::Locker lock(client_lock);
+ if (unmounting)
+ return -ENOTCONN;
+
vinodeno_t vparent = _get_vino(parent);
ldout(cct, 3) << "ll_mknodx " << vparent << " " << name << dendl;
{
Mutex::Locker lock(client_lock);
+ if (unmounting)
+ return -ENOTCONN;
+
vinodeno_t vparent = _get_vino(parent);
ldout(cct, 3) << "ll_mkdir " << vparent << " " << name << dendl;
{
Mutex::Locker lock(client_lock);
+ if (unmounting)
+ return -ENOTCONN;
+
vinodeno_t vparent = _get_vino(parent);
ldout(cct, 3) << "ll_mkdirx " << vparent << " " << name << dendl;
{
Mutex::Locker lock(client_lock);
+ if (unmounting)
+ return -ENOTCONN;
+
vinodeno_t vparent = _get_vino(parent);
ldout(cct, 3) << "ll_symlink " << vparent << " " << name << " -> " << value
{
Mutex::Locker lock(client_lock);
+ if (unmounting)
+ return -ENOTCONN;
+
vinodeno_t vparent = _get_vino(parent);
ldout(cct, 3) << "ll_symlinkx " << vparent << " " << name << " -> " << value
{
Mutex::Locker lock(client_lock);
+ if (unmounting)
+ return -ENOTCONN;
+
vinodeno_t vino = _get_vino(in);
ldout(cct, 3) << "ll_unlink " << vino << " " << name << dendl;
{
Mutex::Locker lock(client_lock);
+ if (unmounting)
+ return -ENOTCONN;
+
vinodeno_t vino = _get_vino(in);
ldout(cct, 3) << "ll_rmdir " << vino << " " << name << dendl;
{
Mutex::Locker lock(client_lock);
+ if (unmounting)
+ return -ENOTCONN;
+
vinodeno_t vparent = _get_vino(parent);
vinodeno_t vnewparent = _get_vino(newparent);
{
Mutex::Locker lock(client_lock);
+ if (unmounting)
+ return -ENOTCONN;
+
vinodeno_t vino = _get_vino(in);
vinodeno_t vnewparent = _get_vino(newparent);
int Client::ll_osdaddr(int osd, uint32_t *addr)
{
Mutex::Locker lock(client_lock);
+
entity_addr_t g;
bool exists = objecter->with_osdmap([&](const OSDMap& o) {
if (!o.exists(osd))
*addr = ntohl(nb_addr);
return 0;
}
+
uint32_t Client::ll_stripe_unit(Inode *in)
{
Mutex::Locker lock(client_lock);
file_layout_t* layout)
{
Mutex::Locker lock(client_lock);
+
inodeno_t ino = ll_get_inodeno(in);
uint32_t object_size = layout->object_size;
uint32_t su = layout->stripe_unit;
{
Mutex::Locker lock(client_lock);
+ if (unmounting)
+ return -ENOTCONN;
+
vinodeno_t vino = _get_vino(in);
ldout(cct, 3) << "ll_opendir " << vino << dendl;
ldout(cct, 3) << "ll_releasedir " << dirp << dendl;
tout(cct) << "ll_releasedir" << std::endl;
tout(cct) << (unsigned long)dirp << std::endl;
+
+ if (unmounting)
+ return -ENOTCONN;
+
_closedir(dirp);
return 0;
}
tout(cct) << "ll_fsyncdir" << std::endl;
tout(cct) << (unsigned long)dirp << std::endl;
+ if (unmounting)
+ return -ENOTCONN;
+
return _fsync(dirp->inode.get(), false);
}
Mutex::Locker lock(client_lock);
+ if (unmounting)
+ return -ENOTCONN;
+
vinodeno_t vino = _get_vino(in);
ldout(cct, 3) << "ll_open " << vino << " " << ceph_flags_sys2wire(flags) << dendl;
Mutex::Locker lock(client_lock);
InodeRef in;
+ if (unmounting)
+ return -ENOTCONN;
+
int r = _ll_create(parent, name, mode, flags, &in, CEPH_STAT_CAP_INODE_ALL,
fhp, perms);
if (r >= 0) {
Mutex::Locker lock(client_lock);
InodeRef in;
+ if (unmounting)
+ return -ENOTCONN;
int r = _ll_create(parent, name, mode, oflags, &in, caps, fhp, perms);
if (r >= 0) {
tout(cct) << offset << std::endl;
tout(cct) << whence << std::endl;
+ if (unmounting)
+ return -ENOTCONN;
+
return _lseek(fh, offset, whence);
}
tout(cct) << off << std::endl;
tout(cct) << len << std::endl;
+ if (unmounting)
+ return -ENOTCONN;
+
return _read(fh, off, len, bl);
}
file_layout_t* layout)
{
Mutex::Locker lock(client_lock);
+
+ if (unmounting)
+ return -ENOTCONN;
+
vinodeno_t vino = ll_get_vino(in);
object_t oid = file_object_t(vino.ino, blockid);
C_SaferCond onfinish;
/* lock just in time */
client_lock.Lock();
+ if (unmounting) {
+ client_lock.Unlock();
+ return -ENOTCONN;
+ }
objecter->write(oid,
object_locator_t(layout->pool_id),
tout(cct) << off << std::endl;
tout(cct) << len << std::endl;
+ if (unmounting)
+ return -ENOTCONN;
+
int r = _write(fh, off, len, data, NULL, 0);
ldout(cct, 3) << "ll_write " << fh << " " << off << "~" << len << " = " << r
<< dendl;
tout(cct) << "ll_flush" << std::endl;
tout(cct) << (unsigned long)fh << std::endl;
+ if (unmounting)
+ return -ENOTCONN;
+
return _flush(fh);
}
tout(cct) << "ll_fsync" << std::endl;
tout(cct) << (unsigned long)fh << std::endl;
+ if (unmounting)
+ return -ENOTCONN;
+
int r = _fsync(fh, syncdataonly);
if (r) {
// If we're returning an error, clear it from the FH
tout(cct) << "ll_fallocate " << mode << " " << offset << " " << length << std::endl;
tout(cct) << (unsigned long)fh << std::endl;
+ if (unmounting)
+ return -ENOTCONN;
+
return _fallocate(fh, mode, offset, length);
}
Mutex::Locker lock(client_lock);
tout(cct) << "fallocate " << " " << fd << mode << " " << offset << " " << length << std::endl;
+ if (unmounting)
+ return -ENOTCONN;
+
Fh *fh = get_filehandle(fd);
if (!fh)
return -EBADF;
tout(cct) << "ll_release (fh)" << std::endl;
tout(cct) << (unsigned long)fh << std::endl;
+ if (unmounting)
+ return -ENOTCONN;
+
if (ll_unclosed_fh_set.count(fh))
ll_unclosed_fh_set.erase(fh);
return _release_fh(fh);
ldout(cct, 3) << "ll_getlk (fh)" << fh << " " << fh->inode->ino << dendl;
tout(cct) << "ll_getk (fh)" << (unsigned long)fh << std::endl;
+ if (unmounting)
+ return -ENOTCONN;
+
return _getlk(fh, fl, owner);
}
ldout(cct, 3) << "ll_setlk (fh) " << fh << " " << fh->inode->ino << dendl;
tout(cct) << "ll_setk (fh)" << (unsigned long)fh << std::endl;
+ if (unmounting)
+ return -ENOTCONN;
+
return _setlk(fh, fl, owner, sleep);
}
ldout(cct, 3) << "ll_flock (fh) " << fh << " " << fh->inode->ino << dendl;
tout(cct) << "ll_flock (fh)" << (unsigned long)fh << std::endl;
+ if (unmounting)
+ return -ENOTCONN;
+
return _flock(fh, cmd, owner);
}
{
Mutex::Locker lock(client_lock);
+ if (unmounting)
+ return -ENOTCONN;
+
filepath path(relpath);
InodeRef in;
int r = path_walk(path, &in, perms);
{
Mutex::Locker lock(client_lock);
+ if (unmounting)
+ return -ENOTCONN;
+
Fh *f = get_filehandle(fd);
if (!f)
return -EBADF;
int64_t Client::get_default_pool_id()
{
Mutex::Locker lock(client_lock);
+
+ if (unmounting)
+ return -ENOTCONN;
+
/* first data pool is the default */
return mdsmap->get_first_data_pool();
}
int64_t Client::get_pool_id(const char *pool_name)
{
Mutex::Locker lock(client_lock);
+
+ if (unmounting)
+ return -ENOTCONN;
+
return objecter->with_osdmap(std::mem_fn(&OSDMap::lookup_pg_pool_name),
pool_name);
}
string Client::get_pool_name(int64_t pool)
{
Mutex::Locker lock(client_lock);
+
+ if (unmounting)
+ return string();
+
return objecter->with_osdmap([pool](const OSDMap& o) {
return o.have_pg_pool(pool) ? o.get_pool_name(pool) : string();
});
int Client::get_pool_replication(int64_t pool)
{
Mutex::Locker lock(client_lock);
+
+ if (unmounting)
+ return -ENOTCONN;
+
return objecter->with_osdmap([pool](const OSDMap& o) {
return o.have_pg_pool(pool) ? o.get_pg_pool(pool)->get_size() : -ENOENT;
});
{
Mutex::Locker lock(client_lock);
+ if (unmounting)
+ return -ENOTCONN;
+
Fh *f = get_filehandle(fd);
if (!f)
return -EBADF;
int Client::get_osd_crush_location(int id, vector<pair<string, string> >& path)
{
Mutex::Locker lock(client_lock);
+
+ if (unmounting)
+ return -ENOTCONN;
+
if (id < 0)
return -EINVAL;
return objecter->with_osdmap([&](const OSDMap& o) {
{
Mutex::Locker lock(client_lock);
+ if (unmounting)
+ return -ENOTCONN;
+
Fh *f = get_filehandle(fd);
if (!f)
return -EBADF;
int Client::get_osd_addr(int osd, entity_addr_t& addr)
{
Mutex::Locker lock(client_lock);
+
+ if (unmounting)
+ return -ENOTCONN;
+
return objecter->with_osdmap([&](const OSDMap& o) {
if (!o.exists(osd))
return -ENOENT;
{
Mutex::Locker lock(client_lock);
+ if (unmounting)
+ return -ENOTCONN;
+
Fh *f = get_filehandle(fd);
if (!f)
return -EBADF;
int Client::get_local_osd()
{
Mutex::Locker lock(client_lock);
+
+ if (unmounting)
+ return -ENOTCONN;
+
objecter->with_osdmap([this](const OSDMap& o) {
if (o.get_epoch() != local_osd_epoch) {
local_osd = o.find_osd_on_ip(messenger->get_myaddr());