summaryrefslogtreecommitdiffstats
path: root/fs/ceph/super.c
diff options
context:
space:
mode:
authorYan, Zheng <zyan@redhat.com>2017-07-11 09:56:09 +0200
committerIlya Dryomov <idryomov@gmail.com>2017-09-06 19:56:03 +0200
commitaa187926b739fb391f153335c7552c7a10d60e82 (patch)
tree0954de9620a7afe747bdbf3fcca503f11afd630c /fs/ceph/super.c
parentceph: remove unused cap_release_safety mount option (diff)
downloadlinux-aa187926b739fb391f153335c7552c7a10d60e82.tar.xz
linux-aa187926b739fb391f153335c7552c7a10d60e82.zip
ceph: limit osd read size to CEPH_MSG_MAX_DATA_LEN
libceph returns -EIO when read size > CEPH_MSG_MAX_DATA_LEN. Link: http://tracker.ceph.com/issues/20528 Signed-off-by: "Yan, Zheng" <zyan@redhat.com> Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Diffstat (limited to 'fs/ceph/super.c')
-rw-r--r--fs/ceph/super.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/fs/ceph/super.c b/fs/ceph/super.c
index 280311e36a17..2b2a260acb24 100644
--- a/fs/ceph/super.c
+++ b/fs/ceph/super.c
@@ -236,7 +236,9 @@ static int parse_fsopt_token(char *c, void *private)
fsopt->wsize = intval;
break;
case Opt_rsize:
- fsopt->rsize = intval;
+ if (intval < PAGE_SIZE || intval > CEPH_MAX_READ_SIZE)
+ return -EINVAL;
+ fsopt->rsize = ALIGN(intval, PAGE_SIZE);
break;
case Opt_rasize:
fsopt->rasize = intval;
@@ -390,7 +392,7 @@ static int parse_mount_options(struct ceph_mount_options **pfsopt,
fsopt->sb_flags = flags;
fsopt->flags = CEPH_MOUNT_OPT_DEFAULT;
- fsopt->rsize = CEPH_RSIZE_DEFAULT;
+ fsopt->rsize = CEPH_MAX_READ_SIZE;
fsopt->rasize = CEPH_RASIZE_DEFAULT;
fsopt->snapdir_name = kstrdup(CEPH_SNAPDIRNAME_DEFAULT, GFP_KERNEL);
if (!fsopt->snapdir_name) {
@@ -505,7 +507,7 @@ static int ceph_show_options(struct seq_file *m, struct dentry *root)
seq_printf(m, ",mds_namespace=%s", fsopt->mds_namespace);
if (fsopt->wsize)
seq_printf(m, ",wsize=%d", fsopt->wsize);
- if (fsopt->rsize != CEPH_RSIZE_DEFAULT)
+ if (fsopt->rsize != CEPH_MAX_READ_SIZE)
seq_printf(m, ",rsize=%d", fsopt->rsize);
if (fsopt->rasize != CEPH_RASIZE_DEFAULT)
seq_printf(m, ",rasize=%d", fsopt->rasize);
@@ -948,13 +950,8 @@ static int ceph_setup_bdi(struct super_block *sb, struct ceph_fs_client *fsc)
else
sb->s_bdi->ra_pages = VM_MAX_READAHEAD * 1024 / PAGE_SIZE;
- if (fsc->mount_options->rsize > fsc->mount_options->rasize &&
- fsc->mount_options->rsize >= PAGE_SIZE)
- sb->s_bdi->io_pages =
- (fsc->mount_options->rsize + PAGE_SIZE - 1)
- >> PAGE_SHIFT;
- else if (fsc->mount_options->rsize == 0)
- sb->s_bdi->io_pages = ULONG_MAX;
+ /* set io_pages based on max osd read size */
+ sb->s_bdi->io_pages = fsc->mount_options->rsize >> PAGE_SHIFT;
return 0;
}