diff mbox

[v2,4/4] ceph: compare fsc->max_file_size and inode->i_size for max file size limit

Message ID 20180719141527.5446-5-cgxu519@gmx.com (mailing list archive)
State New, archived
Headers show

Commit Message

Chengguang Xu July 19, 2018, 2:15 p.m. UTC
In ceph_llseek(), we compare fsc->max_file_size and inode->i_siz to
choose max file size limit.

Signed-off-by: Chengguang Xu <cgxu519@gmx.com>
---
 fs/ceph/file.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
diff mbox

Patch

diff --git a/fs/ceph/file.c b/fs/ceph/file.c
index 7a01fe627bd7..27500fedae1e 100644
--- a/fs/ceph/file.c
+++ b/fs/ceph/file.c
@@ -1556,8 +1556,10 @@  static ssize_t ceph_write_iter(struct kiocb *iocb, struct iov_iter *from)
 static loff_t ceph_llseek(struct file *file, loff_t offset, int whence)
 {
 	struct inode *inode = file->f_mapping->host;
+	struct ceph_fs_client *fsc = inode->i_sb->s_fs_info;
 	loff_t i_size;
 	loff_t ret;
+	loff_t limit;
 
 	inode_lock(inode);
 
@@ -1600,7 +1602,8 @@  static loff_t ceph_llseek(struct file *file, loff_t offset, int whence)
 		break;
 	}
 
-	ret = vfs_setpos(file, offset, inode->i_sb->s_maxbytes);
+	limit = max(i_size, fsc->max_file_size);
+	ret = vfs_setpos(file, offset, limit);
 
 out:
 	inode_unlock(inode);