summaryrefslogtreecommitdiffstats
path: root/drivers/block
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-06-12 11:28:19 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2013-06-12 11:28:19 -0400
commit8d7a8fe2ce2f242953aef46226eaa8a4a1a2c380 (patch)
tree310f88f97aa3192a95fd13423efd93bd5ec57c0e /drivers/block
parent77293e215edef7871a39de4b326f777bc39278ca (diff)
parent3abef3b3585bbc67d56fdc9c67761a900fb4b69d (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/sage/ceph-client
Pull ceph fixes from Sage Weil: "There is a pair of fixes for double-frees in the recent bundle for 3.10, a couple of fixes for long-standing bugs (sleep while atomic and an endianness fix), and a locking fix that can be triggered when osds are going down" * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/sage/ceph-client: rbd: fix cleanup in rbd_add() rbd: don't destroy ceph_opts in rbd_add() ceph: ceph_pagelist_append might sleep while atomic ceph: add cpu_to_le32() calls when encoding a reconnect capability libceph: must hold mutex for reset_changed_osds()
Diffstat (limited to 'drivers/block')
-rw-r--r--drivers/block/rbd.c33
1 files changed, 18 insertions, 15 deletions
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index d6d314027b5d..3063452e55da 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -519,8 +519,8 @@ static const struct block_device_operations rbd_bd_ops = {
519}; 519};
520 520
521/* 521/*
522 * Initialize an rbd client instance. 522 * Initialize an rbd client instance. Success or not, this function
523 * We own *ceph_opts. 523 * consumes ceph_opts.
524 */ 524 */
525static struct rbd_client *rbd_client_create(struct ceph_options *ceph_opts) 525static struct rbd_client *rbd_client_create(struct ceph_options *ceph_opts)
526{ 526{
@@ -675,7 +675,8 @@ static int parse_rbd_opts_token(char *c, void *private)
675 675
676/* 676/*
677 * Get a ceph client with specific addr and configuration, if one does 677 * Get a ceph client with specific addr and configuration, if one does
678 * not exist create it. 678 * not exist create it. Either way, ceph_opts is consumed by this
679 * function.
679 */ 680 */
680static struct rbd_client *rbd_get_client(struct ceph_options *ceph_opts) 681static struct rbd_client *rbd_get_client(struct ceph_options *ceph_opts)
681{ 682{
@@ -4697,8 +4698,10 @@ out:
4697 return ret; 4698 return ret;
4698} 4699}
4699 4700
4700/* Undo whatever state changes are made by v1 or v2 image probe */ 4701/*
4701 4702 * Undo whatever state changes are made by v1 or v2 header info
4703 * call.
4704 */
4702static void rbd_dev_unprobe(struct rbd_device *rbd_dev) 4705static void rbd_dev_unprobe(struct rbd_device *rbd_dev)
4703{ 4706{
4704 struct rbd_image_header *header; 4707 struct rbd_image_header *header;
@@ -4902,9 +4905,10 @@ static int rbd_dev_image_probe(struct rbd_device *rbd_dev, bool mapping)
4902 int tmp; 4905 int tmp;
4903 4906
4904 /* 4907 /*
4905 * Get the id from the image id object. If it's not a 4908 * Get the id from the image id object. Unless there's an
4906 * format 2 image, we'll get ENOENT back, and we'll assume 4909 * error, rbd_dev->spec->image_id will be filled in with
4907 * it's a format 1 image. 4910 * a dynamically-allocated string, and rbd_dev->image_format
4911 * will be set to either 1 or 2.
4908 */ 4912 */
4909 ret = rbd_dev_image_id(rbd_dev); 4913 ret = rbd_dev_image_id(rbd_dev);
4910 if (ret) 4914 if (ret)
@@ -4992,7 +4996,6 @@ static ssize_t rbd_add(struct bus_type *bus,
4992 rc = PTR_ERR(rbdc); 4996 rc = PTR_ERR(rbdc);
4993 goto err_out_args; 4997 goto err_out_args;
4994 } 4998 }
4995 ceph_opts = NULL; /* rbd_dev client now owns this */
4996 4999
4997 /* pick the pool */ 5000 /* pick the pool */
4998 osdc = &rbdc->client->osdc; 5001 osdc = &rbdc->client->osdc;
@@ -5027,18 +5030,18 @@ static ssize_t rbd_add(struct bus_type *bus,
5027 rbd_dev->mapping.read_only = read_only; 5030 rbd_dev->mapping.read_only = read_only;
5028 5031
5029 rc = rbd_dev_device_setup(rbd_dev); 5032 rc = rbd_dev_device_setup(rbd_dev);
5030 if (!rc) 5033 if (rc) {
5031 return count; 5034 rbd_dev_image_release(rbd_dev);
5035 goto err_out_module;
5036 }
5037
5038 return count;
5032 5039
5033 rbd_dev_image_release(rbd_dev);
5034err_out_rbd_dev: 5040err_out_rbd_dev:
5035 rbd_dev_destroy(rbd_dev); 5041 rbd_dev_destroy(rbd_dev);
5036err_out_client: 5042err_out_client:
5037 rbd_put_client(rbdc); 5043 rbd_put_client(rbdc);
5038err_out_args: 5044err_out_args:
5039 if (ceph_opts)
5040 ceph_destroy_options(ceph_opts);
5041 kfree(rbd_opts);
5042 rbd_spec_put(spec); 5045 rbd_spec_put(spec);
5043err_out_module: 5046err_out_module:
5044 module_put(THIS_MODULE); 5047 module_put(THIS_MODULE);