Skip to content

Commit a4483e8

Browse files
chaseyuidryomov
authored andcommitted
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>
1 parent 3b70b38 commit a4483e8

2 files changed

Lines changed: 0 additions & 15 deletions

File tree

‎fs/ceph/addr.c‎

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1076,12 +1076,6 @@ static int ceph_update_writeable_page(struct file *file,
10761076
/* past end of file? */
10771077
i_size = inode->i_size; /* caller holds i_mutex */
10781078

1079-
if (i_size + len > inode->i_sb->s_maxbytes) {
1080-
/* file is too big */
1081-
r = -EINVAL;
1082-
goto fail;
1083-
}
1084-
10851079
if (page_off >= i_size ||
10861080
(pos_in_page == 0 && (pos+len) >= i_size &&
10871081
end_in_page - pos_in_page != PAGE_CACHE_SIZE)) {
@@ -1099,9 +1093,6 @@ static int ceph_update_writeable_page(struct file *file,
10991093
if (r < 0)
11001094
goto fail_nosnap;
11011095
goto retry_locked;
1102-
1103-
fail:
1104-
up_read(&mdsc->snap_rwsem);
11051096
fail_nosnap:
11061097
unlock_page(page);
11071098
return r;

‎fs/ceph/inode.c‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1813,10 +1813,6 @@ int ceph_setattr(struct dentry *dentry, struct iattr *attr)
18131813
if (ia_valid & ATTR_SIZE) {
18141814
dout("setattr %p size %lld -> %lld\n", inode,
18151815
inode->i_size, attr->ia_size);
1816-
if (attr->ia_size > inode->i_sb->s_maxbytes) {
1817-
err = -EINVAL;
1818-
goto out;
1819-
}
18201816
if ((issued & CEPH_CAP_FILE_EXCL) &&
18211817
attr->ia_size > inode->i_size) {
18221818
inode->i_size = attr->ia_size;
@@ -1896,8 +1892,6 @@ int ceph_setattr(struct dentry *dentry, struct iattr *attr)
18961892
if (mask & CEPH_SETATTR_SIZE)
18971893
__ceph_do_pending_vmtruncate(inode);
18981894
return err;
1899-
out:
1900-
spin_unlock(&ci->i_ceph_lock);
19011895
out_put:
19021896
ceph_mdsc_put_request(req);
19031897
return err;

0 commit comments

Comments
 (0)