aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/block/rbd.c6
-rw-r--r--fs/ceph/super.c6
-rw-r--r--include/linux/ceph/libceph.h2
-rw-r--r--net/ceph/ceph_common.c16
4 files changed, 17 insertions, 13 deletions
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index b9371f0b9532..ed6711e35323 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -371,11 +371,13 @@ static int rbd_get_client(struct rbd_device *rbd_dev, const char *mon_addr,
371 371
372 rbd_opts->notify_timeout = RBD_NOTIFY_TIMEOUT_DEFAULT; 372 rbd_opts->notify_timeout = RBD_NOTIFY_TIMEOUT_DEFAULT;
373 373
374 ret = ceph_parse_options(&opt, options, mon_addr, 374 opt = ceph_parse_options(options, mon_addr,
375 mon_addr + strlen(mon_addr), 375 mon_addr + strlen(mon_addr),
376 parse_rbd_opts_token, rbd_opts); 376 parse_rbd_opts_token, rbd_opts);
377 if (ret < 0) 377 if (IS_ERR(opt)) {
378 ret = PTR_ERR(opt);
378 goto done_err; 379 goto done_err;
380 }
379 381
380 spin_lock(&node_lock); 382 spin_lock(&node_lock);
381 rbdc = __rbd_client_find(opt); 383 rbdc = __rbd_client_find(opt);
diff --git a/fs/ceph/super.c b/fs/ceph/super.c
index c3da3b32bdde..4fab1fdcfa6a 100644
--- a/fs/ceph/super.c
+++ b/fs/ceph/super.c
@@ -334,10 +334,12 @@ static int parse_mount_options(struct ceph_mount_options **pfsopt,
334 *path += 2; 334 *path += 2;
335 dout("server path '%s'\n", *path); 335 dout("server path '%s'\n", *path);
336 336
337 err = ceph_parse_options(popt, options, dev_name, dev_name_end, 337 *popt = ceph_parse_options(options, dev_name, dev_name_end,
338 parse_fsopt_token, (void *)fsopt); 338 parse_fsopt_token, (void *)fsopt);
339 if (err) 339 if (IS_ERR(*popt)) {
340 err = PTR_ERR(*popt);
340 goto out; 341 goto out;
342 }
341 343
342 /* success */ 344 /* success */
343 *pfsopt = fsopt; 345 *pfsopt = fsopt;
diff --git a/include/linux/ceph/libceph.h b/include/linux/ceph/libceph.h
index 95bd8502e715..92eef7c3d3c5 100644
--- a/include/linux/ceph/libceph.h
+++ b/include/linux/ceph/libceph.h
@@ -207,7 +207,7 @@ extern struct kmem_cache *ceph_cap_cachep;
207extern struct kmem_cache *ceph_dentry_cachep; 207extern struct kmem_cache *ceph_dentry_cachep;
208extern struct kmem_cache *ceph_file_cachep; 208extern struct kmem_cache *ceph_file_cachep;
209 209
210extern int ceph_parse_options(struct ceph_options **popt, char *options, 210extern struct ceph_options *ceph_parse_options(char *options,
211 const char *dev_name, const char *dev_name_end, 211 const char *dev_name, const char *dev_name_end,
212 int (*parse_extra_token)(char *c, void *private), 212 int (*parse_extra_token)(char *c, void *private),
213 void *private); 213 void *private);
diff --git a/net/ceph/ceph_common.c b/net/ceph/ceph_common.c
index 761ad9d6cc3b..621c3221b393 100644
--- a/net/ceph/ceph_common.c
+++ b/net/ceph/ceph_common.c
@@ -277,10 +277,11 @@ out:
277 return err; 277 return err;
278} 278}
279 279
280int ceph_parse_options(struct ceph_options **popt, char *options, 280struct ceph_options *
281 const char *dev_name, const char *dev_name_end, 281ceph_parse_options(char *options, const char *dev_name,
282 int (*parse_extra_token)(char *c, void *private), 282 const char *dev_name_end,
283 void *private) 283 int (*parse_extra_token)(char *c, void *private),
284 void *private)
284{ 285{
285 struct ceph_options *opt; 286 struct ceph_options *opt;
286 const char *c; 287 const char *c;
@@ -289,7 +290,7 @@ int ceph_parse_options(struct ceph_options **popt, char *options,
289 290
290 opt = kzalloc(sizeof(*opt), GFP_KERNEL); 291 opt = kzalloc(sizeof(*opt), GFP_KERNEL);
291 if (!opt) 292 if (!opt)
292 return err; 293 return ERR_PTR(-ENOMEM);
293 opt->mon_addr = kcalloc(CEPH_MAX_MON, sizeof(*opt->mon_addr), 294 opt->mon_addr = kcalloc(CEPH_MAX_MON, sizeof(*opt->mon_addr),
294 GFP_KERNEL); 295 GFP_KERNEL);
295 if (!opt->mon_addr) 296 if (!opt->mon_addr)
@@ -412,12 +413,11 @@ int ceph_parse_options(struct ceph_options **popt, char *options,
412 } 413 }
413 414
414 /* success */ 415 /* success */
415 *popt = opt; 416 return opt;
416 return 0;
417 417
418out: 418out:
419 ceph_destroy_options(opt); 419 ceph_destroy_options(opt);
420 return err; 420 return ERR_PTR(err);
421} 421}
422EXPORT_SYMBOL(ceph_parse_options); 422EXPORT_SYMBOL(ceph_parse_options);
423 423