}
-Fh *Client::_create_fh(Inode *in, int flags, int cmode)
+ Fh *Client::_create_fh(Inode *in, int flags, int cmode, const UserPerm& perms)
{
// yay
Fh *f = new Fh;
// inode
assert(in);
f->inode = in;
+ f->actor_perms = perms;
ldout(cct, 10) << "_create_fh " << in->ino << " mode " << cmode << dendl;
// success?
if (result >= 0) {
if (fhp)
- *fhp = _create_fh(in, flags, cmode);
+ *fhp = _create_fh(in, flags, cmode, perms);
} else {
in->put_open_ref(cmode);
}
int ret;
bufferlist bl;
- UserPerm perms(get_uid(), get_gid()); // FIXME
+ UserPerm perms(fh->actor_uid, fh->actor_gid);
if (sleep && switch_interrupt_cb) {
// enable interrupt
switch_interrupt_cb(callback_handle, req->get());
/* If the caller passed a value in fhp, do the open */
if(fhp) {
(*inp)->get_open_ref(cmode);
- *fhp = _create_fh(inp->get(), flags, cmode);
+ *fhp = _create_fh(inp->get(), flags, cmode, perms);
}
reply_error:
int _ll_put(Inode *in, int num);
void _ll_drop_pins();
- Fh *_create_fh(Inode *in, int flags, int cmode);
+ Fh *_create_fh(Inode *in, int flags, int cmode, const UserPerm& perms);
int _release_fh(Fh *fh);
void _put_fh(Fh *fh);
bool pos_locked; // pos is currently in use
list<Cond*> pos_waiters; // waiters for pos
+ UserPerm actor_perms; // perms I opened the file with
+
Readahead readahead;
// file lock
ceph_lock_state_t *fcntl_locks;
ceph_lock_state_t *flock_locks;
-
+
Fh() : _ref(1), pos(0), mds(0), mode(0), flags(0), pos_locked(false),
- readahead(), fcntl_locks(NULL), flock_locks(NULL) {}
+ actor_perms(), readahead(), fcntl_locks(NULL), flock_locks(NULL) {}
void get() { ++_ref; }
int put() { return --_ref; }
};