Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ceph: remove redundant code for max file size verification

Both ceph_update_writeable_page and ceph_setattr will verify file size
with max size ceph supported.
There are two caller for ceph_update_writeable_page, ceph_write_begin and
ceph_page_mkwrite. For ceph_write_begin, we have already verified the size in
generic_write_checks of ceph_write_iter; for ceph_page_mkwrite, we have no
chance to change file size when mmap. Likewise we have already verified the size
in inode_change_ok when we call ceph_setattr.
So let's remove the redundant code for max file size verification.

Signed-off-by: Chao Yu <chao2.yu@samsung.com>
Reviewed-by: Yan, Zheng <zyan@redhat.com>

authored by

Chao Yu and committed by
Ilya Dryomov
a4483e8a 3b70b388

-15
-9
fs/ceph/addr.c
··· 1076 1076 /* past end of file? */ 1077 1077 i_size = inode->i_size; /* caller holds i_mutex */ 1078 1078 1079 - if (i_size + len > inode->i_sb->s_maxbytes) { 1080 - /* file is too big */ 1081 - r = -EINVAL; 1082 - goto fail; 1083 - } 1084 - 1085 1079 if (page_off >= i_size || 1086 1080 (pos_in_page == 0 && (pos+len) >= i_size && 1087 1081 end_in_page - pos_in_page != PAGE_CACHE_SIZE)) { ··· 1093 1099 if (r < 0) 1094 1100 goto fail_nosnap; 1095 1101 goto retry_locked; 1096 - 1097 - fail: 1098 - up_read(&mdsc->snap_rwsem); 1099 1102 fail_nosnap: 1100 1103 unlock_page(page); 1101 1104 return r;
-6
fs/ceph/inode.c
··· 1813 1813 if (ia_valid & ATTR_SIZE) { 1814 1814 dout("setattr %p size %lld -> %lld\n", inode, 1815 1815 inode->i_size, attr->ia_size); 1816 - if (attr->ia_size > inode->i_sb->s_maxbytes) { 1817 - err = -EINVAL; 1818 - goto out; 1819 - } 1820 1816 if ((issued & CEPH_CAP_FILE_EXCL) && 1821 1817 attr->ia_size > inode->i_size) { 1822 1818 inode->i_size = attr->ia_size; ··· 1892 1896 if (mask & CEPH_SETATTR_SIZE) 1893 1897 __ceph_do_pending_vmtruncate(inode); 1894 1898 return err; 1895 - out: 1896 - spin_unlock(&ci->i_ceph_lock); 1897 1899 out_put: 1898 1900 ceph_mdsc_put_request(req); 1899 1901 return err;