Message ID | 20180719141527.5446-3-cgxu519@gmx.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
diff --git a/fs/ceph/file.c b/fs/ceph/file.c index ad0bed99b1d5..e588b23681e0 100644 --- a/fs/ceph/file.c +++ b/fs/ceph/file.c @@ -1731,12 +1731,16 @@ static long ceph_fallocate(struct file *file, int mode, struct ceph_osd_client *osdc = &ceph_inode_to_client(inode)->client->osdc; struct ceph_cap_flush *prealloc_cf; + struct ceph_fs_client *fsc = inode->i_sb->s_fs_info; int want, got = 0; int dirty; int ret = 0; loff_t endoff = 0; loff_t size; + if ((offset + length) > max(i_size_read(inode), fsc->max_file_size)) + return -EFBIG; + if (mode & ~(FALLOC_FL_KEEP_SIZE | FALLOC_FL_PUNCH_HOLE)) return -EOPNOTSUPP;
If the range is larger than both real file size and limit of max file size, then return -EFBIG. Signed-off-by: Chengguang Xu <cgxu519@gmx.com> --- fs/ceph/file.c | 4 ++++ 1 file changed, 4 insertions(+)