From: Josh Durgin <josh.durgin@inktank.com>
To: Alex Elder <elder@inktank.com>
Cc: ceph-devel@vger.kernel.org
Subject: Re: [PATCH] rbd: don't destroy ceph_opts in rbd_add()
Date: Thu, 16 May 2013 18:20:11 -0700 [thread overview]
Message-ID: <519585CB.30006@inktank.com> (raw)
In-Reply-To: <51954FA8.6030306@inktank.com>
Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
On 05/16/2013 02:29 PM, Alex Elder wrote:
> (Note: this patch and the two I'm about to re-post are available
> in the "review/wip-4559" branch of the ceph-client git repository.)
>
>
>
> Whether rbd_client_create() successfully creates a new client or
> not, it takes responsibility for getting the ceph_opts structure
> it's passed destroyed. If successful, the structure becomes
> associated with the created client; if not, rbd_client_create()
> will destroy it.
>
> Previously, rbd_get_client() would call ceph_destroy_options()
> if rbd_get_client() failed, and that meant it got called twice.
> That led freeing various pointers more than once, which is never a
> good idea.
>
> This resolves:
> http://tracker.ceph.com/issues/4559
>
> Reported-by: Dan van der Ster <dan@vanderster.com>
> Signed-off-by: Alex Elder <elder@inktank.com>
> ---
> drivers/block/rbd.c | 10 ++++------
> 1 file changed, 4 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
> index e8d4693..ade30dd 100644
> --- a/drivers/block/rbd.c
> +++ b/drivers/block/rbd.c
> @@ -521,8 +521,8 @@ static const struct block_device_operations
> rbd_bd_ops = {
> };
>
> /*
> - * Initialize an rbd client instance.
> - * We own *ceph_opts.
> + * Initialize an rbd client instance. Success or not, this function
> + * consumes ceph_opts.
> */
> static struct rbd_client *rbd_client_create(struct ceph_options *ceph_opts)
> {
> @@ -677,7 +677,8 @@ static int parse_rbd_opts_token(char *c, void *private)
>
> /*
> * Get a ceph client with specific addr and configuration, if one does
> - * not exist create it.
> + * not exist create it. Either way, ceph_opts is consumed by this
> + * function.
> */
> static struct rbd_client *rbd_get_client(struct ceph_options *ceph_opts)
> {
> @@ -4994,7 +4995,6 @@ static ssize_t rbd_add(struct bus_type *bus,
> rc = PTR_ERR(rbdc);
> goto err_out_args;
> }
> - ceph_opts = NULL; /* rbd_dev client now owns this */
>
> /* pick the pool */
> osdc = &rbdc->client->osdc;
> @@ -5038,8 +5038,6 @@ err_out_rbd_dev:
> err_out_client:
> rbd_put_client(rbdc);
> err_out_args:
> - if (ceph_opts)
> - ceph_destroy_options(ceph_opts);
> kfree(rbd_opts);
> rbd_spec_put(spec);
> err_out_module:
>
prev parent reply other threads:[~2013-05-17 1:21 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-16 21:29 [PATCH] rbd: don't destroy ceph_opts in rbd_add() Alex Elder
2013-05-17 1:20 ` Josh Durgin [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=519585CB.30006@inktank.com \
--to=josh.durgin@inktank.com \
--cc=ceph-devel@vger.kernel.org \
--cc=elder@inktank.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox