struct ceph_mds_session *session, u64 cap_id,
int fmode, unsigned issued, unsigned wanted,
unsigned seq, unsigned mseq, u64 realmino,
- unsigned ttl_ms, unsigned long ttl_from,
+ unsigned ttl_ms, unsigned long ttl_from, int flags,
struct ceph_cap *new_cap)
{
struct ceph_mds_client *mdsc = &ceph_inode_to_client(inode)->mdsc;
ci->i_ceph_flags &= ~CEPH_I_COMPLETE;
}
+ if (flags & CEPH_CAP_FLAG_AUTH)
+ ci->i_auth_cap = cap;
+ else if (ci->i_auth_cap == cap)
+ ci->i_auth_cap = NULL;
+
/*
* Ensure our rdcaps status is correct
*/
/* remove from inode list */
rb_erase(&cap->ci_node, &ci->i_caps);
cap->session = NULL;
+ if (ci->i_auth_cap == cap)
+ ci->i_auth_cap = NULL;
kfree(cap);
downgrade_write(&mdsc->snap_rwsem);
ceph_add_cap(inode, session, cap_id, -1,
issued, wanted, seq, mseq, realmino,
- ttl_ms, jiffies - ttl_ms/2, NULL);
+ ttl_ms, jiffies - ttl_ms/2, CEPH_CAP_FLAG_AUTH, NULL);
up_read(&mdsc->snap_rwsem);
}
ci->i_xattr_data = NULL;
ci->i_caps = RB_ROOT;
+ ci->i_auth_cap = NULL;
ci->i_dirty_caps = 0;
init_waitqueue_head(&ci->i_cap_wq);
ci->i_hold_caps_until = 0;
le64_to_cpu(info->cap.realm),
le32_to_cpu(info->cap.ttl_ms),
ttl_from,
+ info->cap.flags,
NULL);
} else {
spin_lock(&inode->i_lock);
/* capabilities. protected _both_ by i_lock and cap->session's
* s_mutex. */
struct rb_root i_caps; /* cap list */
+ struct ceph_cap *i_auth_cap; /* authoritative cap, if any */
unsigned i_dirty_caps; /* mask of dirtied fields */
wait_queue_head_t i_cap_wq; /* threads waiting on a capability */
unsigned long i_hold_caps_until; /* jiffies */
struct ceph_mds_session *session, u64 cap_id,
int fmode, unsigned issued, unsigned wanted,
unsigned cap, unsigned seq, u64 realmino,
- unsigned ttl_ms, unsigned long ttl_from,
+ unsigned ttl_ms, unsigned long ttl_from, int flags,
struct ceph_cap *new_cap);
extern void ceph_remove_cap(struct ceph_cap *cap);
extern int ceph_get_cap_mds(struct inode *inode);