From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f49.google.com ([74.125.82.49]:38065 "EHLO mail-wm0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932490AbcCHPI7 (ORCPT ); Tue, 8 Mar 2016 10:08:59 -0500 Subject: Re: [PATCH-v3.14.y 4/8] target: Fix LUN_RESET active I/O handling for ACK_KREF To: "Nicholas A. Bellinger" , target-devel References: <1457232926-1761-1-git-send-email-nab@linux-iscsi.org> <1457232926-1761-5-git-send-email-nab@linux-iscsi.org> Cc: stable , Greg-KH , Himanshu Madhani , Sagi Grimberg , Christoph Hellwig , Hannes Reinecke , Andy Grover , Mike Christie From: Jiri Slaby Message-ID: <56DEEB06.8020107@suse.cz> Date: Tue, 8 Mar 2016 16:08:54 +0100 MIME-Version: 1.0 In-Reply-To: <1457232926-1761-5-git-send-email-nab@linux-iscsi.org> Content-Type: text/plain; charset=iso-8859-2 Content-Transfer-Encoding: 7bit Sender: stable-owner@vger.kernel.org List-ID: On 03/06/2016, 03:55 AM, Nicholas A. Bellinger wrote: > From: Nicholas Bellinger > > [ Upstream commit febe562c20dfa8f33bee7d419c6b517986a5aa33 ] ... > --- a/drivers/target/target_core_transport.c > +++ b/drivers/target/target_core_transport.c ... > @@ -536,10 +533,6 @@ static int transport_cmd_check_stop(struct se_cmd *cmd, bool remove_from_lists, > { > unsigned long flags; > > - spin_lock_irqsave(&cmd->t_state_lock, flags); > - if (write_pending) > - cmd->t_state = TRANSPORT_WRITE_PENDING; > - I tried to backport this to 3.12, but I think it is impossible to move the lock below. The code still has this here: if (cmd->transport_state & CMD_T_LUN_STOP) { pr_debug("%s:%d CMD_T_LUN_STOP for ITT: 0x%08x\n", __func__, __LINE__, cmd->se_tfo->get_task_tag(cmd)); cmd->transport_state &= ~CMD_T_ACTIVE; if (remove_from_lists) target_remove_from_state_list(cmd); spin_unlock_irqrestore(&cmd->t_state_lock, flags); complete(&cmd->transport_lun_stop_comp); return 1; } And it seems transport_state needs the lock, right? > if (remove_from_lists) { > target_remove_from_state_list(cmd); > > @@ -549,6 +542,10 @@ static int transport_cmd_check_stop(struct se_cmd *cmd, bool remove_from_lists, > cmd->se_lun = NULL; > } > > + spin_lock_irqsave(&cmd->t_state_lock, flags); > + if (write_pending) > + cmd->t_state = TRANSPORT_WRITE_PENDING; > + > /* > * Determine if frontend context caller is requesting the stopping of > * this command for frontend exceptions. thanks, -- js suse labs