All of lore.kernel.org
 help / color / mirror / Atom feed
From: Juergen Gross <jgross@suse.com>
To: "Nicholas A. Bellinger" <nab@daterainc.com>,
	target-devel <target-devel@vger.kernel.org>
Cc: linux-scsi <linux-scsi@vger.kernel.org>,
	Christoph Hellwig <hch@lst.de>, Hannes Reinecke <hare@suse.de>,
	Mike Christie <mchristi@redhat.com>,
	Sagi Grimberg <sagig@mellanox.com>,
	Andy Grover <agrover@redhat.com>,
	Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
	Andrzej Pietrasiewicz <andrzej.p@samsung.com>,
	Chris Boot <bootc@bootc.net>,
	Nicholas Bellinger <nab@linux-iscsi.org>,
	David Vrabel <david.vrabel@citrix.com>
Subject: Re: [PATCH-v2 12/12] xen-scsiback: Convert to TARGET_SCF_ACK_KREF I/O krefs
Date: Tue, 26 Jan 2016 10:49:22 +0100	[thread overview]
Message-ID: <56A74122.2040902@suse.com> (raw)
In-Reply-To: <1453709466-6308-13-git-send-email-nab@daterainc.com>

On 25/01/16 09:11, Nicholas A. Bellinger wrote:
> From: Nicholas Bellinger <nab@linux-iscsi.org>
> 
> Cc: Juergen Gross <jgross@suse.com>
> Cc: Hannes Reinecke <hare@suse.de>
> Cc: David Vrabel <david.vrabel@citrix.com>
> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
> ---
>  drivers/xen/xen-scsiback.c | 53 +++++++++++++++++++++++-----------------------
>  1 file changed, 26 insertions(+), 27 deletions(-)
> 
> diff --git a/drivers/xen/xen-scsiback.c b/drivers/xen/xen-scsiback.c
> index 640fb22..a10e5f1 100644
> --- a/drivers/xen/xen-scsiback.c
> +++ b/drivers/xen/xen-scsiback.c
> @@ -381,6 +381,12 @@ static void scsiback_cmd_done(struct vscsibk_pend *pending_req)
>  	scsiback_do_resp_with_sense(sense_buffer, errors, resid, pending_req,
>  				    pending_req->rqid);
>  	scsiback_put(info);
> +	/*
> +	 * Drop the extra KREF_ACK reference taken by target_submit_cmd_map_sgls()
> +	 * ahead of scsiback_check_stop_free() ->  transport_generic_free_cmd()
> +	 * final se_cmd->cmd_kref put.
> +	 */
> +	target_put_sess_cmd(&pending_req->se_cmd);
>  }
>  
>  static void scsiback_cmd_exec(struct vscsibk_pend *pending_req)
> @@ -398,7 +404,7 @@ static void scsiback_cmd_exec(struct vscsibk_pend *pending_req)
>  	rc = target_submit_cmd_map_sgls(se_cmd, sess, pending_req->cmnd,
>  			pending_req->sense_buffer, pending_req->v2p->lun,
>  			pending_req->data_len, 0,
> -			pending_req->sc_data_direction, 0,
> +			pending_req->sc_data_direction, TARGET_SCF_ACK_KREF,
>  			pending_req->sgl, pending_req->n_sg,
>  			NULL, 0, NULL, 0);
>  	if (rc < 0) {
> @@ -587,31 +593,28 @@ static void scsiback_disconnect(struct vscsibk_info *info)
>  static void scsiback_device_action(struct vscsibk_pend *pending_req,
>  	enum tcm_tmreq_table act, int tag)
>  {
> -	int rc, err = FAILED;
>  	struct scsiback_tpg *tpg = pending_req->v2p->tpg;
> +	struct scsiback_nexus *nexus = tpg->tpg_nexus;
>  	struct se_cmd *se_cmd = &pending_req->se_cmd;
>  	struct scsiback_tmr *tmr;
> +	u64 unpacked_lun = pending_req->v2p->lun;
> +	int rc, err = FAILED;
>  
>  	tmr = kzalloc(sizeof(struct scsiback_tmr), GFP_KERNEL);
> -	if (!tmr)
> -		goto out;
> +	if (!tmr) {
> +		target_put_sess_cmd(se_cmd);
> +		goto err;

Sure? I think this should still be "goto out;"?

> +	}
>  
>  	init_waitqueue_head(&tmr->tmr_wait);
>  
> -	transport_init_se_cmd(se_cmd, tpg->se_tpg.se_tpg_tfo,
> -		tpg->tpg_nexus->tvn_se_sess, 0, DMA_NONE, TCM_SIMPLE_TAG,
> -		&pending_req->sense_buffer[0]);
> -
> -	rc = core_tmr_alloc_req(se_cmd, tmr, act, GFP_KERNEL);
> -	if (rc < 0)
> -		goto out;
> -
> -	se_cmd->se_tmr_req->ref_task_tag = tag;
> +	rc = target_submit_tmr(&pending_req->se_cmd, nexus->tvn_se_sess,
> +			       &pending_req->sense_buffer[0],
> +			       unpacked_lun, tmr, act, GFP_KERNEL,
> +			       tag, TARGET_SCF_ACK_KREF);
> +	if (rc)
> +		goto err;

Again.


Juergen

>  
> -	if (transport_lookup_tmr_lun(se_cmd, pending_req->v2p->lun) < 0)
> -		goto out;
> -
> -	transport_generic_handle_tmr(se_cmd);
>  	wait_event(tmr->tmr_wait, atomic_read(&tmr->tmr_complete));
>  
>  	err = (se_cmd->se_tmr_req->response == TMR_FUNCTION_COMPLETE) ?
> @@ -1368,16 +1371,7 @@ static u32 scsiback_tpg_get_inst_index(struct se_portal_group *se_tpg)
>  
>  static int scsiback_check_stop_free(struct se_cmd *se_cmd)
>  {
> -	/*
> -	 * Do not release struct se_cmd's containing a valid TMR pointer.
> -	 * These will be released directly in scsiback_device_action()
> -	 * with transport_generic_free_cmd().
> -	 */
> -	if (se_cmd->se_cmd_flags & SCF_SCSI_TMR_CDB)
> -		return 0;
> -
> -	transport_generic_free_cmd(se_cmd, 0);
> -	return 1;
> +	return transport_generic_free_cmd(se_cmd, 0);
>  }
>  
>  static void scsiback_release_cmd(struct se_cmd *se_cmd)
> @@ -1385,6 +1379,11 @@ static void scsiback_release_cmd(struct se_cmd *se_cmd)
>  	struct se_session *se_sess = se_cmd->se_sess;
>  	struct se_tmr_req *se_tmr = se_cmd->se_tmr_req;
>  
> +	if (se_tmr && se_cmd->se_cmd_flags & SCF_SCSI_TMR_CDB) {
> +		struct scsiback_tmr *tmr = se_tmr->fabric_tmr_ptr;
> +		kfree(tmr);
> +	}
> +
>  	percpu_ida_free(&se_sess->sess_tag_pool, se_cmd->map_tag);
>  }
>  
> 

  reply	other threads:[~2016-01-26  9:49 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-25  8:10 [PATCH-v2 00/12] target: target_alloc_session w/ percpu_ida+ACK_KREF conversion Nicholas A. Bellinger
2016-01-25  8:10 ` [PATCH-v2 01/12] target: Add target_alloc_session() helper function Nicholas A. Bellinger
2016-01-25  8:10 ` [PATCH-v2 02/12] target: Convert demo-mode only drivers to target_alloc_session Nicholas A. Bellinger
2016-01-26  9:45   ` Juergen Gross
2016-01-25  8:10 ` [PATCH-v2 03/12] vhost/scsi: Convert to target_alloc_session usage Nicholas A. Bellinger
2016-01-25  8:10 ` [PATCH-v2 04/12] tcm_qla2xxx: " Nicholas A. Bellinger
2016-01-25  8:10 ` [PATCH-v2 05/12] tcm_fc: " Nicholas A. Bellinger
2016-01-25  8:11 ` [PATCH-v2 06/12] ib_srpt: " Nicholas A. Bellinger
2016-01-25  8:11 ` [PATCH-v2 07/12] sbp-target: Conversion to percpu_ida tag pre-allocation Nicholas A. Bellinger
2016-01-25  8:11 ` [PATCH-v2 08/12] sbp-target: Convert to TARGET_SCF_ACK_KREF I/O krefs Nicholas A. Bellinger
2016-01-25  8:11 ` [PATCH-v2 09/12] usb-gadget/tcm: Conversion to percpu_ida tag pre-allocation Nicholas A. Bellinger
2016-01-25  8:11 ` [PATCH-v2 10/12] usb-gadget/tcm: Convert to TARGET_SCF_ACK_KREF I/O krefs Nicholas A. Bellinger
2016-01-25  8:11 ` [PATCH-v2 11/12] xen-scsiback: Convert to percpu_ida tag allocation Nicholas A. Bellinger
2016-01-25 15:42   ` Juergen Gross
2016-01-26  5:15     ` Nicholas A. Bellinger
2016-01-26  9:45   ` Juergen Gross
2016-01-27  6:28     ` Nicholas A. Bellinger
2016-01-27 10:57       ` Juergen Gross
2016-01-28  5:13         ` Nicholas A. Bellinger
2016-01-25  8:11 ` [PATCH-v2 12/12] xen-scsiback: Convert to TARGET_SCF_ACK_KREF I/O krefs Nicholas A. Bellinger
2016-01-26  9:49   ` Juergen Gross [this message]
2016-01-27  6:29     ` Nicholas A. Bellinger

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=56A74122.2040902@suse.com \
    --to=jgross@suse.com \
    --cc=agrover@redhat.com \
    --cc=andrzej.p@samsung.com \
    --cc=bigeasy@linutronix.de \
    --cc=bootc@bootc.net \
    --cc=david.vrabel@citrix.com \
    --cc=hare@suse.de \
    --cc=hch@lst.de \
    --cc=linux-scsi@vger.kernel.org \
    --cc=mchristi@redhat.com \
    --cc=nab@daterainc.com \
    --cc=nab@linux-iscsi.org \
    --cc=sagig@mellanox.com \
    --cc=target-devel@vger.kernel.org \
    /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.