Re: [PATCH-v3.14.y 4/8] target: Fix LUN_RESET active I/O handling for ACK_KREF

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 03/06/2016, 03:55 AM, Nicholas A. Bellinger wrote:
> From: Nicholas Bellinger <nab@xxxxxxxxxxxxxxx>
> 
> [ 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
--
To unsubscribe from this list: send the line "unsubscribe stable" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]