{
int r = 0;
Dentry *dn = NULL;
+ // can only request shared caps
+ mask &= CEPH_CAP_ANY_SHARED;
if (dname == "..") {
if (dir->dentries.empty()) {
if (!mref_reader.is_state_satisfied())
return -ENOTCONN;
- ldout(cct, 3) << "open enter(" << relpath << ", " << ceph_flags_sys2wire(flags) << "," << mode << ")" << dendl;
+ int cflags = ceph_flags_sys2wire(flags);
+
+ ldout(cct, 3) << "open enter(" << relpath << ", " << cflags << "," << mode << ")" << dendl;
tout(cct) << "open" << std::endl;
tout(cct) << relpath << std::endl;
- tout(cct) << ceph_flags_sys2wire(flags) << std::endl;
+ tout(cct) << cflags << std::endl;
Fh *fh = NULL;
bool created = false;
/* O_CREATE with O_EXCL enforces O_NOFOLLOW. */
bool followsym = !((flags & O_NOFOLLOW) || ((flags & O_CREAT) && (flags & O_EXCL)));
+ int mask = ceph_caps_for_mode(ceph_flags_to_mode(cflags));
std::scoped_lock lock(client_lock);
- int r = path_walk(path, &in, perms, followsym, ceph_caps_for_mode(mode));
+ int r = path_walk(path, &in, perms, followsym, mask);
if (r == 0 && (flags & O_CREAT) && (flags & O_EXCL))
return -EEXIST;
out:
tout(cct) << r << std::endl;
- ldout(cct, 3) << "open exit(" << path << ", " << ceph_flags_sys2wire(flags) << ") = " << r << dendl;
+ ldout(cct, 3) << "open exit(" << path << ", " << cflags << ") = " << r << dendl;
return r;
}