From: Quinn Tran <quinn.tran@qlogic.com> To: Hannes Reinecke <hare@suse.de>, Christoph Hellwig <hch@lst.de> Cc: Giridhar Malavali <giridhar.malavali@qlogic.com>, linux-scsi <linux-scsi@vger.kernel.org>, "target-devel@vger.kernel.org" <target-devel@vger.kernel.org>, "nab@linux-iscsi.org" <nab@linux-iscsi.org>, Himanshu Madhani <himanshu.madhani@qlogic.com> Subject: Re: [PATCH 09/20] qla2xxx: Change check_stop_free to always return 1 Date: Thu, 10 Dec 2015 01:06:53 +0000 [thread overview] Message-ID: <D28DF1C6.1B1DE%quinn.tran@qlogic.com> (raw) In-Reply-To: <5667D092.1030701@suse.de> On 12/8/15, 10:56 PM, "target-devel-owner@vger.kernel.org on behalf of Hannes Reinecke" <target-devel-owner@vger.kernel.org on behalf of hare@suse.de> wrote: >On 12/08/2015 01:48 AM, Himanshu Madhani wrote: >> From: Quinn Tran <quinn.tran@qlogic.com> >> >> change tcm_qla2xxx_check_stop_free to always return 1 >> to prevent transport_cmd_finish_abort from accidently >> taking extra kref_put. >> >> Signed-off-by: Quinn Tran <quinn.tran@qlogic.com> >> Signed-off-by: Himanshu Madhani <himanshu.madhani@qlogic.com> >> --- >> drivers/scsi/qla2xxx/tcm_qla2xxx.c | 3 ++- >> 1 files changed, 2 insertions(+), 1 deletions(-) >> >> diff --git a/drivers/scsi/qla2xxx/tcm_qla2xxx.c >>b/drivers/scsi/qla2xxx/tcm_qla2xxx.c >> index 74c6e9b..366142a 100644 >> --- a/drivers/scsi/qla2xxx/tcm_qla2xxx.c >> +++ b/drivers/scsi/qla2xxx/tcm_qla2xxx.c >> @@ -314,7 +314,8 @@ static int tcm_qla2xxx_check_stop_free(struct >>se_cmd *se_cmd) >> cmd->cmd_flags |= BIT_14; >> } >> >> - return target_put_sess_cmd(se_cmd); >> + target_put_sess_cmd(se_cmd); >> + return 1; >> } >> >> /* tcm_qla2xxx_release_cmd - Callback from TCM Core to release >>underlying >> >Odd. I would have expected target_put_sess_cmd() to never fail. QT> It does not failed under normal usage. >But if it does, doesn't it mean that the command is hosed, and we should >have accessed it in the first place? >Very suspicious. QT> here are the cases I see. Note: The patch series is in reference of pre-Bart¹s fix. - cmd_kref 2 -> 1, target_put_sess_cmd return true. This is Normal case. Backend finished with the command and send it to the Front end. - cmd_kref 1 -> 0, target_put_sess_cmd return true. Case 1: Early free by TCM/TMR thread. TMR thread call 2nd check_stop. core_tmr_drain_tmr_list->transport_cmd_finish_abort-> transport_cmd_check_stop_to_fabric - cmd_kref 0 -> -1, target_put_sess_cmd return false. QLA does not call ³check_stop² in either cases below. Case 1: QLA cause double free the command as the command is coming out of HW queue. In other word QLA access stale pointer during cleanup/free. Case 2: QLA driver beat TMR thread by a few nano second by freeing the command 1st(cmd_kref=0). TMR thread call the extra check_stop(cmd_kref = -1). transport_cmd_finish_abort do additional kref_put (cmd_kref = -2). void transport_cmd_finish_abort(struct se_cmd *cmd, int remove) { if (transport_cmd_check_stop_to_fabric(cmd)) return; if (remove) transport_put_cmd(cmd); } > >Cheers, > >Hannes >-- >Dr. Hannes Reinecke zSeries & Storage >hare@suse.de +49 911 74053 688 >SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg >GF: J. Hawn, J. Guild, F. Imendörffer, HRB 16746 (AG Nürnberg) >-- >To unsubscribe from this list: send the line "unsubscribe target-devel" in >the body of a message to majordomo@vger.kernel.org >More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2015-12-10 1:06 UTC|newest] Thread overview: 51+ messages / expand[flat|nested] mbox.gz Atom feed top 2015-12-08 0:48 [PATCH 00/20] qla2xxx: Patches for target-pending branch Himanshu Madhani 2015-12-08 0:48 ` [PATCH 01/20] qla2xxx: Enable Extended Login support Himanshu Madhani 2015-12-08 15:51 ` Hannes Reinecke 2015-12-08 19:35 ` Himanshu Madhani 2015-12-08 0:48 ` [PATCH 02/20] qla2xxx: Enable Exchange offload support Himanshu Madhani 2015-12-08 15:52 ` Hannes Reinecke 2015-12-08 0:48 ` [PATCH 03/20] qla2xxx: Enable Target counters in DebugFS Himanshu Madhani 2015-12-08 15:52 ` Hannes Reinecke 2015-12-08 0:48 ` [PATCH 04/20] qla2xxx: Add FW resource count " Himanshu Madhani 2015-12-08 15:53 ` Hannes Reinecke 2015-12-08 0:48 ` [PATCH 05/20] qla2xxx: Added interface to send ELS commands from driver Himanshu Madhani 2015-12-08 2:10 ` kbuild test robot 2015-12-08 2:10 ` [PATCH] qla2xxx: fix ifnullfree.cocci warnings kbuild test robot 2015-12-08 15:54 ` [PATCH 05/20] qla2xxx: Added interface to send ELS commands from driver Hannes Reinecke 2015-12-08 0:48 ` [PATCH 06/20] qla2xxx: Delete session if initiator is gone from FW Himanshu Madhani 2015-12-08 1:41 ` kbuild test robot 2015-12-08 15:58 ` Hannes Reinecke 2015-12-08 0:48 ` [PATCH 07/20] qla2xxx: Wait for all conflicts before ack'ing PLOGI Himanshu Madhani 2015-12-08 16:00 ` Hannes Reinecke 2015-12-08 0:48 ` [PATCH 08/20] qla2xxx: Replace QLA_TGT_STATE_ABORTED with a bit Himanshu Madhani 2015-12-08 16:01 ` Hannes Reinecke 2015-12-08 0:48 ` [PATCH 09/20] qla2xxx: Change check_stop_free to always return 1 Himanshu Madhani 2015-12-08 2:33 ` Christoph Hellwig 2015-12-09 6:56 ` Hannes Reinecke 2015-12-10 1:06 ` Quinn Tran [this message] 2015-12-08 0:48 ` [PATCH 10/20] qla2xxx: Fix interaction issue between qla2xxx and Target Core Module Himanshu Madhani 2015-12-08 2:37 ` Christoph Hellwig 2015-12-09 22:07 ` Quinn Tran 2015-12-14 10:34 ` Christoph Hellwig 2015-12-14 21:59 ` Quinn Tran 2015-12-09 7:01 ` Hannes Reinecke 2015-12-09 22:41 ` Quinn Tran 2015-12-08 0:48 ` [PATCH 11/20] qla2xxx: Add TAS detection for kernel 3.15 n newer Himanshu Madhani 2015-12-08 2:48 ` Christoph Hellwig 2015-12-09 20:24 ` Quinn Tran 2015-12-14 10:37 ` Christoph Hellwig 2015-12-14 22:00 ` Quinn Tran 2015-12-09 7:02 ` Hannes Reinecke 2015-12-08 0:48 ` [PATCH 12/20] target/tmr: LUN reset cause cmd premature free Himanshu Madhani 2015-12-08 2:48 ` Christoph Hellwig 2015-12-09 20:11 ` Quinn Tran 2016-01-04 7:44 ` Bart Van Assche 2015-12-09 7:03 ` Hannes Reinecke 2015-12-08 0:49 ` [PATCH 13/20] qla2xxx: Remove dependency on hardware_lock to reduce lock contention Himanshu Madhani 2015-12-08 0:49 ` [PATCH 14/20] qla2xxx: Add irq affinity notification Himanshu Madhani 2015-12-08 0:49 ` [PATCH 15/20] qla2xxx: Add selective command queuing Himanshu Madhani 2015-12-08 0:49 ` [PATCH 16/20] qla2xxx: Move atioq to a different lock to reduce lock contention Himanshu Madhani 2015-12-08 0:49 ` [PATCH 17/20] qla2xxx: Disable ZIO at start time Himanshu Madhani 2015-12-08 0:49 ` [PATCH 18/20] qla2xxx: Set all queues to 4k Himanshu Madhani 2015-12-08 0:49 ` [PATCH 19/20] qla2xxx: Add bulk send for atio & ctio completion paths Himanshu Madhani 2015-12-08 0:49 ` [PATCH 20/20] qla2xxx: Check for online flag instead of active reset when transmitting responses Himanshu Madhani
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=D28DF1C6.1B1DE%quinn.tran@qlogic.com \ --to=quinn.tran@qlogic.com \ --cc=giridhar.malavali@qlogic.com \ --cc=hare@suse.de \ --cc=hch@lst.de \ --cc=himanshu.madhani@qlogic.com \ --cc=linux-scsi@vger.kernel.org \ --cc=nab@linux-iscsi.org \ --cc=target-devel@vger.kernel.org \ --subject='Re: [PATCH 09/20] qla2xxx: Change check_stop_free to always return 1' \ /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
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.