* our cache. Conditionally also set `parent` to a referenced
* Inode* if caller provides non-NULL value.
*/
-int Client::lookup_parent(Inode *ino, Inode **parent)
+int Client::lookup_parent(Inode *ino, const UserPerm& perms, Inode **parent)
{
Mutex::Locker lock(client_lock);
ldout(cct, 3) << "lookup_parent enter(" << ino->ino << ") = " << dendl;
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
ldout(cct, 3) << "lookup_parent dentry already present" << dendl;
return 0;
}
req->set_inode(ino);
InodeRef target;
- UserPerm perms(get_uid(), get_gid()); // FIXME
int r = make_request(req, perms, &target, NULL, rand() % mdsmap->get_num_in_mds());
// Give caller a reference to the parent ino if they provided a pointer.
if (parent != NULL) {
int lookup_hash(inodeno_t ino, inodeno_t dirino, const char *name,
const UserPerm& perms);
int lookup_ino(inodeno_t ino, const UserPerm& perms, Inode **inode=NULL);
- int lookup_parent(Inode *in, Inode **parent=NULL);
+ int lookup_parent(Inode *in, const UserPerm& perms, Inode **parent=NULL);
int lookup_name(Inode *in, Inode *parent);
int close(int fd);
loff_t lseek(int fd, loff_t offset, int whence, const UserPerm& perms);
// Request the parent inode, so that we can look up the name
Inode *parent;
- r = (cmount->get_client())->lookup_parent(*inode, &parent);
+ r = (cmount->get_client())->lookup_parent(*inode, perms, &parent);
if (r && r != -EINVAL) {
// Unexpected error
(cmount->get_client())->ll_forget(*inode, 1);
// and don't try to look up the non-existent dentry.
return 0;
}
+ // FIXME: I don't think this works; lookup_parent() returns 0 if the parent
+ // is already in cache
assert(parent != NULL);
// Finally, get the name (dentry) of the requested inode