diff options
author | Luis Henriques <lhenriques@suse.com> | 2017-05-05 13:28:44 -0400 |
---|---|---|
committer | Ilya Dryomov <idryomov@gmail.com> | 2017-05-24 12:10:54 -0400 |
commit | 42c99fc4c7069371da7b04b9099319dd1c633ee2 (patch) | |
tree | c4d4c136eb0924a4e4f23c8dfcb53eff507c8eac /fs/ceph/file.c | |
parent | 0a2ad541071f99eaf4589c3551176fca191c1ee2 (diff) |
ceph: check that the new inode size is within limits in ceph_fallocate()
Currently the ceph client doesn't respect the rlimit in fallocate. This
means that a user can allocate a file with size > RLIMIT_FSIZE. This
patch adds the call to inode_newsize_ok() to verify filesystem limits and
ulimits. This should make ceph successfully run xfstest generic/228.
Signed-off-by: Luis Henriques <lhenriques@suse.com>
Reviewed-by: "Yan, Zheng" <zyan@redhat.com>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Diffstat (limited to 'fs/ceph/file.c')
-rw-r--r-- | fs/ceph/file.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/fs/ceph/file.c b/fs/ceph/file.c index 3fdde0b283c9..29308a80d66f 100644 --- a/fs/ceph/file.c +++ b/fs/ceph/file.c | |||
@@ -1671,8 +1671,12 @@ static long ceph_fallocate(struct file *file, int mode, | |||
1671 | } | 1671 | } |
1672 | 1672 | ||
1673 | size = i_size_read(inode); | 1673 | size = i_size_read(inode); |
1674 | if (!(mode & FALLOC_FL_KEEP_SIZE)) | 1674 | if (!(mode & FALLOC_FL_KEEP_SIZE)) { |
1675 | endoff = offset + length; | 1675 | endoff = offset + length; |
1676 | ret = inode_newsize_ok(inode, endoff); | ||
1677 | if (ret) | ||
1678 | goto unlock; | ||
1679 | } | ||
1676 | 1680 | ||
1677 | if (fi->fmode & CEPH_FILE_MODE_LAZY) | 1681 | if (fi->fmode & CEPH_FILE_MODE_LAZY) |
1678 | want = CEPH_CAP_FILE_BUFFER | CEPH_CAP_FILE_LAZYIO; | 1682 | want = CEPH_CAP_FILE_BUFFER | CEPH_CAP_FILE_LAZYIO; |