* the resulting Inode object in one operation, so that caller
* can safely assume inode will still be there after return.
*/
-int Client::_lookup_ino(inodeno_t ino, const UserPerm& perms, Inode **inode)
+int Client::_lookup_vino(vinodeno_t vino, const UserPerm& perms, Inode **inode)
{
- ldout(cct, 8) << __func__ << " enter(" << ino << ")" << dendl;
+ ldout(cct, 8) << __func__ << " enter(" << vino << ")" << dendl;
if (unmounting)
return -ENOTCONN;
MetaRequest *req = new MetaRequest(CEPH_MDS_OP_LOOKUPINO);
- filepath path(ino);
+ filepath path(vino.ino);
req->set_filepath(path);
+ /*
+ * The MDS expects either a "real" snapid here or 0. The special value
+ * carveouts for the snapid are all at the end of the range so we can
+ * just look for any snapid below this value.
+ */
+ if (vino.snapid < CEPH_NOSNAP)
+ req->head.args.lookupino.snapid = vino.snapid;
+
int r = make_request(req, perms, NULL, NULL, rand() % mdsmap->get_num_in_mds());
if (r == 0 && inode != NULL) {
- vinodeno_t vino(ino, CEPH_NOSNAP);
unordered_map<vinodeno_t,Inode*>::iterator p = inode_map.find(vino);
ceph_assert(p != inode_map.end());
*inode = p->second;
_ll_get(*inode);
}
- ldout(cct, 8) << __func__ << " exit(" << ino << ") = " << r << dendl;
+ ldout(cct, 8) << __func__ << " exit(" << vino << ") = " << r << dendl;
return r;
}
int Client::lookup_ino(inodeno_t ino, const UserPerm& perms, Inode **inode)
{
+ vinodeno_t vino(ino, CEPH_NOSNAP);
std::lock_guard lock(client_lock);
- return _lookup_ino(ino, perms, inode);
+ return _lookup_vino(vino, perms, inode);
}
/**
{
ceph_assert(inode != NULL);
std::lock_guard lock(client_lock);
- ldout(cct, 3) << "ll_lookup_inode " << ino << dendl;
+ ldout(cct, 3) << "ll_lookup_inode " << ino << dendl;
if (unmounting)
return -ENOTCONN;
// Num1: get inode and *inode
- return _lookup_ino(ino, perms, inode);
+ vinodeno_t vino(ino, CEPH_NOSNAP);
+ return _lookup_vino(vino, perms, inode);
}
int Client::ll_lookupx(Inode *parent, const char *name, Inode **out,
int _ll_getattr(Inode *in, int caps, const UserPerm& perms);
int _lookup_parent(Inode *in, const UserPerm& perms, Inode **parent=NULL);
int _lookup_name(Inode *in, Inode *parent, const UserPerm& perms);
- int _lookup_ino(inodeno_t ino, const UserPerm& perms, Inode **inode=NULL);
+ int _lookup_vino(vinodeno_t ino, const UserPerm& perms, Inode **inode=NULL);
bool _ll_forget(Inode *in, uint64_t count);