History

libceph, rbd, ceph: convert to use the new mount API

Convert the ceph filesystem to the new internal mount API as the old one will be obsoleted and removed. This allows greater flexibility in communication of mount parameters between userspace, the VFS and the filesystem. See Documentation/filesystems/mount_api.txt for more information. [ Numerous string handling, leak and regression fixes; rbd conversion was particularly broken and had to be redone almost from scratch. ]

David Howells committed 7 years ago

Commit 82995cc1 parent 196e2d68 files · +681 −673Browse files

Unified · Split

8 files
  1. drivers/block/rbd.c +153 −109
  2. fs/ceph/cache.c +5 −4
  3. fs/ceph/cache.h +3 −2
  4. fs/ceph/super.c +324 −322
  5. fs/ceph/super.h +0 −1
  6. include/linux/ceph/libceph.h +6 −4
  7. net/ceph/ceph_common.c +190 −229
  8. net/ceph/messenger.c +0 −2
drivers/block/rbd.c+153−109
@@ -34,7 +34,7 @@ · 33 unmodified lines
3434 #include <linux/ceph/cls_lock_client.h>
3535 #include <linux/ceph/striper.h>
3636 #include <linux/ceph/decode.h>
37−#include <linux/parser.h>
37+#include <linux/fs_parser.h>
3838 #include <linux/bsearch.h>
3939
4040 #include <linux/kernel.h>
@@ -838,34 +838,34 @@ enum { · 797 unmodified lines
838838 Opt_queue_depth,
839839 Opt_alloc_size,
840840 Opt_lock_timeout,
841− Opt_last_int,
842841 /* int args above */
843842 Opt_pool_ns,
844− Opt_last_string,
845843 /* string args above */
846844 Opt_read_only,
847845 Opt_read_write,
848846 Opt_lock_on_read,
849847 Opt_exclusive,
850848 Opt_notrim,
851− Opt_err
852849 };
853850
854−static match_table_t rbd_opts_tokens = {
855− {Opt_queue_depth, "queue_depth=%d"},
856− {Opt_alloc_size, "alloc_size=%d"},
857− {Opt_lock_timeout, "lock_timeout=%d"},
858− /* int args above */
859− {Opt_pool_ns, "_pool_ns=%s"},
860− /* string args above */
861− {Opt_read_only, "read_only"},
862− {Opt_read_only, "ro"}, /* Alternate spelling */
863− {Opt_read_write, "read_write"},
864− {Opt_read_write, "rw"}, /* Alternate spelling */
865− {Opt_lock_on_read, "lock_on_read"},
866− {Opt_exclusive, "exclusive"},
867− {Opt_notrim, "notrim"},
868− {Opt_err, NULL}
851+static const struct fs_parameter_spec rbd_param_specs[] = {
852+ fsparam_u32 ("alloc_size", Opt_alloc_size),
853+ fsparam_flag ("exclusive", Opt_exclusive),
854+ fsparam_flag ("lock_on_read", Opt_lock_on_read),
855+ fsparam_u32 ("lock_timeout", Opt_lock_timeout),
856+ fsparam_flag ("notrim", Opt_notrim),
857+ fsparam_string ("_pool_ns", Opt_pool_ns),
858+ fsparam_u32 ("queue_depth", Opt_queue_depth),
859+ fsparam_flag ("read_only", Opt_read_only),
860+ fsparam_flag ("read_write", Opt_read_write),
861+ fsparam_flag ("ro", Opt_read_only),
862+ fsparam_flag ("rw", Opt_read_write),
863+ {}
864+};
865+
866+static const struct fs_parameter_description rbd_parameters = {
867+ .name = "rbd",
868+ .specs = rbd_param_specs,
869869 };
870870
871871 struct rbd_options {
@@ -886,87 +886,12 @@ struct rbd_options { · 14 unmodified lines
886886 #define RBD_EXCLUSIVE_DEFAULT false
887887 #define RBD_TRIM_DEFAULT true
888888
889−struct parse_rbd_opts_ctx {
889+struct rbd_parse_opts_ctx {
890890 struct rbd_spec *spec;
891+ struct ceph_options *copts;
891892 struct rbd_options *opts;
892893 };
893894
894−static int parse_rbd_opts_token(char *c, void *private)
895−{
896− struct parse_rbd_opts_ctx *pctx = private;
897− substring_t argstr[MAX_OPT_ARGS];
898− int token, intval, ret;
899−
900− token = match_token(c, rbd_opts_tokens, argstr);
901− if (token < Opt_last_int) {
902− ret = match_int(&argstr[0], &intval);
903− if (ret < 0) {
904− pr_err("bad option arg (not int) at '%s'\n", c);
905− return ret;
906− }
907− dout("got int token %d val %d\n", token, intval);
908− } else if (token > Opt_last_int && token < Opt_last_string) {
909− dout("got string token %d val %s\n", token, argstr[0].from);
910− } else {
911− dout("got token %d\n", token);
912− }
913−
914− switch (token) {
915− case Opt_queue_depth:
916− if (intval < 1) {
917− pr_err("queue_depth out of range\n");
918− return -EINVAL;
919− }
920− pctx->opts->queue_depth = intval;
921− break;
922− case Opt_alloc_size:
923− if (intval < SECTOR_SIZE) {
924− pr_err("alloc_size out of range\n");
925− return -EINVAL;
926− }
927− if (!is_power_of_2(intval)) {
928− pr_err("alloc_size must be a power of 2\n");
929− return -EINVAL;
930− }
931− pctx->opts->alloc_size = intval;
932− break;
933− case Opt_lock_timeout:
934− /* 0 is "wait forever" (i.e. infinite timeout) */
935− if (intval < 0 || intval > INT_MAX / 1000) {
936− pr_err("lock_timeout out of range\n");
937− return -EINVAL;
938− }
939− pctx->opts->lock_timeout = msecs_to_jiffies(intval * 1000);
940− break;
941− case Opt_pool_ns:
942− kfree(pctx->spec->pool_ns);
943− pctx->spec->pool_ns = match_strdup(argstr);
944− if (!pctx->spec->pool_ns)
945− return -ENOMEM;
946− break;
947− case Opt_read_only:
948− pctx->opts->read_only = true;
949− break;
950− case Opt_read_write:
951− pctx->opts->read_only = false;
952− break;
953− case Opt_lock_on_read:
954− pctx->opts->lock_on_read = true;
955− break;
956− case Opt_exclusive:
957− pctx->opts->exclusive = true;
958− break;
959− case Opt_notrim:
960− pctx->opts->trim = false;
961− break;
962− default:
963− /* libceph prints "bad option" msg */
964− return -EINVAL;
965− }
966−
967− return 0;
968−}
969−
970895 static char* obj_op_name(enum obj_operation_type op_type)
971896 {
972897 switch (op_type) {
@@ -6423,6 +6348,122 @@ static inline char *dup_token(const char **buf, size_t *lenp) · 5450 unmodified lines
64236348 return dup;
64246349 }
64256350
6351+static int rbd_parse_param(struct fs_parameter *param,
6352+ struct rbd_parse_opts_ctx *pctx)
6353+{
6354+ struct rbd_options *opt = pctx->opts;
6355+ struct fs_parse_result result;
6356+ int token, ret;
6357+
6358+ ret = ceph_parse_param(param, pctx->copts, NULL);
6359+ if (ret != -ENOPARAM)
6360+ return ret;
6361+
6362+ token = fs_parse(NULL, &rbd_parameters, param, &result);
6363+ dout("%s fs_parse '%s' token %d\n", __func__, param->key, token);
6364+ if (token < 0) {
6365+ if (token == -ENOPARAM) {
6366+ return invalf(NULL, "rbd: Unknown parameter '%s'",
6367+ param->key);
6368+ }
6369+ return token;
6370+ }
6371+
6372+ switch (token) {
6373+ case Opt_queue_depth:
6374+ if (result.uint_32 < 1)
6375+ goto out_of_range;
6376+ opt->queue_depth = result.uint_32;
6377+ break;
6378+ case Opt_alloc_size:
6379+ if (result.uint_32 < SECTOR_SIZE)
6380+ goto out_of_range;
6381+ if (!is_power_of_2(result.uint_32)) {
6382+ return invalf(NULL, "rbd: alloc_size must be a power of 2");
6383+ }
6384+ opt->alloc_size = result.uint_32;
6385+ break;
6386+ case Opt_lock_timeout:
6387+ /* 0 is "wait forever" (i.e. infinite timeout) */
6388+ if (result.uint_32 > INT_MAX / 1000)
6389+ goto out_of_range;
6390+ opt->lock_timeout = msecs_to_jiffies(result.uint_32 * 1000);
6391+ break;
6392+ case Opt_pool_ns:
6393+ kfree(pctx->spec->pool_ns);
6394+ pctx->spec->pool_ns = param->string;
6395+ param->string = NULL;
6396+ break;
6397+ case Opt_read_only:
6398+ opt->read_only = true;
6399+ break;
6400+ case Opt_read_write:
6401+ opt->read_only = false;
6402+ break;
6403+ case Opt_lock_on_read:
6404+ opt->lock_on_read = true;
6405+ break;
6406+ case Opt_exclusive:
6407+ opt->exclusive = true;
6408+ break;
6409+ case Opt_notrim:
6410+ opt->trim = false;
6411+ break;
6412+ default:
6413+ BUG();
6414+ }
6415+
6416+ return 0;
6417+
6418+out_of_range:
6419+ return invalf(NULL, "rbd: %s out of range", param->key);
6420+}
6421+
6422+/*
6423+ * This duplicates most of generic_parse_monolithic(), untying it from
6424+ * fs_context and skipping standard superblock and security options.
6425+ */
6426+static int rbd_parse_options(char *options, struct rbd_parse_opts_ctx *pctx)
6427+{
6428+ char *key;
6429+ int ret = 0;
6430+
6431+ dout("%s '%s'\n", __func__, options);
6432+ while ((key = strsep(&options, ",")) != NULL) {
6433+ if (*key) {
6434+ struct fs_parameter param = {
6435+ .key = key,
6436+ .type = fs_value_is_string,
6437+ };
6438+ char *value = strchr(key, '=');
6439+ size_t v_len = 0;
6440+
6441+ if (value) {
6442+ if (value == key)
6443+ continue;
6444+ *value++ = 0;
6445+ v_len = strlen(value);
6446+ }
6447+
6448+
6449+ if (v_len > 0) {
6450+ param.string = kmemdup_nul(value, v_len,
6451+ GFP_KERNEL);
6452+ if (!param.string)
6453+ return -ENOMEM;
6454+ }
6455+ param.size = v_len;
6456+
6457+ ret = rbd_parse_param(&param, pctx);
6458+ kfree(param.string);
6459+ if (ret)
6460+ break;
6461+ }
6462+ }
6463+
6464+ return ret;
6465+}
6466+
64266467 /*
64276468 * Parse the options provided for an "rbd add" (i.e., rbd image
64286469 * mapping) request. These arrive via a write to /sys/bus/rbd/add,
@@ -6474,8 +6515,7 @@ static int rbd_add_parse_args(const char *buf, · 45 unmodified lines
64746515 const char *mon_addrs;
64756516 char *snap_name;
64766517 size_t mon_addrs_size;
6477− struct parse_rbd_opts_ctx pctx = { 0 };
6478− struct ceph_options *copts;
6518+ struct rbd_parse_opts_ctx pctx = { 0 };
64796519 int ret;
64806520
64816521 /* The first four tokens are required */
@@ -6486,7 +6526,7 @@ static int rbd_add_parse_args(const char *buf, · 4 unmodified lines
64866526 return -EINVAL;
64876527 }
64886528 mon_addrs = buf;
6489− mon_addrs_size = len + 1;
6529+ mon_addrs_size = len;
64906530 buf += len;
64916531
64926532 ret = -EINVAL;
@@ -6536,6 +6576,10 @@ static int rbd_add_parse_args(const char *buf, · 43 unmodified lines
65366576 *(snap_name + len) = '\0';
65376577 pctx.spec->snap_name = snap_name;
65386578
6579+ pctx.copts = ceph_alloc_options();
6580+ if (!pctx.copts)
6581+ goto out_mem;
6582+
65396583 /* Initialize all rbd options to the defaults */
65406584
65416585 pctx.opts = kzalloc(sizeof(*pctx.opts), GFP_KERNEL);
@@ -6550,27 +6594,27 @@ static int rbd_add_parse_args(const char *buf, · 8 unmodified lines
65506594 pctx.opts->exclusive = RBD_EXCLUSIVE_DEFAULT;
65516595 pctx.opts->trim = RBD_TRIM_DEFAULT;
65526596
6553− copts = ceph_parse_options(options, mon_addrs,
6554− mon_addrs + mon_addrs_size - 1,
6555− parse_rbd_opts_token, &pctx);
6556− if (IS_ERR(copts)) {
6557− ret = PTR_ERR(copts);
6597+ ret = ceph_parse_mon_ips(mon_addrs, mon_addrs_size, pctx.copts, NULL);
6598+ if (ret)
65586599 goto out_err;
6559− }
6560− kfree(options);
65616600
6562− *ceph_opts = copts;
6601+ ret = rbd_parse_options(options, &pctx);
6602+ if (ret)
6603+ goto out_err;
6604+
6605+ *ceph_opts = pctx.copts;
65636606 *opts = pctx.opts;
65646607 *rbd_spec = pctx.spec;
6565−
6608+ kfree(options);
65666609 return 0;
6610+
65676611 out_mem:
65686612 ret = -ENOMEM;
65696613 out_err:
65706614 kfree(pctx.opts);
6615+ ceph_destroy_options(pctx.copts);
65716616 rbd_spec_put(pctx.spec);
65726617 kfree(options);
6573−
65746618 return ret;
65756619 }
65766620
fs/ceph/cache.c+5−4
@@ -8,6 +8,7 @@ · 7 unmodified lines
88
99 #include <linux/ceph/ceph_debug.h>
1010
11+#include <linux/fs_context.h>
1112 #include "super.h"
1213 #include "cache.h"
1314
@@ -49,7 +50,7 @@ void ceph_fscache_unregister(void) · 35 unmodified lines
4950 fscache_unregister_netfs(&ceph_cache_netfs);
5051 }
5152
52−int ceph_fscache_register_fs(struct ceph_fs_client* fsc)
53+int ceph_fscache_register_fs(struct ceph_fs_client* fsc, struct fs_context *fc)
5354 {
5455 const struct ceph_fsid *fsid = &fsc->client->fsid;
5556 const char *fscache_uniq = fsc->mount_options->fscache_uniq;
@@ -66,8 +67,8 @@ int ceph_fscache_register_fs(struct ceph_fs_client* fsc) · 10 unmodified lines
6667 if (uniq_len && memcmp(ent->uniquifier, fscache_uniq, uniq_len))
6768 continue;
6869
69− pr_err("fscache cookie already registered for fsid %pU\n", fsid);
70− pr_err(" use fsc=%%s mount option to specify a uniquifier\n");
70+ errorf(fc, "ceph: fscache cookie already registered for fsid %pU, use fsc=<uniquifier> option",
71+ fsid);
7172 err = -EBUSY;
7273 goto out_unlock;
7374 }
@@ -95,7 +96,7 @@ int ceph_fscache_register_fs(struct ceph_fs_client* fsc) · 21 unmodified lines
9596 list_add_tail(&ent->list, &ceph_fscache_list);
9697 } else {
9798 kfree(ent);
98− pr_err("unable to register fscache cookie for fsid %pU\n",
99+ errorf(fc, "ceph: unable to register fscache cookie for fsid %pU",
99100 fsid);
100101 /* all other fs ignore this error */
101102 }
fs/ceph/cache.h+3−2
@@ -16,7 +16,7 @@ extern struct fscache_netfs ceph_cache_netfs; · 15 unmodified lines
1616 int ceph_fscache_register(void);
1717 void ceph_fscache_unregister(void);
1818
19−int ceph_fscache_register_fs(struct ceph_fs_client* fsc);
19+int ceph_fscache_register_fs(struct ceph_fs_client* fsc, struct fs_context *fc);
2020 void ceph_fscache_unregister_fs(struct ceph_fs_client* fsc);
2121
2222 void ceph_fscache_register_inode_cookie(struct inode *inode);
@@ -88,7 +88,8 @@ static inline void ceph_fscache_unregister(void) · 65 unmodified lines
8888 {
8989 }
9090
91−static inline int ceph_fscache_register_fs(struct ceph_fs_client* fsc)
91+static inline int ceph_fscache_register_fs(struct ceph_fs_client* fsc,
92+ struct fs_context *fc)
9293 {
9394 return 0;
9495 }
fs/ceph/super.c+324−322
@@ -9,7 +9,8 @@ · 8 unmodified lines
99 #include <linux/in6.h>
1010 #include <linux/module.h>
1111 #include <linux/mount.h>
12−#include <linux/parser.h>
12+#include <linux/fs_context.h>
13+#include <linux/fs_parser.h>
1314 #include <linux/sched.h>
1415 #include <linux/seq_file.h>
1516 #include <linux/slab.h>
@@ -138,280 +139,308 @@ enum { · 122 unmodified lines
138139 Opt_readdir_max_entries,
139140 Opt_readdir_max_bytes,
140141 Opt_congestion_kb,
141− Opt_last_int,
142142 /* int args above */
143143 Opt_snapdirname,
144144 Opt_mds_namespace,
145− Opt_fscache_uniq,
146145 Opt_recover_session,
147− Opt_last_string,
146+ Opt_source,
148147 /* string args above */
149148 Opt_dirstat,
150− Opt_nodirstat,
151149 Opt_rbytes,
152− Opt_norbytes,
153150 Opt_asyncreaddir,
154− Opt_noasyncreaddir,
155151 Opt_dcache,
156− Opt_nodcache,
157152 Opt_ino32,
158− Opt_noino32,
159153 Opt_fscache,
160− Opt_nofscache,
161154 Opt_poolperm,
162− Opt_nopoolperm,
163155 Opt_require_active_mds,
164− Opt_norequire_active_mds,
165−#ifdef CONFIG_CEPH_FS_POSIX_ACL
166156 Opt_acl,
167−#endif
168− Opt_noacl,
169157 Opt_quotadf,
170− Opt_noquotadf,
171158 Opt_copyfrom,
172− Opt_nocopyfrom,
173159 };
174160
175−static match_table_t fsopt_tokens = {
176− {Opt_wsize, "wsize=%d"},
177− {Opt_rsize, "rsize=%d"},
178− {Opt_rasize, "rasize=%d"},
179− {Opt_caps_wanted_delay_min, "caps_wanted_delay_min=%d"},
180− {Opt_caps_wanted_delay_max, "caps_wanted_delay_max=%d"},
181− {Opt_caps_max, "caps_max=%d"},
182− {Opt_readdir_max_entries, "readdir_max_entries=%d"},
183− {Opt_readdir_max_bytes, "readdir_max_bytes=%d"},
184− {Opt_congestion_kb, "write_congestion_kb=%d"},
185− /* int args above */
186− {Opt_snapdirname, "snapdirname=%s"},
187− {Opt_mds_namespace, "mds_namespace=%s"},
188− {Opt_recover_session, "recover_session=%s"},
189− {Opt_fscache_uniq, "fsc=%s"},
190− /* string args above */
191− {Opt_dirstat, "dirstat"},
192− {Opt_nodirstat, "nodirstat"},
193− {Opt_rbytes, "rbytes"},
194− {Opt_norbytes, "norbytes"},
195− {Opt_asyncreaddir, "asyncreaddir"},
196− {Opt_noasyncreaddir, "noasyncreaddir"},
197− {Opt_dcache, "dcache"},
198− {Opt_nodcache, "nodcache"},
199− {Opt_ino32, "ino32"},
200− {Opt_noino32, "noino32"},
201− {Opt_fscache, "fsc"},
202− {Opt_nofscache, "nofsc"},
203− {Opt_poolperm, "poolperm"},
204− {Opt_nopoolperm, "nopoolperm"},
205− {Opt_require_active_mds, "require_active_mds"},
206− {Opt_norequire_active_mds, "norequire_active_mds"},
207−#ifdef CONFIG_CEPH_FS_POSIX_ACL
208− {Opt_acl, "acl"},
209−#endif
210− {Opt_noacl, "noacl"},
211− {Opt_quotadf, "quotadf"},
212− {Opt_noquotadf, "noquotadf"},
213− {Opt_copyfrom, "copyfrom"},
214− {Opt_nocopyfrom, "nocopyfrom"},
215− {-1, NULL}
161+enum ceph_recover_session_mode {
162+ ceph_recover_session_no,
163+ ceph_recover_session_clean
164+};
165+
166+static const struct fs_parameter_enum ceph_mount_param_enums[] = {
167+ { Opt_recover_session, "no", ceph_recover_session_no },
168+ { Opt_recover_session, "clean", ceph_recover_session_clean },
169+ {}
170+};
171+
172+static const struct fs_parameter_spec ceph_mount_param_specs[] = {
173+ fsparam_flag_no ("acl", Opt_acl),
174+ fsparam_flag_no ("asyncreaddir", Opt_asyncreaddir),
175+ fsparam_u32 ("caps_max", Opt_caps_max),
176+ fsparam_u32 ("caps_wanted_delay_max", Opt_caps_wanted_delay_max),
177+ fsparam_u32 ("caps_wanted_delay_min", Opt_caps_wanted_delay_min),
178+ fsparam_s32 ("write_congestion_kb", Opt_congestion_kb),
179+ fsparam_flag_no ("copyfrom", Opt_copyfrom),
180+ fsparam_flag_no ("dcache", Opt_dcache),
181+ fsparam_flag_no ("dirstat", Opt_dirstat),
182+ __fsparam (fs_param_is_string, "fsc", Opt_fscache,
183+ fs_param_neg_with_no | fs_param_v_optional),
184+ fsparam_flag_no ("ino32", Opt_ino32),
185+ fsparam_string ("mds_namespace", Opt_mds_namespace),
186+ fsparam_flag_no ("poolperm", Opt_poolperm),
187+ fsparam_flag_no ("quotadf", Opt_quotadf),
188+ fsparam_u32 ("rasize", Opt_rasize),
189+ fsparam_flag_no ("rbytes", Opt_rbytes),
190+ fsparam_s32 ("readdir_max_bytes", Opt_readdir_max_bytes),
191+ fsparam_s32 ("readdir_max_entries", Opt_readdir_max_entries),
192+ fsparam_enum ("recover_session", Opt_recover_session),
193+ fsparam_flag_no ("require_active_mds", Opt_require_active_mds),
194+ fsparam_u32 ("rsize", Opt_rsize),
195+ fsparam_string ("snapdirname", Opt_snapdirname),
196+ fsparam_string ("source", Opt_source),
197+ fsparam_u32 ("wsize", Opt_wsize),
198+ {}
199+};
200+
201+static const struct fs_parameter_description ceph_mount_parameters = {
202+ .name = "ceph",
203+ .specs = ceph_mount_param_specs,
204+ .enums = ceph_mount_param_enums,
216205 };
217206
218−static int parse_fsopt_token(char *c, void *private)
207+struct ceph_parse_opts_ctx {
208+ struct ceph_options *copts;
209+ struct ceph_mount_options *opts;
210+};
211+
212+/*
213+ * Parse the source parameter. Distinguish the server list from the path.
214+ * Internally we do not include the leading '/' in the path.
215+ *
216+ * The source will look like:
217+ * <server_spec>[,<server_spec>...]:[<path>]
218+ * where
219+ * <server_spec> is <ip>[:<port>]
220+ * <path> is optional, but if present must begin with '/'
221+ */
222+static int ceph_parse_source(struct fs_parameter *param, struct fs_context *fc)
219223 {
220− struct ceph_mount_options *fsopt = private;
221− substring_t argstr[MAX_OPT_ARGS];
222− int token, intval, ret;
224+ struct ceph_parse_opts_ctx *pctx = fc->fs_private;
225+ struct ceph_mount_options *fsopt = pctx->opts;
226+ char *dev_name = param->string, *dev_name_end;
227+ int ret;
223228
224− token = match_token((char *)c, fsopt_tokens, argstr);
225− if (token < 0)
226− return -EINVAL;
229+ dout("%s '%s'\n", __func__, dev_name);
230+ if (!dev_name || !*dev_name)
231+ return invalf(fc, "ceph: Empty source");
227232
228− if (token < Opt_last_int) {
229− ret = match_int(&argstr[0], &intval);
230− if (ret < 0) {
231− pr_err("bad option arg (not int) at '%s'\n", c);
232− return ret;
233+ dev_name_end = strchr(dev_name, '/');
234+ if (dev_name_end) {
235+ if (strlen(dev_name_end) > 1) {
236+ kfree(fsopt->server_path);
237+ fsopt->server_path = kstrdup(dev_name_end, GFP_KERNEL);
238+ if (!fsopt->server_path)
239+ return -ENOMEM;
233240 }
234− dout("got int token %d val %d\n", token, intval);
235− } else if (token > Opt_last_int && token < Opt_last_string) {
236− dout("got string token %d val %s\n", token,
237− argstr[0].from);
238241 } else {
239− dout("got token %d\n", token);
242+ dev_name_end = dev_name + strlen(dev_name);
240243 }
241244
245+ dev_name_end--; /* back up to ':' separator */
246+ if (dev_name_end < dev_name || *dev_name_end != ':')
247+ return invalf(fc, "ceph: No path or : separator in source");
248+
249+ dout("device name '%.*s'\n", (int)(dev_name_end - dev_name), dev_name);
250+ if (fsopt->server_path)
251+ dout("server path '%s'\n", fsopt->server_path);
252+
253+ ret = ceph_parse_mon_ips(param->string, dev_name_end - dev_name,
254+ pctx->copts, fc);
255+ if (ret)
256+ return ret;
257+
258+ fc->source = param->string;
259+ param->string = NULL;
260+ return 0;
261+}
262+
263+static int ceph_parse_mount_param(struct fs_context *fc,
264+ struct fs_parameter *param)
265+{
266+ struct ceph_parse_opts_ctx *pctx = fc->fs_private;
267+ struct ceph_mount_options *fsopt = pctx->opts;
268+ struct fs_parse_result result;
269+ unsigned int mode;
270+ int token, ret;
271+
272+ ret = ceph_parse_param(param, pctx->copts, fc);
273+ if (ret != -ENOPARAM)
274+ return ret;
275+
276+ token = fs_parse(fc, &ceph_mount_parameters, param, &result);
277+ dout("%s fs_parse '%s' token %d\n", __func__, param->key, token);
278+ if (token < 0)
279+ return token;
280+
242281 switch (token) {
243282 case Opt_snapdirname:
244283 kfree(fsopt->snapdir_name);
245− fsopt->snapdir_name = kstrndup(argstr[0].from,
246− argstr[0].to-argstr[0].from,
247− GFP_KERNEL);
248− if (!fsopt->snapdir_name)
249− return -ENOMEM;
284+ fsopt->snapdir_name = param->string;
285+ param->string = NULL;
250286 break;
251287 case Opt_mds_namespace:
252288 kfree(fsopt->mds_namespace);
253− fsopt->mds_namespace = kstrndup(argstr[0].from,
254− argstr[0].to-argstr[0].from,
255− GFP_KERNEL);
256− if (!fsopt->mds_namespace)
257− return -ENOMEM;
289+ fsopt->mds_namespace = param->string;
290+ param->string = NULL;
258291 break;
259292 case Opt_recover_session:
260− if (!strncmp(argstr[0].from, "no",
261− argstr[0].to - argstr[0].from)) {
293+ mode = result.uint_32;
294+ if (mode == ceph_recover_session_no)
262295 fsopt->flags &= ~CEPH_MOUNT_OPT_CLEANRECOVER;
263− } else if (!strncmp(argstr[0].from, "clean",
264− argstr[0].to - argstr[0].from)) {
296+ else if (mode == ceph_recover_session_clean)
265297 fsopt->flags |= CEPH_MOUNT_OPT_CLEANRECOVER;
266− } else {
267− return -EINVAL;
268− }
269− break;
270− case Opt_fscache_uniq:
271−#ifdef CONFIG_CEPH_FSCACHE
272− kfree(fsopt->fscache_uniq);
273− fsopt->fscache_uniq = kstrndup(argstr[0].from,
274− argstr[0].to-argstr[0].from,
275− GFP_KERNEL);
276− if (!fsopt->fscache_uniq)
277− return -ENOMEM;
278− fsopt->flags |= CEPH_MOUNT_OPT_FSCACHE;
298+ else
299+ BUG();
279300 break;
280−#else
281− pr_err("fscache support is disabled\n");
282− return -EINVAL;
283−#endif
301+ case Opt_source:
302+ if (fc->source)
303+ return invalf(fc, "ceph: Multiple sources specified");
304+ return ceph_parse_source(param, fc);
284305 case Opt_wsize:
285− if (intval < (int)PAGE_SIZE || intval > CEPH_MAX_WRITE_SIZE)
286− return -EINVAL;
287− fsopt->wsize = ALIGN(intval, PAGE_SIZE);
306+ if (result.uint_32 < PAGE_SIZE ||
307+ result.uint_32 > CEPH_MAX_WRITE_SIZE)
308+ goto out_of_range;
309+ fsopt->wsize = ALIGN(result.uint_32, PAGE_SIZE);
288310 break;
289311 case Opt_rsize:
290− if (intval < (int)PAGE_SIZE || intval > CEPH_MAX_READ_SIZE)
291− return -EINVAL;
292− fsopt->rsize = ALIGN(intval, PAGE_SIZE);
312+ if (result.uint_32 < PAGE_SIZE ||
313+ result.uint_32 > CEPH_MAX_READ_SIZE)
314+ goto out_of_range;
315+ fsopt->rsize = ALIGN(result.uint_32, PAGE_SIZE);
293316 break;
294317 case Opt_rasize:
295− if (intval < 0)
296− return -EINVAL;
297− fsopt->rasize = ALIGN(intval, PAGE_SIZE);
318+ fsopt->rasize = ALIGN(result.uint_32, PAGE_SIZE);
298319 break;
299320 case Opt_caps_wanted_delay_min:
300− if (intval < 1)
301− return -EINVAL;
302− fsopt->caps_wanted_delay_min = intval;
321+ if (result.uint_32 < 1)
322+ goto out_of_range;
323+ fsopt->caps_wanted_delay_min = result.uint_32;
303324 break;
304325 case Opt_caps_wanted_delay_max:
305− if (intval < 1)
306− return -EINVAL;
307− fsopt->caps_wanted_delay_max = intval;
326+ if (result.uint_32 < 1)
327+ goto out_of_range;
328+ fsopt->caps_wanted_delay_max = result.uint_32;
308329 break;
309330 case Opt_caps_max:
310− if (intval < 0)
311− return -EINVAL;
312− fsopt->caps_max = intval;
331+ fsopt->caps_max = result.uint_32;
313332 break;
314333 case Opt_readdir_max_entries:
315− if (intval < 1)
316− return -EINVAL;
317− fsopt->max_readdir = intval;
334+ if (result.uint_32 < 1)
335+ goto out_of_range;
336+ fsopt->max_readdir = result.uint_32;
318337 break;
319338 case Opt_readdir_max_bytes:
320− if (intval < (int)PAGE_SIZE && intval != 0)
321− return -EINVAL;
322− fsopt->max_readdir_bytes = intval;
339+ if (result.uint_32 < PAGE_SIZE && result.uint_32 != 0)
340+ goto out_of_range;
341+ fsopt->max_readdir_bytes = result.uint_32;
323342 break;
324343 case Opt_congestion_kb:
325− if (intval < 1024) /* at least 1M */
326− return -EINVAL;
327− fsopt->congestion_kb = intval;
344+ if (result.uint_32 < 1024) /* at least 1M */
345+ goto out_of_range;
346+ fsopt->congestion_kb = result.uint_32;
328347 break;
329348 case Opt_dirstat:
330− fsopt->flags |= CEPH_MOUNT_OPT_DIRSTAT;
331− break;
332− case Opt_nodirstat:
333− fsopt->flags &= ~CEPH_MOUNT_OPT_DIRSTAT;
349+ if (!result.negated)
350+ fsopt->flags |= CEPH_MOUNT_OPT_DIRSTAT;
351+ else
352+ fsopt->flags &= ~CEPH_MOUNT_OPT_DIRSTAT;
334353 break;
335354 case Opt_rbytes:
336− fsopt->flags |= CEPH_MOUNT_OPT_RBYTES;
337− break;
338− case Opt_norbytes:
339− fsopt->flags &= ~CEPH_MOUNT_OPT_RBYTES;
355+ if (!result.negated)
356+ fsopt->flags |= CEPH_MOUNT_OPT_RBYTES;
357+ else
358+ fsopt->flags &= ~CEPH_MOUNT_OPT_RBYTES;
340359 break;
341360 case Opt_asyncreaddir:
342− fsopt->flags &= ~CEPH_MOUNT_OPT_NOASYNCREADDIR;
343− break;
344− case Opt_noasyncreaddir:
345− fsopt->flags |= CEPH_MOUNT_OPT_NOASYNCREADDIR;
361+ if (!result.negated)
362+ fsopt->flags &= ~CEPH_MOUNT_OPT_NOASYNCREADDIR;
363+ else
364+ fsopt->flags |= CEPH_MOUNT_OPT_NOASYNCREADDIR;
346365 break;
347366 case Opt_dcache:
348− fsopt->flags |= CEPH_MOUNT_OPT_DCACHE;
349− break;
350− case Opt_nodcache:
351− fsopt->flags &= ~CEPH_MOUNT_OPT_DCACHE;
367+ if (!result.negated)
368+ fsopt->flags |= CEPH_MOUNT_OPT_DCACHE;
369+ else
370+ fsopt->flags &= ~CEPH_MOUNT_OPT_DCACHE;
352371 break;
353372 case Opt_ino32:
354− fsopt->flags |= CEPH_MOUNT_OPT_INO32;
355− break;
356− case Opt_noino32:
357− fsopt->flags &= ~CEPH_MOUNT_OPT_INO32;
373+ if (!result.negated)
374+ fsopt->flags |= CEPH_MOUNT_OPT_INO32;
375+ else
376+ fsopt->flags &= ~CEPH_MOUNT_OPT_INO32;
358377 break;
378+
359379 case Opt_fscache:
360380 #ifdef CONFIG_CEPH_FSCACHE
361− fsopt->flags |= CEPH_MOUNT_OPT_FSCACHE;
362381 kfree(fsopt->fscache_uniq);
363382 fsopt->fscache_uniq = NULL;
383+ if (result.negated) {
384+ fsopt->flags &= ~CEPH_MOUNT_OPT_FSCACHE;
385+ } else {
386+ fsopt->flags |= CEPH_MOUNT_OPT_FSCACHE;
387+ fsopt->fscache_uniq = param->string;
388+ param->string = NULL;
389+ }
364390 break;
365391 #else
366− pr_err("fscache support is disabled\n");
367− return -EINVAL;
392+ return invalf(fc, "ceph: fscache support is disabled");
368393 #endif
369− case Opt_nofscache:
370− fsopt->flags &= ~CEPH_MOUNT_OPT_FSCACHE;
371− kfree(fsopt->fscache_uniq);
372− fsopt->fscache_uniq = NULL;
373− break;
374394 case Opt_poolperm:
375− fsopt->flags &= ~CEPH_MOUNT_OPT_NOPOOLPERM;
376− break;
377− case Opt_nopoolperm:
378− fsopt->flags |= CEPH_MOUNT_OPT_NOPOOLPERM;
395+ if (!result.negated)
396+ fsopt->flags &= ~CEPH_MOUNT_OPT_NOPOOLPERM;
397+ else
398+ fsopt->flags |= CEPH_MOUNT_OPT_NOPOOLPERM;
379399 break;
380400 case Opt_require_active_mds:
381− fsopt->flags &= ~CEPH_MOUNT_OPT_MOUNTWAIT;
382− break;
383− case Opt_norequire_active_mds:
384− fsopt->flags |= CEPH_MOUNT_OPT_MOUNTWAIT;
401+ if (!result.negated)
402+ fsopt->flags &= ~CEPH_MOUNT_OPT_MOUNTWAIT;
403+ else
404+ fsopt->flags |= CEPH_MOUNT_OPT_MOUNTWAIT;
385405 break;
386406 case Opt_quotadf:
387− fsopt->flags &= ~CEPH_MOUNT_OPT_NOQUOTADF;
388− break;
389− case Opt_noquotadf:
390− fsopt->flags |= CEPH_MOUNT_OPT_NOQUOTADF;
407+ if (!result.negated)
408+ fsopt->flags &= ~CEPH_MOUNT_OPT_NOQUOTADF;
409+ else
410+ fsopt->flags |= CEPH_MOUNT_OPT_NOQUOTADF;
391411 break;
392412 case Opt_copyfrom:
393− fsopt->flags &= ~CEPH_MOUNT_OPT_NOCOPYFROM;
394− break;
395− case Opt_nocopyfrom:
396− fsopt->flags |= CEPH_MOUNT_OPT_NOCOPYFROM;
413+ if (!result.negated)
414+ fsopt->flags &= ~CEPH_MOUNT_OPT_NOCOPYFROM;
415+ else
416+ fsopt->flags |= CEPH_MOUNT_OPT_NOCOPYFROM;
397417 break;
398−#ifdef CONFIG_CEPH_FS_POSIX_ACL
399418 case Opt_acl:
400− fsopt->sb_flags |= SB_POSIXACL;
401− break;
419+ if (!result.negated) {
420+#ifdef CONFIG_CEPH_FS_POSIX_ACL
421+ fc->sb_flags |= SB_POSIXACL;
422+#else
423+ return invalf(fc, "ceph: POSIX ACL support is disabled");
402424 #endif
403− case Opt_noacl:
404− fsopt->sb_flags &= ~SB_POSIXACL;
425+ } else {
426+ fc->sb_flags &= ~SB_POSIXACL;
427+ }
405428 break;
406429 default:
407− BUG_ON(token);
430+ BUG();
408431 }
409432 return 0;
433+
434+out_of_range:
435+ return invalf(fc, "ceph: %s out of range", param->key);
410436 }
411437
412438 static void destroy_mount_options(struct ceph_mount_options *args)
413439 {
414440 dout("destroy_mount_options %p\n", args);
441+ if (!args)
442+ return;
443+
415444 kfree(args->snapdir_name);
416445 kfree(args->mds_namespace);
417446 kfree(args->server_path);
@@ -459,91 +488,6 @@ static int compare_mount_options(struct ceph_mount_options *new_fsopt, · 41 unmodified lines
459488 return ceph_compare_options(new_opt, fsc->client);
460489 }
461490
462−static int parse_mount_options(struct ceph_mount_options **pfsopt,
463− struct ceph_options **popt,
464− int flags, char *options,
465− const char *dev_name)
466−{
467− struct ceph_mount_options *fsopt;
468− const char *dev_name_end;
469− int err;
470−
471− if (!dev_name || !*dev_name)
472− return -EINVAL;
473−
474− fsopt = kzalloc(sizeof(*fsopt), GFP_KERNEL);
475− if (!fsopt)
476− return -ENOMEM;
477−
478− dout("parse_mount_options %p, dev_name '%s'\n", fsopt, dev_name);
479−
480− fsopt->sb_flags = flags;
481− fsopt->flags = CEPH_MOUNT_OPT_DEFAULT;
482−
483− fsopt->wsize = CEPH_MAX_WRITE_SIZE;
484− fsopt->rsize = CEPH_MAX_READ_SIZE;
485− fsopt->rasize = CEPH_RASIZE_DEFAULT;
486− fsopt->snapdir_name = kstrdup(CEPH_SNAPDIRNAME_DEFAULT, GFP_KERNEL);
487− if (!fsopt->snapdir_name) {
488− err = -ENOMEM;
489− goto out;
490− }
491−
492− fsopt->caps_wanted_delay_min = CEPH_CAPS_WANTED_DELAY_MIN_DEFAULT;
493− fsopt->caps_wanted_delay_max = CEPH_CAPS_WANTED_DELAY_MAX_DEFAULT;
494− fsopt->max_readdir = CEPH_MAX_READDIR_DEFAULT;
495− fsopt->max_readdir_bytes = CEPH_MAX_READDIR_BYTES_DEFAULT;
496− fsopt->congestion_kb = default_congestion_kb();
497−
498− /*
499− * Distinguish the server list from the path in "dev_name".
500− * Internally we do not include the leading '/' in the path.
501− *
502− * "dev_name" will look like:
503− * <server_spec>[,<server_spec>...]:[<path>]
504− * where
505− * <server_spec> is <ip>[:<port>]
506− * <path> is optional, but if present must begin with '/'
507− */
508− dev_name_end = strchr(dev_name, '/');
509− if (dev_name_end) {
510− if (strlen(dev_name_end) > 1) {
511− fsopt->server_path = kstrdup(dev_name_end, GFP_KERNEL);
512− if (!fsopt->server_path) {
513− err = -ENOMEM;
514− goto out;
515− }
516− }
517− } else {
518− dev_name_end = dev_name + strlen(dev_name);
519− }
520− err = -EINVAL;
521− dev_name_end--; /* back up to ':' separator */
522− if (dev_name_end < dev_name || *dev_name_end != ':') {
523− pr_err("device name is missing path (no : separator in %s)\n",
524− dev_name);
525− goto out;
526− }
527− dout("device name '%.*s'\n", (int)(dev_name_end - dev_name), dev_name);
528− if (fsopt->server_path)
529− dout("server path '%s'\n", fsopt->server_path);
530−
531− *popt = ceph_parse_options(options, dev_name, dev_name_end,
532− parse_fsopt_token, (void *)fsopt);
533− if (IS_ERR(*popt)) {
534− err = PTR_ERR(*popt);
535− goto out;
536− }
537−
538− /* success */
539− *pfsopt = fsopt;
540− return 0;
541−
542−out:
543− destroy_mount_options(fsopt);
544− return err;
545−}
546−
547491 /**
548492 * ceph_show_options - Show mount options in /proc/mounts
549493 * @m: seq_file to write to
@@ -587,7 +531,7 @@ static int ceph_show_options(struct seq_file *m, struct dentry *root) · 37 unmodified lines
587531 seq_puts(m, ",noquotadf");
588532
589533 #ifdef CONFIG_CEPH_FS_POSIX_ACL
590− if (fsopt->sb_flags & SB_POSIXACL)
534+ if (root->d_sb->s_flags & SB_POSIXACL)
591535 seq_puts(m, ",acl");
592536 else
593537 seq_puts(m, ",noacl");
@@ -860,12 +804,6 @@ static void ceph_umount_begin(struct super_block *sb) · 266 unmodified lines
860804 fsc->filp_gen++; // invalidate open files
861805 }
862806
863−static int ceph_remount(struct super_block *sb, int *flags, char *data)
864−{
865− sync_filesystem(sb);
866− return 0;
867−}
868−
869807 static const struct super_operations ceph_super_ops = {
870808 .alloc_inode = ceph_alloc_inode,
871809 .free_inode = ceph_free_inode,
@@ -874,7 +812,6 @@ static const struct super_operations ceph_super_ops = { · 2 unmodified lines
874812 .evict_inode = ceph_evict_inode,
875813 .sync_fs = ceph_sync_fs,
876814 .put_super = ceph_put_super,
877− .remount_fs = ceph_remount,
878815 .show_options = ceph_show_options,
879816 .statfs = ceph_statfs,
880817 .umount_begin = ceph_umount_begin,
@@ -935,7 +872,8 @@ out: · 54 unmodified lines
935872 /*
936873 * mount: join the ceph cluster, and open root directory.
937874 */
938−static struct dentry *ceph_real_mount(struct ceph_fs_client *fsc)
875+static struct dentry *ceph_real_mount(struct ceph_fs_client *fsc,
876+ struct fs_context *fc)
939877 {
940878 int err;
941879 unsigned long started = jiffies; /* note the start time */
@@ -952,7 +890,7 @@ static struct dentry *ceph_real_mount(struct ceph_fs_client *fsc) · 10 unmodified lines
952890
953891 /* setup fscache */
954892 if (fsc->mount_options->flags & CEPH_MOUNT_OPT_FSCACHE) {
955− err = ceph_fscache_register_fs(fsc);
893+ err = ceph_fscache_register_fs(fsc, fc);
956894 if (err < 0)
957895 goto out;
958896 }
@@ -987,18 +925,16 @@ out: · 28 unmodified lines
987925 return ERR_PTR(err);
988926 }
989927
990−static int ceph_set_super(struct super_block *s, void *data)
928+static int ceph_set_super(struct super_block *s, struct fs_context *fc)
991929 {
992− struct ceph_fs_client *fsc = data;
930+ struct ceph_fs_client *fsc = s->s_fs_info;
993931 int ret;
994932
995− dout("set_super %p data %p\n", s, data);
933+ dout("set_super %p\n", s);
996934
997− s->s_flags = fsc->mount_options->sb_flags;
998935 s->s_maxbytes = MAX_LFS_FILESIZE;
999936
1000937 s->s_xattr = ceph_xattr_handlers;
1001− s->s_fs_info = fsc;
1002938 fsc->sb = s;
1003939 fsc->max_file_size = 1ULL << 40; /* temp value until we get mdsmap */
1004940
@@ -1010,24 +946,18 @@ static int ceph_set_super(struct super_block *s, void *data) · 5 unmodified lines
1010946 s->s_time_min = 0;
1011947 s->s_time_max = U32_MAX;
1012948
1013− ret = set_anon_super(s, NULL); /* what is that second arg for? */
949+ ret = set_anon_super_fc(s, fc);
1014950 if (ret != 0)
1015− goto fail;
1016−
1017− return ret;
1018−
1019−fail:
1020− s->s_fs_info = NULL;
1021− fsc->sb = NULL;
951+ fsc->sb = NULL;
1022952 return ret;
1023953 }
1024954
1025955 /*
1026956 * share superblock if same fs AND options
1027957 */
1028−static int ceph_compare_super(struct super_block *sb, void *data)
958+static int ceph_compare_super(struct super_block *sb, struct fs_context *fc)
1029959 {
1030− struct ceph_fs_client *new = data;
960+ struct ceph_fs_client *new = fc->s_fs_info;
1031961 struct ceph_mount_options *fsopt = new->mount_options;
1032962 struct ceph_options *opt = new->client->options;
1033963 struct ceph_fs_client *other = ceph_sb_to_client(sb);
@@ -1043,7 +973,7 @@ static int ceph_compare_super(struct super_block *sb, void *data) · 9 unmodified lines
1043973 dout("fsid doesn't match\n");
1044974 return 0;
1045975 }
1046− if (fsopt->sb_flags != other->mount_options->sb_flags) {
976+ if (fc->sb_flags != (sb->s_flags & ~SB_BORN)) {
1047977 dout("flags differ\n");
1048978 return 0;
1049979 }
@@ -1073,46 +1003,46 @@ static int ceph_setup_bdi(struct super_block *sb, struct ceph_fs_client *fsc) · 23 unmodified lines
10731003 return 0;
10741004 }
10751005
1076−static struct dentry *ceph_mount(struct file_system_type *fs_type,
1077− int flags, const char *dev_name, void *data)
1006+static int ceph_get_tree(struct fs_context *fc)
10781007 {
1008+ struct ceph_parse_opts_ctx *pctx = fc->fs_private;
10791009 struct super_block *sb;
10801010 struct ceph_fs_client *fsc;
10811011 struct dentry *res;
1012+ int (*compare_super)(struct super_block *, struct fs_context *) =
1013+ ceph_compare_super;
10821014 int err;
1083− int (*compare_super)(struct super_block *, void *) = ceph_compare_super;
1084− struct ceph_mount_options *fsopt = NULL;
1085− struct ceph_options *opt = NULL;
10861015
1087− dout("ceph_mount\n");
1016+ dout("ceph_get_tree\n");
1017+
1018+ if (!fc->source)
1019+ return invalf(fc, "ceph: No source");
10881020
10891021 #ifdef CONFIG_CEPH_FS_POSIX_ACL
1090− flags |= SB_POSIXACL;
1022+ fc->sb_flags |= SB_POSIXACL;
10911023 #endif
1092− err = parse_mount_options(&fsopt, &opt, flags, data, dev_name);
1093− if (err < 0) {
1094− res = ERR_PTR(err);
1095− goto out_final;
1096− }
10971024
10981025 /* create client (which we may/may not use) */
1099− fsc = create_fs_client(fsopt, opt);
1026+ fsc = create_fs_client(pctx->opts, pctx->copts);
1027+ pctx->opts = NULL;
1028+ pctx->copts = NULL;
11001029 if (IS_ERR(fsc)) {
1101− res = ERR_CAST(fsc);
1030+ err = PTR_ERR(fsc);
11021031 goto out_final;
11031032 }
11041033
11051034 err = ceph_mdsc_init(fsc);
1106− if (err < 0) {
1107− res = ERR_PTR(err);
1035+ if (err < 0)
11081036 goto out;
1109− }
11101037
11111038 if (ceph_test_opt(fsc->client, NOSHARE))
11121039 compare_super = NULL;
1113− sb = sget(fs_type, compare_super, ceph_set_super, flags, fsc);
1040+
1041+ fc->s_fs_info = fsc;
1042+ sb = sget_fc(fc, compare_super, ceph_set_super);
1043+ fc->s_fs_info = NULL;
11141044 if (IS_ERR(sb)) {
1115− res = ERR_CAST(sb);
1045+ err = PTR_ERR(sb);
11161046 goto out;
11171047 }
11181048
@@ -1123,18 +1053,19 @@ static struct dentry *ceph_mount(struct file_system_type *fs_type, · 4 unmodified lines
11231053 } else {
11241054 dout("get_sb using new client %p\n", fsc);
11251055 err = ceph_setup_bdi(sb, fsc);
1126− if (err < 0) {
1127− res = ERR_PTR(err);
1056+ if (err < 0)
11281057 goto out_splat;
1129− }
11301058 }
11311059
1132− res = ceph_real_mount(fsc);
1133− if (IS_ERR(res))
1060+ res = ceph_real_mount(fsc, fc);
1061+ if (IS_ERR(res)) {
1062+ err = PTR_ERR(res);
11341063 goto out_splat;
1064+ }
11351065 dout("root %p inode %p ino %llx.%llx\n", res,
11361066 d_inode(res), ceph_vinop(d_inode(res)));
1137− return res;
1067+ fc->root = fsc->sb->s_root;
1068+ return 0;
11381069
11391070 out_splat:
11401071 ceph_mdsc_close_sessions(fsc->mdsc);
@@ -1144,8 +1075,79 @@ out_splat: · 3 unmodified lines
11441075 out:
11451076 destroy_fs_client(fsc);
11461077 out_final:
1147− dout("ceph_mount fail %ld\n", PTR_ERR(res));
1148− return res;
1078+ dout("ceph_get_tree fail %d\n", err);
1079+ return err;
1080+}
1081+
1082+static void ceph_free_fc(struct fs_context *fc)
1083+{
1084+ struct ceph_parse_opts_ctx *pctx = fc->fs_private;
1085+
1086+ if (pctx) {
1087+ destroy_mount_options(pctx->opts);
1088+ ceph_destroy_options(pctx->copts);
1089+ kfree(pctx);
1090+ }
1091+}
1092+
1093+static int ceph_reconfigure_fc(struct fs_context *fc)
1094+{
1095+ sync_filesystem(fc->root->d_sb);
1096+ return 0;
1097+}
1098+
1099+static const struct fs_context_operations ceph_context_ops = {
1100+ .free = ceph_free_fc,
1101+ .parse_param = ceph_parse_mount_param,
1102+ .get_tree = ceph_get_tree,
1103+ .reconfigure = ceph_reconfigure_fc,
1104+};
1105+
1106+/*
1107+ * Set up the filesystem mount context.
1108+ */
1109+static int ceph_init_fs_context(struct fs_context *fc)
1110+{
1111+ struct ceph_parse_opts_ctx *pctx;
1112+ struct ceph_mount_options *fsopt;
1113+
1114+ pctx = kzalloc(sizeof(*pctx), GFP_KERNEL);
1115+ if (!pctx)
1116+ return -ENOMEM;
1117+
1118+ pctx->copts = ceph_alloc_options();
1119+ if (!pctx->copts)
1120+ goto nomem;
1121+
1122+ pctx->opts = kzalloc(sizeof(*pctx->opts), GFP_KERNEL);
1123+ if (!pctx->opts)
1124+ goto nomem;
1125+
1126+ fsopt = pctx->opts;
1127+ fsopt->flags = CEPH_MOUNT_OPT_DEFAULT;
1128+
1129+ fsopt->wsize = CEPH_MAX_WRITE_SIZE;
1130+ fsopt->rsize = CEPH_MAX_READ_SIZE;
1131+ fsopt->rasize = CEPH_RASIZE_DEFAULT;
1132+ fsopt->snapdir_name = kstrdup(CEPH_SNAPDIRNAME_DEFAULT, GFP_KERNEL);
1133+ if (!fsopt->snapdir_name)
1134+ goto nomem;
1135+
1136+ fsopt->caps_wanted_delay_min = CEPH_CAPS_WANTED_DELAY_MIN_DEFAULT;
1137+ fsopt->caps_wanted_delay_max = CEPH_CAPS_WANTED_DELAY_MAX_DEFAULT;
1138+ fsopt->max_readdir = CEPH_MAX_READDIR_DEFAULT;
1139+ fsopt->max_readdir_bytes = CEPH_MAX_READDIR_BYTES_DEFAULT;
1140+ fsopt->congestion_kb = default_congestion_kb();
1141+
1142+ fc->fs_private = pctx;
1143+ fc->ops = &ceph_context_ops;
1144+ return 0;
1145+
1146+nomem:
1147+ destroy_mount_options(pctx->opts);
1148+ ceph_destroy_options(pctx->copts);
1149+ kfree(pctx);
1150+ return -ENOMEM;
11491151 }
11501152
11511153 static void ceph_kill_sb(struct super_block *s)
@@ -1172,7 +1174,7 @@ static void ceph_kill_sb(struct super_block *s) · 20 unmodified lines
11721174 static struct file_system_type ceph_fs_type = {
11731175 .owner = THIS_MODULE,
11741176 .name = "ceph",
1175− .mount = ceph_mount,
1177+ .init_fs_context = ceph_init_fs_context,
11761178 .kill_sb = ceph_kill_sb,
11771179 .fs_flags = FS_RENAME_DOES_D_MOVE,
11781180 };
fs/ceph/super.h+0−1
@@ -74,7 +74,6 @@ · 73 unmodified lines
7474
7575 struct ceph_mount_options {
7676 int flags;
77− int sb_flags;
7877
7978 int wsize; /* max write size */
8079 int rsize; /* max read size */
include/linux/ceph/libceph.h+6−4
@@ -280,10 +280,12 @@ extern const char *ceph_msg_type_name(int type); · 279 unmodified lines
280280 extern int ceph_check_fsid(struct ceph_client *client, struct ceph_fsid *fsid);
281281 extern void *ceph_kvmalloc(size_t size, gfp_t flags);
282282
283−extern struct ceph_options *ceph_parse_options(char *options,
284− const char *dev_name, const char *dev_name_end,
285− int (*parse_extra_token)(char *c, void *private),
286− void *private);
283+struct fs_parameter;
284+struct ceph_options *ceph_alloc_options(void);
285+int ceph_parse_mon_ips(const char *buf, size_t len, struct ceph_options *opt,
286+ struct fs_context *fc);
287+int ceph_parse_param(struct fs_parameter *param, struct ceph_options *opt,
288+ struct fs_context *fc);
287289 int ceph_print_client_options(struct seq_file *m, struct ceph_client *client,
288290 bool show_all);
289291 extern void ceph_destroy_options(struct ceph_options *opt);
net/ceph/ceph_common.c+190−229
@@ -11,7 +11,7 @@ · 10 unmodified lines
1111 #include <linux/module.h>
1212 #include <linux/mount.h>
1313 #include <linux/nsproxy.h>
14−#include <linux/parser.h>
14+#include <linux/fs_parser.h>
1515 #include <linux/sched.h>
1616 #include <linux/sched/mm.h>
1717 #include <linux/seq_file.h>
@@ -254,58 +254,77 @@ enum { · 236 unmodified lines
254254 Opt_mount_timeout,
255255 Opt_osd_idle_ttl,
256256 Opt_osd_request_timeout,
257− Opt_last_int,
258257 /* int args above */
259258 Opt_fsid,
260259 Opt_name,
261260 Opt_secret,
262261 Opt_key,
263262 Opt_ip,
264− Opt_last_string,
265263 /* string args above */
266264 Opt_share,
267− Opt_noshare,
268265 Opt_crc,
269− Opt_nocrc,
270266 Opt_cephx_require_signatures,
271− Opt_nocephx_require_signatures,
272267 Opt_cephx_sign_messages,
273− Opt_nocephx_sign_messages,
274268 Opt_tcp_nodelay,
275− Opt_notcp_nodelay,
276269 Opt_abort_on_full,
277270 };
278271
279−static match_table_t opt_tokens = {
280− {Opt_osdtimeout, "osdtimeout=%d"},
281− {Opt_osdkeepalivetimeout, "osdkeepalive=%d"},
282− {Opt_mount_timeout, "mount_timeout=%d"},
283− {Opt_osd_idle_ttl, "osd_idle_ttl=%d"},
284− {Opt_osd_request_timeout, "osd_request_timeout=%d"},
285− /* int args above */
286− {Opt_fsid, "fsid=%s"},
287− {Opt_name, "name=%s"},
288− {Opt_secret, "secret=%s"},
289− {Opt_key, "key=%s"},
290− {Opt_ip, "ip=%s"},
291− /* string args above */
292− {Opt_share, "share"},
293− {Opt_noshare, "noshare"},
294− {Opt_crc, "crc"},
295− {Opt_nocrc, "nocrc"},
296− {Opt_cephx_require_signatures, "cephx_require_signatures"},
297− {Opt_nocephx_require_signatures, "nocephx_require_signatures"},
298− {Opt_cephx_sign_messages, "cephx_sign_messages"},
299− {Opt_nocephx_sign_messages, "nocephx_sign_messages"},
300− {Opt_tcp_nodelay, "tcp_nodelay"},
301− {Opt_notcp_nodelay, "notcp_nodelay"},
302− {Opt_abort_on_full, "abort_on_full"},
303− {-1, NULL}
272+static const struct fs_parameter_spec ceph_param_specs[] = {
273+ fsparam_flag ("abort_on_full", Opt_abort_on_full),
274+ fsparam_flag_no ("cephx_require_signatures", Opt_cephx_require_signatures),
275+ fsparam_flag_no ("cephx_sign_messages", Opt_cephx_sign_messages),
276+ fsparam_flag_no ("crc", Opt_crc),
277+ fsparam_string ("fsid", Opt_fsid),
278+ fsparam_string ("ip", Opt_ip),
279+ fsparam_string ("key", Opt_key),
280+ fsparam_u32 ("mount_timeout", Opt_mount_timeout),
281+ fsparam_string ("name", Opt_name),
282+ fsparam_u32 ("osd_idle_ttl", Opt_osd_idle_ttl),
283+ fsparam_u32 ("osd_request_timeout", Opt_osd_request_timeout),
284+ fsparam_u32 ("osdkeepalive", Opt_osdkeepalivetimeout),
285+ __fsparam (fs_param_is_s32, "osdtimeout", Opt_osdtimeout,
286+ fs_param_deprecated),
287+ fsparam_string ("secret", Opt_secret),
288+ fsparam_flag_no ("share", Opt_share),
289+ fsparam_flag_no ("tcp_nodelay", Opt_tcp_nodelay),
290+ {}
291+};
292+
293+static const struct fs_parameter_description ceph_parameters = {
294+ .name = "libceph",
295+ .specs = ceph_param_specs,
304296 };
305297
298+struct ceph_options *ceph_alloc_options(void)
299+{
300+ struct ceph_options *opt;
301+
302+ opt = kzalloc(sizeof(*opt), GFP_KERNEL);
303+ if (!opt)
304+ return NULL;
305+
306+ opt->mon_addr = kcalloc(CEPH_MAX_MON, sizeof(*opt->mon_addr),
307+ GFP_KERNEL);
308+ if (!opt->mon_addr) {
309+ kfree(opt);
310+ return NULL;
311+ }
312+
313+ opt->flags = CEPH_OPT_DEFAULT;
314+ opt->osd_keepalive_timeout = CEPH_OSD_KEEPALIVE_DEFAULT;
315+ opt->mount_timeout = CEPH_MOUNT_TIMEOUT_DEFAULT;
316+ opt->osd_idle_ttl = CEPH_OSD_IDLE_TTL_DEFAULT;
317+ opt->osd_request_timeout = CEPH_OSD_REQUEST_TIMEOUT_DEFAULT;
318+ return opt;
319+}
320+EXPORT_SYMBOL(ceph_alloc_options);
321+
306322 void ceph_destroy_options(struct ceph_options *opt)
307323 {
308324 dout("destroy_options %p\n", opt);
325+ if (!opt)
326+ return;
327+
309328 kfree(opt->name);
310329 if (opt->key) {
311330 ceph_crypto_key_destroy(opt->key);
@@ -317,7 +336,9 @@ void ceph_destroy_options(struct ceph_options *opt) · 5 unmodified lines
317336 EXPORT_SYMBOL(ceph_destroy_options);
318337
319338 /* get secret from key store */
320−static int get_secret(struct ceph_crypto_key *dst, const char *name) {
339+static int get_secret(struct ceph_crypto_key *dst, const char *name,
340+ struct fs_context *fc)
341+{
321342 struct key *ukey;
322343 int key_err;
323344 int err = 0;
@@ -330,20 +351,20 @@ static int get_secret(struct ceph_crypto_key *dst, const char *name) { · 6 unmodified lines
330351 key_err = PTR_ERR(ukey);
331352 switch (key_err) {
332353 case -ENOKEY:
333− pr_warn("ceph: Mount failed due to key not found: %s\n",
334− name);
354+ errorf(fc, "libceph: Failed due to key not found: %s",
355+ name);
335356 break;
336357 case -EKEYEXPIRED:
337− pr_warn("ceph: Mount failed due to expired key: %s\n",
338− name);
358+ errorf(fc, "libceph: Failed due to expired key: %s",
359+ name);
339360 break;
340361 case -EKEYREVOKED:
341− pr_warn("ceph: Mount failed due to revoked key: %s\n",
342− name);
362+ errorf(fc, "libceph: Failed due to revoked key: %s",
363+ name);
343364 break;
344365 default:
345− pr_warn("ceph: Mount failed due to unknown key error %d: %s\n",
346− key_err, name);
366+ errorf(fc, "libceph: Failed due to key error %d: %s",
367+ key_err, name);
347368 }
348369 err = -EPERM;
349370 goto out;
@@ -361,217 +382,157 @@ out: · 11 unmodified lines
361382 return err;
362383 }
363384
364−struct ceph_options *
365−ceph_parse_options(char *options, const char *dev_name,
366− const char *dev_name_end,
367− int (*parse_extra_token)(char *c, void *private),
368− void *private)
385+int ceph_parse_mon_ips(const char *buf, size_t len, struct ceph_options *opt,
386+ struct fs_context *fc)
369387 {
370− struct ceph_options *opt;
371− const char *c;
372− int err = -ENOMEM;
373− substring_t argstr[MAX_OPT_ARGS];
374−
375− opt = kzalloc(sizeof(*opt), GFP_KERNEL);
376− if (!opt)
377− return ERR_PTR(-ENOMEM);
378− opt->mon_addr = kcalloc(CEPH_MAX_MON, sizeof(*opt->mon_addr),
379− GFP_KERNEL);
380− if (!opt->mon_addr)
381− goto out;
382−
383− dout("parse_options %p options '%s' dev_name '%s'\n", opt, options,
384− dev_name);
385−
386− /* start with defaults */
387− opt->flags = CEPH_OPT_DEFAULT;
388− opt->osd_keepalive_timeout = CEPH_OSD_KEEPALIVE_DEFAULT;
389− opt->mount_timeout = CEPH_MOUNT_TIMEOUT_DEFAULT;
390− opt->osd_idle_ttl = CEPH_OSD_IDLE_TTL_DEFAULT;
391− opt->osd_request_timeout = CEPH_OSD_REQUEST_TIMEOUT_DEFAULT;
388+ int ret;
392389
393− /* get mon ip(s) */
394390 /* ip1[:port1][,ip2[:port2]...] */
395− err = ceph_parse_ips(dev_name, dev_name_end, opt->mon_addr,
396− CEPH_MAX_MON, &opt->num_mon);
397− if (err < 0)
398− goto out;
391+ ret = ceph_parse_ips(buf, buf + len, opt->mon_addr, CEPH_MAX_MON,
392+ &opt->num_mon);
393+ if (ret) {
394+ errorf(fc, "libceph: Failed to parse monitor IPs: %d", ret);
395+ return ret;
396+ }
399397
400− /* parse mount options */
401− while ((c = strsep(&options, ",")) != NULL) {
402− int token, intval;
403− if (!*c)
404− continue;
405− err = -EINVAL;
406− token = match_token((char *)c, opt_tokens, argstr);
407− if (token < 0 && parse_extra_token) {
408− /* extra? */
409− err = parse_extra_token((char *)c, private);
410− if (err < 0) {
411− pr_err("bad option at '%s'\n", c);
412− goto out;
413− }
414− continue;
415− }
416− if (token < Opt_last_int) {
417− err = match_int(&argstr[0], &intval);
418− if (err < 0) {
419− pr_err("bad option arg (not int) at '%s'\n", c);
420− goto out;
421− }
422− dout("got int token %d val %d\n", token, intval);
423− } else if (token > Opt_last_int && token < Opt_last_string) {
424− dout("got string token %d val %s\n", token,
425− argstr[0].from);
426− } else {
427− dout("got token %d\n", token);
398+ return 0;
399+}
400+EXPORT_SYMBOL(ceph_parse_mon_ips);
401+
402+int ceph_parse_param(struct fs_parameter *param, struct ceph_options *opt,
403+ struct fs_context *fc)
404+{
405+ struct fs_parse_result result;
406+ int token, err;
407+
408+ token = fs_parse(fc, &ceph_parameters, param, &result);
409+ dout("%s fs_parse '%s' token %d\n", __func__, param->key, token);
410+ if (token < 0)
411+ return token;
412+
413+ switch (token) {
414+ case Opt_ip:
415+ err = ceph_parse_ips(param->string,
416+ param->string + param->size,
417+ &opt->my_addr,
418+ 1, NULL);
419+ if (err) {
420+ errorf(fc, "libceph: Failed to parse ip: %d", err);
421+ return err;
428422 }
429− switch (token) {
430− case Opt_ip:
431− err = ceph_parse_ips(argstr[0].from,
432− argstr[0].to,
433− &opt->my_addr,
434− 1, NULL);
435− if (err < 0)
436− goto out;
437− opt->flags |= CEPH_OPT_MYIP;
438− break;
423+ opt->flags |= CEPH_OPT_MYIP;
424+ break;
439425
440− case Opt_fsid:
441− err = parse_fsid(argstr[0].from, &opt->fsid);
442− if (err == 0)
443− opt->flags |= CEPH_OPT_FSID;
444− break;
445− case Opt_name:
446− kfree(opt->name);
447− opt->name = kstrndup(argstr[0].from,
448− argstr[0].to-argstr[0].from,
449− GFP_KERNEL);
450− if (!opt->name) {
451− err = -ENOMEM;
452− goto out;
453− }
454− break;
455− case Opt_secret:
456− ceph_crypto_key_destroy(opt->key);
457− kfree(opt->key);
458−
459− opt->key = kzalloc(sizeof(*opt->key), GFP_KERNEL);
460− if (!opt->key) {
461− err = -ENOMEM;
462− goto out;
463− }
464− err = ceph_crypto_key_unarmor(opt->key, argstr[0].from);
465− if (err < 0)
466− goto out;
467− break;
468− case Opt_key:
469− ceph_crypto_key_destroy(opt->key);
470− kfree(opt->key);
471−
472− opt->key = kzalloc(sizeof(*opt->key), GFP_KERNEL);
473− if (!opt->key) {
474− err = -ENOMEM;
475− goto out;
476− }
477− err = get_secret(opt->key, argstr[0].from);
478− if (err < 0)
479− goto out;
480− break;
426+ case Opt_fsid:
427+ err = parse_fsid(param->string, &opt->fsid);
428+ if (err) {
429+ errorf(fc, "libceph: Failed to parse fsid: %d", err);
430+ return err;
431+ }
432+ opt->flags |= CEPH_OPT_FSID;
433+ break;
434+ case Opt_name:
435+ kfree(opt->name);
436+ opt->name = param->string;
437+ param->string = NULL;
438+ break;
439+ case Opt_secret:
440+ ceph_crypto_key_destroy(opt->key);
441+ kfree(opt->key);
481442
482− /* misc */
483− case Opt_osdtimeout:
484− pr_warn("ignoring deprecated osdtimeout option\n");
485− break;
486− case Opt_osdkeepalivetimeout:
487− /* 0 isn't well defined right now, reject it */
488− if (intval < 1 || intval > INT_MAX / 1000) {
489− pr_err("osdkeepalive out of range\n");
490− err = -EINVAL;
491− goto out;
492− }
493− opt->osd_keepalive_timeout =
494− msecs_to_jiffies(intval * 1000);
495− break;
496− case Opt_osd_idle_ttl:
497− /* 0 isn't well defined right now, reject it */
498− if (intval < 1 || intval > INT_MAX / 1000) {
499− pr_err("osd_idle_ttl out of range\n");
500− err = -EINVAL;
501− goto out;
502− }
503− opt->osd_idle_ttl = msecs_to_jiffies(intval * 1000);
504− break;
505− case Opt_mount_timeout:
506− /* 0 is "wait forever" (i.e. infinite timeout) */
507− if (intval < 0 || intval > INT_MAX / 1000) {
508− pr_err("mount_timeout out of range\n");
509− err = -EINVAL;
510− goto out;
511− }
512− opt->mount_timeout = msecs_to_jiffies(intval * 1000);
513− break;
514− case Opt_osd_request_timeout:
515− /* 0 is "wait forever" (i.e. infinite timeout) */
516− if (intval < 0 || intval > INT_MAX / 1000) {
517− pr_err("osd_request_timeout out of range\n");
518− err = -EINVAL;
519− goto out;
520− }
521− opt->osd_request_timeout = msecs_to_jiffies(intval * 1000);
522− break;
443+ opt->key = kzalloc(sizeof(*opt->key), GFP_KERNEL);
444+ if (!opt->key)
445+ return -ENOMEM;
446+ err = ceph_crypto_key_unarmor(opt->key, param->string);
447+ if (err) {
448+ errorf(fc, "libceph: Failed to parse secret: %d", err);
449+ return err;
450+ }
451+ break;
452+ case Opt_key:
453+ ceph_crypto_key_destroy(opt->key);
454+ kfree(opt->key);
523455
524− case Opt_share:
456+ opt->key = kzalloc(sizeof(*opt->key), GFP_KERNEL);
457+ if (!opt->key)
458+ return -ENOMEM;
459+ return get_secret(opt->key, param->string, fc);
460+
461+ case Opt_osdtimeout:
462+ warnf(fc, "libceph: Ignoring osdtimeout");
463+ break;
464+ case Opt_osdkeepalivetimeout:
465+ /* 0 isn't well defined right now, reject it */
466+ if (result.uint_32 < 1 || result.uint_32 > INT_MAX / 1000)
467+ goto out_of_range;
468+ opt->osd_keepalive_timeout =
469+ msecs_to_jiffies(result.uint_32 * 1000);
470+ break;
471+ case Opt_osd_idle_ttl:
472+ /* 0 isn't well defined right now, reject it */
473+ if (result.uint_32 < 1 || result.uint_32 > INT_MAX / 1000)
474+ goto out_of_range;
475+ opt->osd_idle_ttl = msecs_to_jiffies(result.uint_32 * 1000);
476+ break;
477+ case Opt_mount_timeout:
478+ /* 0 is "wait forever" (i.e. infinite timeout) */
479+ if (result.uint_32 > INT_MAX / 1000)
480+ goto out_of_range;
481+ opt->mount_timeout = msecs_to_jiffies(result.uint_32 * 1000);
482+ break;
483+ case Opt_osd_request_timeout:
484+ /* 0 is "wait forever" (i.e. infinite timeout) */
485+ if (result.uint_32 > INT_MAX / 1000)
486+ goto out_of_range;
487+ opt->osd_request_timeout =
488+ msecs_to_jiffies(result.uint_32 * 1000);
489+ break;
490+
491+ case Opt_share:
492+ if (!result.negated)
525493 opt->flags &= ~CEPH_OPT_NOSHARE;
526− break;
527− case Opt_noshare:
494+ else
528495 opt->flags |= CEPH_OPT_NOSHARE;
529− break;
530−
531− case Opt_crc:
496+ break;
497+ case Opt_crc:
498+ if (!result.negated)
532499 opt->flags &= ~CEPH_OPT_NOCRC;
533− break;
534− case Opt_nocrc:
500+ else
535501 opt->flags |= CEPH_OPT_NOCRC;
536− break;
537−
538− case Opt_cephx_require_signatures:
502+ break;
503+ case Opt_cephx_require_signatures:
504+ if (!result.negated)
539505 opt->flags &= ~CEPH_OPT_NOMSGAUTH;
540− break;
541− case Opt_nocephx_require_signatures:
506+ else
542507 opt->flags |= CEPH_OPT_NOMSGAUTH;
543− break;
544− case Opt_cephx_sign_messages:
508+ break;
509+ case Opt_cephx_sign_messages:
510+ if (!result.negated)
545511 opt->flags &= ~CEPH_OPT_NOMSGSIGN;
546− break;
547− case Opt_nocephx_sign_messages:
512+ else
548513 opt->flags |= CEPH_OPT_NOMSGSIGN;
549− break;
550−
551− case Opt_tcp_nodelay:
514+ break;
515+ case Opt_tcp_nodelay:
516+ if (!result.negated)
552517 opt->flags |= CEPH_OPT_TCP_NODELAY;
553− break;
554− case Opt_notcp_nodelay:
518+ else
555519 opt->flags &= ~CEPH_OPT_TCP_NODELAY;
556− break;
520+ break;
557521
558− case Opt_abort_on_full:
559− opt->flags |= CEPH_OPT_ABORT_ON_FULL;
560− break;
522+ case Opt_abort_on_full:
523+ opt->flags |= CEPH_OPT_ABORT_ON_FULL;
524+ break;
561525
562− default:
563− BUG_ON(token);
564− }
526+ default:
527+ BUG();
565528 }
566529
567− /* success */
568− return opt;
530+ return 0;
569531
570−out:
571− ceph_destroy_options(opt);
572− return ERR_PTR(err);
532+out_of_range:
533+ return invalf(fc, "libceph: %s out of range", param->key);
573534 }
574−EXPORT_SYMBOL(ceph_parse_options);
535+EXPORT_SYMBOL(ceph_parse_param);
575536
576537 int ceph_print_client_options(struct seq_file *m, struct ceph_client *client,
577538 bool show_all)
net/ceph/messenger.c+0−2
@@ -2004,10 +2004,8 @@ int ceph_parse_ips(const char *c, const char *end, · 2003 unmodified lines
20042004 return 0;
20052005
20062006 bad:
2007− pr_err("parse_ips bad ip '%.*s'\n", (int)(end - c), c);
20082007 return ret;
20092008 }
2010−EXPORT_SYMBOL(ceph_parse_ips);
20112009
20122010 static int process_banner(struct ceph_connection *con)
20132011 {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t