提交 a2315823 编写于 作者: L Linus Torvalds

Merge tag 'ceph-for-5.5-rc1' of git://github.com/ceph/ceph-client

Pull ceph updates from Ilya Dryomov:
 "The two highlights are a set of improvements to how rbd read-only
  mappings are handled and a conversion to the new mount API (slightly
  complicated by the fact that we had a common option parsing framework
  that called out into rbd and the filesystem instead of them calling
  into it).

  Also included a few scattered fixes and a MAINTAINERS update for rbd,
  adding Dongsheng as a reviewer"

* tag 'ceph-for-5.5-rc1' of git://github.com/ceph/ceph-client:
  libceph, rbd, ceph: convert to use the new mount API
  rbd: ask for a weaker incompat mask for read-only mappings
  rbd: don't query snapshot features
  rbd: remove snapshot existence validation code
  rbd: don't establish watch for read-only mappings
  rbd: don't acquire exclusive lock for read-only mappings
  rbd: disallow read-write partitions on images mapped read-only
  rbd: treat images mapped read-only seriously
  rbd: introduce RBD_DEV_FLAG_READONLY
  rbd: introduce rbd_is_snap()
  ceph: don't leave ino field in ceph_mds_request_head uninitialized
  ceph: tone down loglevel on ceph_mdsc_build_path warning
  rbd: update MAINTAINERS info
  ceph: fix geting random mds from mdsmap
  rbd: fix spelling mistake "requeueing" -> "requeuing"
  ceph: make several helper accessors take const pointers
  libceph: drop unnecessary check from dispatch() in mon_client.c
