Re: [PATCH] bsg: fix the deadlock on discarding done commands

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

 



On Sun, Jun 03 2007, FUJITA Tomonori wrote:
> The previous commit to fix a blocking read bug put a bug that leads a
> deadlock on discarding done commands. We don't need bsg_device's lock
> there.
> 
> Signed-off-by: FUJITA Tomonori <fujita.tomonori@xxxxxxxxxxxxx>
> ---
>  block/bsg.c |    5 +----
>  1 files changed, 1 insertions(+), 4 deletions(-)
> 
> diff --git a/block/bsg.c b/block/bsg.c
> index 2f78d7d..9b5f6d7 100644
> --- a/block/bsg.c
> +++ b/block/bsg.c
> @@ -466,11 +466,8 @@ static int bsg_complete_all_commands(str
>  	 */
>  	ret = 0;
>  	do {
> -		spin_lock_irq(&bd->lock);
> -		if (!bd->queued_cmds) {
> -			spin_unlock_irq(&bd->lock);
> +		if (!bd->queued_cmds)
>  			break;
> -		}
>  
>  		bc = bsg_get_done_cmd(bd);
>  		if (IS_ERR(bc))

int read should be atomic, but it probably still needs serialization.
I'd be more comfortable with just adding the appropriate
spin_unlock_irq() before bsg_get_done_cmd(). It's not a fast path
anyway, just for device going away.

-- 
Jens Axboe

-
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux