All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alex Elder <elder@ieee.org>
To: Ilya Dryomov <ilya.dryomov@inktank.com>, ceph-devel@vger.kernel.org
Subject: Re: [PATCH 11/14] rbd: add rbd_obj_watch_request_helper() helper
Date: Mon, 07 Jul 2014 17:36:28 -0500	[thread overview]
Message-ID: <53BB20EC.2090403@ieee.org> (raw)
In-Reply-To: <1403716607-13535-12-git-send-email-ilya.dryomov@inktank.com>

On 06/25/2014 12:16 PM, Ilya Dryomov wrote:
> In the past, rbd_dev_header_watch_sync() used to handle both watch and
> unwatch requests and was entangled and leaky.  Commit b30a01f2a307
> ("rbd: fix osd_request memory leak in __rbd_dev_header_watch_sync()")
> split it into two separate functions.  This commit cleanly abstracts
> the common bits, relying on the fixed rbd_obj_request_wait().

Adding this without calling it leads to an unused function
warning in the build, I'm sure.

You could probably squash this into the next patch.

Reviewed-by: Alex Elder <elder@linaro.org>

> Signed-off-by: Ilya Dryomov <ilya.dryomov@inktank.com>
> ---
>  drivers/block/rbd.c |   53 +++++++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 53 insertions(+)
> 
> diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
> index 20147aec86f3..02cf7aba7679 100644
> --- a/drivers/block/rbd.c
> +++ b/drivers/block/rbd.c
> @@ -2971,6 +2971,59 @@ static void rbd_watch_cb(u64 ver, u64 notify_id, u8 opcode, void *data)
>  }
>  
>  /*
> + * Send a (un)watch request and wait for the ack.  Return a request
> + * with a ref held on success or error.
> + */
> +static struct rbd_obj_request *rbd_obj_watch_request_helper(
> +						struct rbd_device *rbd_dev,
> +						bool watch)
> +{
> +	struct ceph_osd_client *osdc = &rbd_dev->rbd_client->client->osdc;
> +	struct rbd_obj_request *obj_request;
> +	int ret;
> +
> +	obj_request = rbd_obj_request_create(rbd_dev->header_name, 0, 0,
> +					     OBJ_REQUEST_NODATA);
> +	if (!obj_request)
> +		return ERR_PTR(-ENOMEM);
> +
> +	obj_request->osd_req = rbd_osd_req_create(rbd_dev, true, 1,
> +						  obj_request);
> +	if (!obj_request->osd_req) {
> +		ret = -ENOMEM;
> +		goto out;
> +	}
> +
> +	osd_req_op_watch_init(obj_request->osd_req, 0, CEPH_OSD_OP_WATCH,
> +			      rbd_dev->watch_event->cookie, 0, watch);
> +	rbd_osd_req_format_write(obj_request);
> +
> +	if (watch)
> +		ceph_osdc_set_request_linger(osdc, obj_request->osd_req);
> +
> +	ret = rbd_obj_request_submit(osdc, obj_request);
> +	if (ret)
> +		goto out;
> +
> +	ret = rbd_obj_request_wait(obj_request);
> +	if (ret)
> +		goto out;
> +
> +	ret = obj_request->result;
> +	if (ret) {
> +		if (watch)
> +			rbd_obj_request_end(obj_request);
> +		goto out;
> +	}
> +
> +	return obj_request;
> +
> +out:
> +	rbd_obj_request_put(obj_request);
> +	return ERR_PTR(ret);
> +}
> +
> +/*
>   * Initiate a watch request, synchronously.
>   */
>  static int rbd_dev_header_watch_sync(struct rbd_device *rbd_dev)
> 


  reply	other threads:[~2014-07-07 22:36 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-25 17:16 [PATCH 00/14] rbd: #6628 fixes (wip-remove-osd-6628) Ilya Dryomov
2014-06-25 17:16 ` [PATCH 01/14] libceph: rename ceph_osd_request::r_linger_osd to r_linger_osd_item Ilya Dryomov
2014-06-30 12:16   ` Alex Elder
2014-06-25 17:16 ` [PATCH 02/14] libceph: add maybe_move_osd_to_lru() and switch to it Ilya Dryomov
2014-06-30 12:17   ` Alex Elder
2014-06-25 17:16 ` [PATCH 03/14] libceph: move and add dout()s to ceph_msg_{get,put}() Ilya Dryomov
2014-06-30 12:29   ` Alex Elder
2014-07-08 11:12     ` Ilya Dryomov
2014-06-25 17:16 ` [PATCH 04/14] libceph: move and add dout()s to ceph_osdc_request_{get,put}() Ilya Dryomov
2014-06-30 12:32   ` Alex Elder
2014-06-25 17:16 ` [PATCH 05/14] libceph: harden ceph_osdc_request_release() a bit Ilya Dryomov
2014-06-30 12:36   ` Alex Elder
2014-06-25 17:16 ` [PATCH 06/14] libceph: assert both regular and lingering lists in __remove_osd() Ilya Dryomov
2014-06-30 12:37   ` Alex Elder
2014-06-25 17:16 ` [PATCH 07/14] libceph: unregister only registered linger requests Ilya Dryomov
2014-06-30 13:05   ` Alex Elder
2014-06-30 13:50   ` Alex Elder
2014-06-30 14:21     ` Ilya Dryomov
2014-06-25 17:16 ` [PATCH 08/14] libceph: fix linger request check in __unregister_request() Ilya Dryomov
2014-06-30 13:07   ` Alex Elder
2014-06-25 17:16 ` [PATCH 09/14] libceph: introduce ceph_osdc_cancel_request() Ilya Dryomov
2014-06-30 13:39   ` Alex Elder
2014-06-30 14:34     ` Ilya Dryomov
2014-07-07 13:47       ` Alex Elder
2014-07-08 11:15         ` Ilya Dryomov
2014-07-08 12:58           ` Alex Elder
2014-06-25 17:16 ` [PATCH 10/14] rbd: rbd_obj_request_wait() should cancel the request if interrupted Ilya Dryomov
2014-07-07 16:55   ` Alex Elder
2014-07-08 11:18     ` Ilya Dryomov
2014-07-08 12:17       ` Alex Elder
2014-06-25 17:16 ` [PATCH 11/14] rbd: add rbd_obj_watch_request_helper() helper Ilya Dryomov
2014-07-07 22:36   ` Alex Elder [this message]
2014-07-08 11:18     ` Ilya Dryomov
2014-06-25 17:16 ` [PATCH 12/14] rbd: use " Ilya Dryomov
2014-07-07 22:36   ` Alex Elder
2014-06-25 17:16 ` [PATCH 13/14] libceph: nuke ceph_osdc_unregister_linger_request() Ilya Dryomov
2014-07-07 22:36   ` Alex Elder
2014-06-25 17:16 ` [PATCH 14/14] libceph: drop osd ref when canceling con work Ilya Dryomov
2014-07-07 22:38   ` Alex Elder
2014-07-08 11:22     ` Ilya Dryomov

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=53BB20EC.2090403@ieee.org \
    --to=elder@ieee.org \
    --cc=ceph-devel@vger.kernel.org \
    --cc=ilya.dryomov@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.