...@@ -13773,7 +13773,7 @@ F: drivers/media/radio/radio-tea5777.c ...@@ -13773,7 +13773,7 @@ F: drivers/media/radio/radio-tea5777.c
RADOS BLOCK DEVICE (RBD) RADOS BLOCK DEVICE (RBD)
M: Ilya Dryomov <idryomov@gmail.com> M: Ilya Dryomov <idryomov@gmail.com>
M: Sage Weil <sage@redhat.com> M: Sage Weil <sage@redhat.com>
M: Alex Elder <elder@kernel.org> R: Dongsheng Yang <dongsheng.yang@easystack.cn>
L: ceph-devel@vger.kernel.org L: ceph-devel@vger.kernel.org
W: http://ceph.com/ W: http://ceph.com/
T: git git://git.kernel.org/pub/scm/linux/kernel/git/sage/ceph-client.git T: git git://git.kernel.org/pub/scm/linux/kernel/git/sage/ceph-client.git
......
此差异已折叠。
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include <linux/ceph/ceph_debug.h> #include <linux/ceph/ceph_debug.h>
#include <linux/fs_context.h>
#include "super.h" #include "super.h"
#include "cache.h" #include "cache.h"
...@@ -49,7 +50,7 @@ void ceph_fscache_unregister(void) ...@@ -49,7 +50,7 @@ void ceph_fscache_unregister(void)
fscache_unregister_netfs(&ceph_cache_netfs); fscache_unregister_netfs(&ceph_cache_netfs);
} }
int ceph_fscache_register_fs(struct ceph_fs_client* fsc) int ceph_fscache_register_fs(struct ceph_fs_client* fsc, struct fs_context *fc)
{ {
const struct ceph_fsid *fsid = &fsc->client->fsid; const struct ceph_fsid *fsid = &fsc->client->fsid;
const char *fscache_uniq = fsc->mount_options->fscache_uniq; const char *fscache_uniq = fsc->mount_options->fscache_uniq;
...@@ -66,8 +67,8 @@ int ceph_fscache_register_fs(struct ceph_fs_client* fsc) ...@@ -66,8 +67,8 @@ int ceph_fscache_register_fs(struct ceph_fs_client* fsc)
if (uniq_len && memcmp(ent->uniquifier, fscache_uniq, uniq_len)) if (uniq_len && memcmp(ent->uniquifier, fscache_uniq, uniq_len))
continue; continue;
pr_err("fscache cookie already registered for fsid %pU\n", fsid); errorf(fc, "ceph: fscache cookie already registered for fsid %pU, use fsc=<uniquifier> option",
pr_err(" use fsc=%%s mount option to specify a uniquifier\n"); fsid);
err = -EBUSY; err = -EBUSY;
goto out_unlock; goto out_unlock;
} }
...@@ -95,7 +96,7 @@ int ceph_fscache_register_fs(struct ceph_fs_client* fsc) ...@@ -95,7 +96,7 @@ int ceph_fscache_register_fs(struct ceph_fs_client* fsc)
list_add_tail(&ent->list, &ceph_fscache_list); list_add_tail(&ent->list, &ceph_fscache_list);
} else { } else {
kfree(ent); kfree(ent);
pr_err("unable to register fscache cookie for fsid %pU\n", errorf(fc, "ceph: unable to register fscache cookie for fsid %pU",
fsid); fsid);
/* all other fs ignore this error */ /* all other fs ignore this error */
} }
......
...@@ -16,7 +16,7 @@ extern struct fscache_netfs ceph_cache_netfs; ...@@ -16,7 +16,7 @@ extern struct fscache_netfs ceph_cache_netfs;
int ceph_fscache_register(void); int ceph_fscache_register(void);
void ceph_fscache_unregister(void); void ceph_fscache_unregister(void);
int ceph_fscache_register_fs(struct ceph_fs_client* fsc); int ceph_fscache_register_fs(struct ceph_fs_client* fsc, struct fs_context *fc);
void ceph_fscache_unregister_fs(struct ceph_fs_client* fsc); void ceph_fscache_unregister_fs(struct ceph_fs_client* fsc);
void ceph_fscache_register_inode_cookie(struct inode *inode); void ceph_fscache_register_inode_cookie(struct inode *inode);
...@@ -88,7 +88,8 @@ static inline void ceph_fscache_unregister(void) ...@@ -88,7 +88,8 @@ static inline void ceph_fscache_unregister(void)
{ {
} }
static inline int ceph_fscache_register_fs(struct ceph_fs_client* fsc) static inline int ceph_fscache_register_fs(struct ceph_fs_client* fsc,
struct fs_context *fc)
{ {
return 0; return 0;
} }
......
...@@ -2182,13 +2182,17 @@ char *ceph_mdsc_build_path(struct dentry *dentry, int *plen, u64 *pbase, ...@@ -2182,13 +2182,17 @@ char *ceph_mdsc_build_path(struct dentry *dentry, int *plen, u64 *pbase,
} }
base = ceph_ino(d_inode(temp)); base = ceph_ino(d_inode(temp));
rcu_read_unlock(); rcu_read_unlock();
if (pos < 0 || read_seqretry(&rename_lock, seq)) {
pr_err("build_path did not end path lookup where " if (read_seqretry(&rename_lock, seq))
"expected, pos is %d\n", pos); goto retry;
/* presumably this is only possible if racing with a
rename of one of the parent directories (we can not if (pos < 0) {
lock the dentries above us to prevent this, but /*
retrying should be harmless) */ * A rename didn't occur, but somehow we didn't end up where
* we thought we would. Throw a warning and try again.
*/
pr_warn("build_path did not end path lookup where "
"expected, pos is %d\n", pos);
goto retry; goto retry;
} }
...@@ -2345,6 +2349,7 @@ static struct ceph_msg *create_request_message(struct ceph_mds_client *mdsc, ...@@ -2345,6 +2349,7 @@ static struct ceph_msg *create_request_message(struct ceph_mds_client *mdsc,
head->op = cpu_to_le32(req->r_op); head->op = cpu_to_le32(req->r_op);
head->caller_uid = cpu_to_le32(from_kuid(&init_user_ns, req->r_uid)); head->caller_uid = cpu_to_le32(from_kuid(&init_user_ns, req->r_uid));
head->caller_gid = cpu_to_le32(from_kgid(&init_user_ns, req->r_gid)); head->caller_gid = cpu_to_le32(from_kgid(&init_user_ns, req->r_gid));
head->ino = 0;
head->args = req->r_args; head->args = req->r_args;
ceph_encode_filepath(&p, end, ino1, path1); ceph_encode_filepath(&p, end, ino1, path1);
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
int ceph_mdsmap_get_random_mds(struct ceph_mdsmap *m) int ceph_mdsmap_get_random_mds(struct ceph_mdsmap *m)
{ {
int n = 0; int n = 0;
int i; int i, j;
/* special case for one mds */ /* special case for one mds */
if (1 == m->m_num_mds && m->m_info[0].state > 0) if (1 == m->m_num_mds && m->m_info[0].state > 0)
...@@ -35,9 +35,12 @@ int ceph_mdsmap_get_random_mds(struct ceph_mdsmap *m) ...@@ -35,9 +35,12 @@ int ceph_mdsmap_get_random_mds(struct ceph_mdsmap *m)
/* pick */ /* pick */
n = prandom_u32() % n; n = prandom_u32() % n;
for (i = 0; n > 0; i++, n--) for (j = 0, i = 0; i < m->m_num_mds; i++) {
while (m->m_info[i].state <= 0) if (m->m_info[i].state > 0)
i++; j++;
if (j > n)
break;
}
return i; return i;
} }
......
此差异已折叠。
...@@ -74,7 +74,6 @@ ...@@ -74,7 +74,6 @@
struct ceph_mount_options { struct ceph_mount_options {
int flags; int flags;
int sb_flags;
int wsize; /* max write size */ int wsize; /* max write size */
int rsize; /* max read size */ int rsize; /* max read size */
...@@ -407,22 +406,26 @@ struct ceph_inode_info { ...@@ -407,22 +406,26 @@ struct ceph_inode_info {
struct inode vfs_inode; /* at end */ struct inode vfs_inode; /* at end */
}; };
static inline struct ceph_inode_info *ceph_inode(struct inode *inode) static inline struct ceph_inode_info *
ceph_inode(const struct inode *inode)
{ {
return container_of(inode, struct ceph_inode_info, vfs_inode); return container_of(inode, struct ceph_inode_info, vfs_inode);
} }
static inline struct ceph_fs_client *ceph_inode_to_client(struct inode *inode) static inline struct ceph_fs_client *
ceph_inode_to_client(const struct inode *inode)
{ {
return (struct ceph_fs_client *)inode->i_sb->s_fs_info; return (struct ceph_fs_client *)inode->i_sb->s_fs_info;
} }
static inline struct ceph_fs_client *ceph_sb_to_client(struct super_block *sb) static inline struct ceph_fs_client *
ceph_sb_to_client(const struct super_block *sb)
{ {
return (struct ceph_fs_client *)sb->s_fs_info; return (struct ceph_fs_client *)sb->s_fs_info;
} }
static inline struct ceph_vino ceph_vino(struct inode *inode) static inline struct ceph_vino
ceph_vino(const struct inode *inode)
{ {
return ceph_inode(inode)->i_vino; return ceph_inode(inode)->i_vino;
} }
......
...@@ -280,10 +280,12 @@ extern const char *ceph_msg_type_name(int type); ...@@ -280,10 +280,12 @@ extern const char *ceph_msg_type_name(int type);
extern int ceph_check_fsid(struct ceph_client *client, struct ceph_fsid *fsid); extern int ceph_check_fsid(struct ceph_client *client, struct ceph_fsid *fsid);
extern void *ceph_kvmalloc(size_t size, gfp_t flags); extern void *ceph_kvmalloc(size_t size, gfp_t flags);
extern struct ceph_options *ceph_parse_options(char *options, struct fs_parameter;
const char *dev_name, const char *dev_name_end, struct ceph_options *ceph_alloc_options(void);
int (*parse_extra_token)(char *c, void *private), int ceph_parse_mon_ips(const char *buf, size_t len, struct ceph_options *opt,
void *private); struct fs_context *fc);
int ceph_parse_param(struct fs_parameter *param, struct ceph_options *opt,
struct fs_context *fc);
int ceph_print_client_options(struct seq_file *m, struct ceph_client *client, int ceph_print_client_options(struct seq_file *m, struct ceph_client *client,
bool show_all); bool show_all);
extern void ceph_destroy_options(struct ceph_options *opt); extern void ceph_destroy_options(struct ceph_options *opt);
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/mount.h> #include <linux/mount.h>
#include <linux/nsproxy.h> #include <linux/nsproxy.h>
#include <linux/parser.h> #include <linux/fs_parser.h>
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/sched/mm.h> #include <linux/sched/mm.h>
#include <linux/seq_file.h> #include <linux/seq_file.h>
...@@ -254,58 +254,77 @@ enum { ...@@ -254,58 +254,77 @@ enum {
Opt_mount_timeout, Opt_mount_timeout,
Opt_osd_idle_ttl, Opt_osd_idle_ttl,
Opt_osd_request_timeout, Opt_osd_request_timeout,
Opt_last_int,
/* int args above */ /* int args above */
Opt_fsid, Opt_fsid,
Opt_name, Opt_name,
Opt_secret, Opt_secret,
Opt_key, Opt_key,
Opt_ip, Opt_ip,
Opt_last_string,
/* string args above */ /* string args above */
Opt_share, Opt_share,
Opt_noshare,
Opt_crc, Opt_crc,
Opt_nocrc,
Opt_cephx_require_signatures, Opt_cephx_require_signatures,
Opt_nocephx_require_signatures,
Opt_cephx_sign_messages, Opt_cephx_sign_messages,
Opt_nocephx_sign_messages,
Opt_tcp_nodelay, Opt_tcp_nodelay,
Opt_notcp_nodelay,
Opt_abort_on_full, Opt_abort_on_full,
}; };
static match_table_t opt_tokens = { static const struct fs_parameter_spec ceph_param_specs[] = {
{Opt_osdtimeout, "osdtimeout=%d"}, fsparam_flag ("abort_on_full", Opt_abort_on_full),
{Opt_osdkeepalivetimeout, "osdkeepalive=%d"}, fsparam_flag_no ("cephx_require_signatures", Opt_cephx_require_signatures),
{Opt_mount_timeout, "mount_timeout=%d"}, fsparam_flag_no ("cephx_sign_messages", Opt_cephx_sign_messages),
{Opt_osd_idle_ttl, "osd_idle_ttl=%d"}, fsparam_flag_no ("crc", Opt_crc),
{Opt_osd_request_timeout, "osd_request_timeout=%d"}, fsparam_string ("fsid", Opt_fsid),
/* int args above */ fsparam_string ("ip", Opt_ip),
{Opt_fsid, "fsid=%s"}, fsparam_string ("key", Opt_key),
{Opt_name, "name=%s"}, fsparam_u32 ("mount_timeout", Opt_mount_timeout),
{Opt_secret, "secret=%s"}, fsparam_string ("name", Opt_name),
{Opt_key, "key=%s"}, fsparam_u32 ("osd_idle_ttl", Opt_osd_idle_ttl),
{Opt_ip, "ip=%s"}, fsparam_u32 ("osd_request_timeout", Opt_osd_request_timeout),
/* string args above */ fsparam_u32 ("osdkeepalive", Opt_osdkeepalivetimeout),
{Opt_share, "share"}, __fsparam (fs_param_is_s32, "osdtimeout", Opt_osdtimeout,
{Opt_noshare, "noshare"}, fs_param_deprecated),
{Opt_crc, "crc"}, fsparam_string ("secret", Opt_secret),
{Opt_nocrc, "nocrc"}, fsparam_flag_no ("share", Opt_share),
{Opt_cephx_require_signatures, "cephx_require_signatures"}, fsparam_flag_no ("tcp_nodelay", Opt_tcp_nodelay),
{Opt_nocephx_require_signatures, "nocephx_require_signatures"}, {}
{Opt_cephx_sign_messages, "cephx_sign_messages"}, };
{Opt_nocephx_sign_messages, "nocephx_sign_messages"},
{Opt_tcp_nodelay, "tcp_nodelay"}, static const struct fs_parameter_description ceph_parameters = {
{Opt_notcp_nodelay, "notcp_nodelay"}, .name = "libceph",
{Opt_abort_on_full, "abort_on_full"}, .specs = ceph_param_specs,
{-1, NULL}
}; };
struct ceph_options *ceph_alloc_options(void)
{
struct ceph_options *opt;
opt = kzalloc(sizeof(*opt), GFP_KERNEL);
if (!opt)
return NULL;
opt->mon_addr = kcalloc(CEPH_MAX_MON, sizeof(*opt->mon_addr),
GFP_KERNEL);
if (!opt->mon_addr) {
kfree(opt);
return NULL;
}
opt->flags = CEPH_OPT_DEFAULT;
opt->osd_keepalive_timeout = CEPH_OSD_KEEPALIVE_DEFAULT;
opt->mount_timeout = CEPH_MOUNT_TIMEOUT_DEFAULT;
opt->osd_idle_ttl = CEPH_OSD_IDLE_TTL_DEFAULT;
opt->osd_request_timeout = CEPH_OSD_REQUEST_TIMEOUT_DEFAULT;
return opt;
}
EXPORT_SYMBOL(ceph_alloc_options);
void ceph_destroy_options(struct ceph_options *opt) void ceph_destroy_options(struct ceph_options *opt)
{ {
dout("destroy_options %p\n", opt); dout("destroy_options %p\n", opt);
if (!opt)
return;
kfree(opt->name); kfree(opt->name);
if (opt->key) { if (opt->key) {
ceph_crypto_key_destroy(opt->key); ceph_crypto_key_destroy(opt->key);
...@@ -317,7 +336,9 @@ void ceph_destroy_options(struct ceph_options *opt) ...@@ -317,7 +336,9 @@ void ceph_destroy_options(struct ceph_options *opt)
EXPORT_SYMBOL(ceph_destroy_options); EXPORT_SYMBOL(ceph_destroy_options);
/* get secret from key store */ /* get secret from key store */
static int get_secret(struct ceph_crypto_key *dst, const char *name) { static int get_secret(struct ceph_crypto_key *dst, const char *name,
struct fs_context *fc)
{
struct key *ukey; struct key *ukey;
int key_err; int key_err;
int err = 0; int err = 0;
...@@ -330,20 +351,20 @@ static int get_secret(struct ceph_crypto_key *dst, const char *name) { ...@@ -330,20 +351,20 @@ static int get_secret(struct ceph_crypto_key *dst, const char *name) {
key_err = PTR_ERR(ukey); key_err = PTR_ERR(ukey);
switch (key_err) { switch (key_err) {
case -ENOKEY: case -ENOKEY:
pr_warn("ceph: Mount failed due to key not found: %s\n", errorf(fc, "libceph: Failed due to key not found: %s",
name); name);
break; break;
case -EKEYEXPIRED: case -EKEYEXPIRED:
pr_warn("ceph: Mount failed due to expired key: %s\n", errorf(fc, "libceph: Failed due to expired key: %s",
name); name);
break; break;
case -EKEYREVOKED: case -EKEYREVOKED:
pr_warn("ceph: Mount failed due to revoked key: %s\n", errorf(fc, "libceph: Failed due to revoked key: %s",
name); name);
break; break;
default: default:
pr_warn("ceph: Mount failed due to unknown key error %d: %s\n", errorf(fc, "libceph: Failed due to key error %d: %s",
key_err, name); key_err, name);
} }
err = -EPERM; err = -EPERM;
goto out; goto out;
...@@ -361,217 +382,157 @@ static int get_secret(struct ceph_crypto_key *dst, const char *name) { ...@@ -361,217 +382,157 @@ static int get_secret(struct ceph_crypto_key *dst, const char *name) {
return err; return err;
} }
struct ceph_options * int ceph_parse_mon_ips(const char *buf, size_t len, struct ceph_options *opt,
ceph_parse_options(char *options, const char *dev_name, struct fs_context *fc)
const char *dev_name_end,
int (*parse_extra_token)(char *c, void *private),
void *private)
{ {
struct ceph_options *opt; int ret;
const char *c;
int err = -ENOMEM;
substring_t argstr[MAX_OPT_ARGS];
opt = kzalloc(sizeof(*opt), GFP_KERNEL);
if (!opt)
return ERR_PTR(-ENOMEM);
opt->mon_addr = kcalloc(CEPH_MAX_MON, sizeof(*opt->mon_addr),
GFP_KERNEL);
if (!opt->mon_addr)
goto out;
dout("parse_options %p options '%s' dev_name '%s'\n", opt, options,
dev_name);
/* start with defaults */
opt->flags = CEPH_OPT_DEFAULT;
opt->osd_keepalive_timeout = CEPH_OSD_KEEPALIVE_DEFAULT;
opt->mount_timeout = CEPH_MOUNT_TIMEOUT_DEFAULT;
opt->osd_idle_ttl = CEPH_OSD_IDLE_TTL_DEFAULT;
opt->osd_request_timeout = CEPH_OSD_REQUEST_TIMEOUT_DEFAULT;
/* get mon ip(s) */
/* ip1[:port1][,ip2[:port2]...] */ /* ip1[:port1][,ip2[:port2]...] */
err = ceph_parse_ips(dev_name, dev_name_end, opt->mon_addr, ret = ceph_parse_ips(buf, buf + len, opt->mon_addr, CEPH_MAX_MON,
CEPH_MAX_MON, &opt->num_mon); &opt->num_mon);
if (err < 0) if (ret) {
goto out; errorf(fc, "libceph: Failed to parse monitor IPs: %d", ret);
return ret;
}
/* parse mount options */ return 0;
while ((c = strsep(&options, ",")) != NULL) { }
int token, intval; EXPORT_SYMBOL(ceph_parse_mon_ips);
if (!*c)
continue; int ceph_parse_param(struct fs_parameter *param, struct ceph_options *opt,
err = -EINVAL; struct fs_context *fc)
token = match_token((char *)c, opt_tokens, argstr); {
if (token < 0 && parse_extra_token) { struct fs_parse_result result;
/* extra? */ int token, err;
err = parse_extra_token((char *)c, private);
if (err < 0) { token = fs_parse(fc, &ceph_parameters, param, &result);
pr_err("bad option at '%s'\n", c); dout("%s fs_parse '%s' token %d\n", __func__, param->key, token);
goto out; if (token < 0)
} return token;
continue;
} switch (token) {
if (token < Opt_last_int) { case Opt_ip:
err = match_int(&argstr[0], &intval); err = ceph_parse_ips(param->string,
if (err < 0) { param->string + param->size,
pr_err("bad option arg (not int) at '%s'\n", c); &opt->my_addr,
goto out; 1, NULL);
} if (err) {
dout("got int token %d val %d\n", token, intval); errorf(fc, "libceph: Failed to parse ip: %d", err);
} else if (token > Opt_last_int && token < Opt_last_string) { return err;
dout("got string token %d val %s\n", token,
argstr[0].from);
} else {
dout("got token %d\n", token);
} }
switch (token) { opt->flags |= CEPH_OPT_MYIP;
case Opt_ip: break;
err = ceph_parse_ips(argstr[0].from,
argstr[0].to,
&opt->my_addr,
1, NULL);
if (err < 0)
goto out;
opt->flags |= CEPH_OPT_MYIP;
break;
case Opt_fsid: case Opt_fsid:
err = parse_fsid(argstr[0].from, &opt->fsid); err = parse_fsid(param->string, &opt->fsid);
if (err == 0) if (err) {
opt->flags |= CEPH_OPT_FSID; errorf(fc, "libceph: Failed to parse fsid: %d", err);
break; return err;
case Opt_name: }
kfree(opt->name); opt->flags |= CEPH_OPT_FSID;
opt->name = kstrndup(argstr[0].from, break;
argstr[0].to-argstr[0].from, case Opt_name:
GFP_KERNEL); kfree(opt->name);
if (!opt->name) { opt->name = param->string;
err = -ENOMEM; param->string = NULL;
goto out; break;
} case Opt_secret:
break; ceph_crypto_key_destroy(opt->key);
case Opt_secret: kfree(opt->key);
ceph_crypto_key_destroy(opt->key);
kfree(opt->key);
opt->key = kzalloc(sizeof(*opt->key), GFP_KERNEL);
if (!opt->key) {
err = -ENOMEM;
goto out;
}
err = ceph_crypto_key_unarmor(opt->key, argstr[0].from);
if (err < 0)
goto out;
break;
case Opt_key:
ceph_crypto_key_destroy(opt->key);
kfree(opt->key);
opt->key = kzalloc(sizeof(*opt->key), GFP_KERNEL);
if (!opt->key) {
err = -ENOMEM;
goto out;
}
err = get_secret(opt->key, argstr[0].from);
if (err < 0)
goto out;
break;
/* misc */ opt->key = kzalloc(sizeof(*opt->key), GFP_KERNEL);
case Opt_osdtimeout: if (!opt->key)
pr_warn("ignoring deprecated osdtimeout option\n"); return -ENOMEM;
break; err = ceph_crypto_key_unarmor(opt->key, param->string);
case Opt_osdkeepalivetimeout: if (err) {
/* 0 isn't well defined right now, reject it */ errorf(fc, "libceph: Failed to parse secret: %d", err);
if (intval < 1 || intval > INT_MAX / 1000) { return err;
pr_err("osdkeepalive out of range\n"); }
err = -EINVAL; break;
goto out; case Opt_key:
} ceph_crypto_key_destroy(opt->key);
opt->osd_keepalive_timeout = kfree(opt->key);
msecs_to_jiffies(intval * 1000);
break;
case Opt_osd_idle_ttl:
/* 0 isn't well defined right now, reject it */
if (intval < 1 || intval > INT_MAX / 1000) {
pr_err("osd_idle_ttl out of range\n");
err = -EINVAL;
goto out;
}
opt->osd_idle_ttl = msecs_to_jiffies(intval * 1000);
break;
case Opt_mount_timeout:
/* 0 is "wait forever" (i.e. infinite timeout) */
if (intval < 0 || intval > INT_MAX / 1000) {
pr_err("mount_timeout out of range\n");
err = -EINVAL;
goto out;
}
opt->mount_timeout = msecs_to_jiffies(intval * 1000);
break;
case Opt_osd_request_timeout:
/* 0 is "wait forever" (i.e. infinite timeout) */
if (intval < 0 || intval > INT_MAX / 1000) {
pr_err("osd_request_timeout out of range\n");
err = -EINVAL;
goto out;
}
opt->osd_request_timeout = msecs_to_jiffies(intval * 1000);
break;
case Opt_share: opt->key = kzalloc(sizeof(*opt->key), GFP_KERNEL);
if (!opt->key)
return -ENOMEM;
return get_secret(opt->key, param->string, fc);
case Opt_osdtimeout:
warnf(fc, "libceph: Ignoring osdtimeout");
break;
case Opt_osdkeepalivetimeout:
/* 0 isn't well defined right now, reject it */
if (result.uint_32 < 1 || result.uint_32 > INT_MAX / 1000)
goto out_of_range;
opt->osd_keepalive_timeout =
msecs_to_jiffies(result.uint_32 * 1000);
break;
case Opt_osd_idle_ttl:
/* 0 isn't well defined right now, reject it */
if (result.uint_32 < 1 || result.uint_32 > INT_MAX / 1000)
goto out_of_range;
opt->osd_idle_ttl = msecs_to_jiffies(result.uint_32 * 1000);
break;
case Opt_mount_timeout:
/* 0 is "wait forever" (i.e. infinite timeout) */
if (result.uint_32 > INT_MAX / 1000)
goto out_of_range;
opt->mount_timeout = msecs_to_jiffies(result.uint_32 * 1000);
break;
case Opt_osd_request_timeout:
/* 0 is "wait forever" (i.e. infinite timeout) */
if (result.uint_32 > INT_MAX / 1000)
goto out_of_range;
opt->osd_request_timeout =
msecs_to_jiffies(result.uint_32 * 1000);
break;
case Opt_share:
if (!result.negated)
opt->flags &= ~CEPH_OPT_NOSHARE; opt->flags &= ~CEPH_OPT_NOSHARE;
break; else
case Opt_noshare:
opt->flags |= CEPH_OPT_NOSHARE; opt->flags |= CEPH_OPT_NOSHARE;
break; break;
case Opt_crc:
case Opt_crc: if (!result.negated)
opt->flags &= ~CEPH_OPT_NOCRC; opt->flags &= ~CEPH_OPT_NOCRC;
break; else
case Opt_nocrc:
opt->flags |= CEPH_OPT_NOCRC; opt->flags |= CEPH_OPT_NOCRC;
break; break;
case Opt_cephx_require_signatures:
case Opt_cephx_require_signatures: if (!result.negated)
opt->flags &= ~CEPH_OPT_NOMSGAUTH; opt->flags &= ~CEPH_OPT_NOMSGAUTH;
break; else
case Opt_nocephx_require_signatures:
opt->flags |= CEPH_OPT_NOMSGAUTH; opt->flags |= CEPH_OPT_NOMSGAUTH;
break; break;
case Opt_cephx_sign_messages: case Opt_cephx_sign_messages:
if (!result.negated)
opt->flags &= ~CEPH_OPT_NOMSGSIGN; opt->flags &= ~CEPH_OPT_NOMSGSIGN;
break; else
case Opt_nocephx_sign_messages:
opt->flags |= CEPH_OPT_NOMSGSIGN; opt->flags |= CEPH_OPT_NOMSGSIGN;
break; break;
case Opt_tcp_nodelay:
case Opt_tcp_nodelay: if (!result.negated)
opt->flags |= CEPH_OPT_TCP_NODELAY; opt->flags |= CEPH_OPT_TCP_NODELAY;
break; else
case Opt_notcp_nodelay:
opt->flags &= ~CEPH_OPT_TCP_NODELAY; opt->flags &= ~CEPH_OPT_TCP_NODELAY;
break; break;
case Opt_abort_on_full: case Opt_abort_on_full:
opt->flags |= CEPH_OPT_ABORT_ON_FULL; opt->flags |= CEPH_OPT_ABORT_ON_FULL;
break; break;
default: default:
BUG_ON(token); BUG();
}
} }
/* success */ return 0;
return opt;
out: out_of_range:
ceph_destroy_options(opt); return invalf(fc, "libceph: %s out of range", param->key);
return ERR_PTR(err);
} }
EXPORT_SYMBOL(ceph_parse_options); EXPORT_SYMBOL(ceph_parse_param);
int ceph_print_client_options(struct seq_file *m, struct ceph_client *client, int ceph_print_client_options(struct seq_file *m, struct ceph_client *client,
bool show_all) bool show_all)
......
...@@ -2004,10 +2004,8 @@ int ceph_parse_ips(const char *c, const char *end, ...@@ -2004,10 +2004,8 @@ int ceph_parse_ips(const char *c, const char *end,
return 0; return 0;
bad: bad:
pr_err("parse_ips bad ip '%.*s'\n", (int)(end - c), c);
return ret; return ret;
} }
EXPORT_SYMBOL(ceph_parse_ips);
static int process_banner(struct ceph_connection *con) static int process_banner(struct ceph_connection *con)
{ {
......
...@@ -1233,9 +1233,6 @@ static void dispatch(struct ceph_connection *con, struct ceph_msg *msg) ...@@ -1233,9 +1233,6 @@ static void dispatch(struct ceph_connection *con, struct ceph_msg *msg)
struct ceph_mon_client *monc = con->private; struct ceph_mon_client *monc = con->private;
int type = le16_to_cpu(msg->hdr.type); int type = le16_to_cpu(msg->hdr.type);
if (!monc)
return;
switch (type) { switch (type) {
case CEPH_MSG_AUTH_REPLY: case CEPH_MSG_AUTH_REPLY:
handle_auth_reply(monc, msg); handle_auth_reply(monc, msg);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册