Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 719784ba authored by Chengguang Xu's avatar Chengguang Xu Committed by Ilya Dryomov
Browse files

ceph: add new field max_file_size in ceph_fs_client



In order to not bother to VFS and other specific filesystems,
we decided to do offset validation inside ceph kernel client,
so just simply set sb->s_maxbytes to MAX_LFS_FILESIZE so that
it can successfully pass VFS check. We add new field max_file_size
in ceph_fs_client to store real file size limit and doing proper
check based on it.

Signed-off-by: default avatarChengguang Xu <cgxu519@gmx.com>
Reviewed-by: default avatar"Yan, Zheng" <zyan@redhat.com>
Signed-off-by: default avatarIlya Dryomov <idryomov@gmail.com>
parent f1d10e04
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -4018,7 +4018,8 @@ void ceph_mdsc_handle_mdsmap(struct ceph_mds_client *mdsc, struct ceph_msg *msg)
	} else {
		mdsc->mdsmap = newmap;  /* first mds map */
	}
	mdsc->fsc->sb->s_maxbytes = mdsc->mdsmap->m_max_file_size;
	mdsc->fsc->max_file_size = min((loff_t)mdsc->mdsmap->m_max_file_size,
					MAX_LFS_FILESIZE);

	__wake_requests(mdsc, &mdsc->waiting_for_map);
	ceph_monc_got_map(&mdsc->fsc->client->monc, CEPH_SUB_MDSMAP,
+2 −1
Original line number Diff line number Diff line
@@ -940,11 +940,12 @@ static int ceph_set_super(struct super_block *s, void *data)
	dout("set_super %p data %p\n", s, data);

	s->s_flags = fsc->mount_options->sb_flags;
	s->s_maxbytes = 1ULL << 40;  /* temp value until we get mdsmap */
	s->s_maxbytes = MAX_LFS_FILESIZE;

	s->s_xattr = ceph_xattr_handlers;
	s->s_fs_info = fsc;
	fsc->sb = s;
	fsc->max_file_size = 1ULL << 40; /* temp value until we get mdsmap */

	s->s_op = &ceph_super_ops;
	s->s_d_op = &ceph_dentry_ops;
+1 −0
Original line number Diff line number Diff line
@@ -98,6 +98,7 @@ struct ceph_fs_client {

	unsigned long mount_state;
	int min_caps;                  /* min caps i added */
	loff_t max_file_size;

	struct ceph_mds_client *mdsc;