(linklock.gcaps_xlocker_mask(client) << linklock.get_cap_shift());
}
-int CInode::get_caps_allowed_for_client(client_t client) const
+int CInode::get_caps_allowed_for_client(Session *session, inode_t *file_i) const
{
+ client_t client = session->info.inst.name.num();
int allowed;
if (client == get_loner()) {
// as the loner, we get the loner_caps AND any xlocker_caps for things we have xlocked
} else {
allowed = get_caps_allowed_by_type(CAP_ANY);
}
- if (inode.inline_data.version != CEPH_INLINE_NONE &&
- !mdcache->mds->get_session(client)->connection->has_feature(CEPH_FEATURE_MDS_INLINE_DATA))
- allowed &= ~(CEPH_CAP_FILE_RD | CEPH_CAP_FILE_WR);
+
+ if (!is_dir()) {
+ if ((file_i->inline_data.version != CEPH_INLINE_NONE &&
+ !session->connection->has_feature(CEPH_FEATURE_MDS_INLINE_DATA)) ||
+ (!file_i->layout.pool_ns.empty() &&
+ !session->connection->has_feature(CEPH_FEATURE_FS_FILE_LAYOUT_V2)))
+ allowed &= ~(CEPH_CAP_FILE_RD | CEPH_CAP_FILE_WR);
+ }
return allowed;
}
*/
ecap.caps = valid ? get_caps_allowed_by_type(CAP_ANY) : CEPH_STAT_CAP_INODE;
if (last == CEPH_NOSNAP || is_any_caps())
- ecap.caps = ecap.caps & get_caps_allowed_for_client(client);
+ ecap.caps = ecap.caps & get_caps_allowed_for_client(session, file_i);
ecap.seq = 0;
ecap.mseq = 0;
ecap.realm = 0;
if (!no_caps && valid && cap) {
int likes = get_caps_liked();
- int allowed = get_caps_allowed_for_client(client);
+ int allowed = get_caps_allowed_for_client(session, file_i);
int issue = (cap->wanted() | likes) & allowed;
cap->issue_norevoke(issue);
issue = cap->pending();
int get_caps_allowed_by_type(int type) const;
int get_caps_careful() const;
int get_xlocker_mask(client_t client) const;
- int get_caps_allowed_for_client(client_t client) const;
+ int get_caps_allowed_for_client(Session *s, inode_t *file_i) const;
// caps issued, wanted
int get_caps_issued(int *ploner = 0, int *pother = 0, int *pxlocker = 0,