提交 f9109765 编写于 作者: J Jeff Layton 提交者: Yang Yingliang

ceph: return -EINVAL if given fsc mount option on kernel w/o support

[ Upstream commit ff29fde84d1fc82f233c7da0daa3574a3942bec7 ]

If someone requests fscache on the mount, and the kernel doesn't
support it, it should fail the mount.

[ Drop ceph prefix -- it's provided by pr_err. ]
Signed-off-by: NJeff Layton <jlayton@kernel.org>
Reviewed-by: NIlya Dryomov <idryomov@gmail.com>
Signed-off-by: NIlya Dryomov <idryomov@gmail.com>
Signed-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 02924b91
...@@ -248,6 +248,7 @@ static int parse_fsopt_token(char *c, void *private) ...@@ -248,6 +248,7 @@ static int parse_fsopt_token(char *c, void *private)
return -ENOMEM; return -ENOMEM;
break; break;
case Opt_fscache_uniq: case Opt_fscache_uniq:
#ifdef CONFIG_CEPH_FSCACHE
kfree(fsopt->fscache_uniq); kfree(fsopt->fscache_uniq);
fsopt->fscache_uniq = kstrndup(argstr[0].from, fsopt->fscache_uniq = kstrndup(argstr[0].from,
argstr[0].to-argstr[0].from, argstr[0].to-argstr[0].from,
...@@ -256,7 +257,10 @@ static int parse_fsopt_token(char *c, void *private) ...@@ -256,7 +257,10 @@ static int parse_fsopt_token(char *c, void *private)
return -ENOMEM; return -ENOMEM;
fsopt->flags |= CEPH_MOUNT_OPT_FSCACHE; fsopt->flags |= CEPH_MOUNT_OPT_FSCACHE;
break; break;
/* misc */ #else
pr_err("fscache support is disabled\n");
return -EINVAL;
#endif
case Opt_wsize: case Opt_wsize:
if (intval < (int)PAGE_SIZE || intval > CEPH_MAX_WRITE_SIZE) if (intval < (int)PAGE_SIZE || intval > CEPH_MAX_WRITE_SIZE)
return -EINVAL; return -EINVAL;
...@@ -328,10 +332,15 @@ static int parse_fsopt_token(char *c, void *private) ...@@ -328,10 +332,15 @@ static int parse_fsopt_token(char *c, void *private)
fsopt->flags &= ~CEPH_MOUNT_OPT_INO32; fsopt->flags &= ~CEPH_MOUNT_OPT_INO32;
break; break;
case Opt_fscache: case Opt_fscache:
#ifdef CONFIG_CEPH_FSCACHE
fsopt->flags |= CEPH_MOUNT_OPT_FSCACHE; fsopt->flags |= CEPH_MOUNT_OPT_FSCACHE;
kfree(fsopt->fscache_uniq); kfree(fsopt->fscache_uniq);
fsopt->fscache_uniq = NULL; fsopt->fscache_uniq = NULL;
break; break;
#else
pr_err("fscache support is disabled\n");
return -EINVAL;
#endif
case Opt_nofscache: case Opt_nofscache:
fsopt->flags &= ~CEPH_MOUNT_OPT_FSCACHE; fsopt->flags &= ~CEPH_MOUNT_OPT_FSCACHE;
kfree(fsopt->fscache_uniq); kfree(fsopt->fscache_uniq);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册