Commit be70489e authored by Yan, Zheng's avatar Yan, Zheng Committed by Ilya Dryomov

ceph: properly drop caps for setattr request

For CEPH_SETATTR_ATIME, MDS needs to xlock filelock, Fsxrw caps
are not allowed for xlocked filelock.

For CEPH_SETATTR_SIZE request that truncates file to smaller size,
MDS needs to xlock filelock, Fsxrw caps are not allowed for xlocked
filelock.
Signed-off-by: default avatar"Yan, Zheng" <zyan@redhat.com>
Signed-off-by: default avatarIlya Dryomov <idryomov@gmail.com>
parent d19a0b54
...@@ -2000,8 +2000,8 @@ int __ceph_setattr(struct inode *inode, struct iattr *attr) ...@@ -2000,8 +2000,8 @@ int __ceph_setattr(struct inode *inode, struct iattr *attr)
ceph_encode_timespec(&req->r_args.setattr.atime, ceph_encode_timespec(&req->r_args.setattr.atime,
&attr->ia_atime); &attr->ia_atime);
mask |= CEPH_SETATTR_ATIME; mask |= CEPH_SETATTR_ATIME;
release |= CEPH_CAP_FILE_CACHE | CEPH_CAP_FILE_RD | release |= CEPH_CAP_FILE_SHARED |
CEPH_CAP_FILE_WR; CEPH_CAP_FILE_RD | CEPH_CAP_FILE_WR;
} }
} }
if (ia_valid & ATTR_MTIME) { if (ia_valid & ATTR_MTIME) {
...@@ -2022,8 +2022,8 @@ int __ceph_setattr(struct inode *inode, struct iattr *attr) ...@@ -2022,8 +2022,8 @@ int __ceph_setattr(struct inode *inode, struct iattr *attr)
ceph_encode_timespec(&req->r_args.setattr.mtime, ceph_encode_timespec(&req->r_args.setattr.mtime,
&attr->ia_mtime); &attr->ia_mtime);
mask |= CEPH_SETATTR_MTIME; mask |= CEPH_SETATTR_MTIME;
release |= CEPH_CAP_FILE_SHARED | CEPH_CAP_FILE_RD | release |= CEPH_CAP_FILE_SHARED |
CEPH_CAP_FILE_WR; CEPH_CAP_FILE_RD | CEPH_CAP_FILE_WR;
} }
} }
if (ia_valid & ATTR_SIZE) { if (ia_valid & ATTR_SIZE) {
...@@ -2041,8 +2041,8 @@ int __ceph_setattr(struct inode *inode, struct iattr *attr) ...@@ -2041,8 +2041,8 @@ int __ceph_setattr(struct inode *inode, struct iattr *attr)
req->r_args.setattr.old_size = req->r_args.setattr.old_size =
cpu_to_le64(inode->i_size); cpu_to_le64(inode->i_size);
mask |= CEPH_SETATTR_SIZE; mask |= CEPH_SETATTR_SIZE;
release |= CEPH_CAP_FILE_SHARED | CEPH_CAP_FILE_RD | release |= CEPH_CAP_FILE_SHARED | CEPH_CAP_FILE_EXCL |
CEPH_CAP_FILE_WR; CEPH_CAP_FILE_RD | CEPH_CAP_FILE_WR;
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment