Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753686AbbL2S1q (ORCPT ); Tue, 29 Dec 2015 13:27:46 -0500 Received: from mail-ob0-f179.google.com ([209.85.214.179]:33435 "EHLO mail-ob0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753606AbbL2S1o (ORCPT ); Tue, 29 Dec 2015 13:27:44 -0500 Subject: Re: [PATCH RESEND] csiostor:Fix locking issues in the function csio_scsim_cleanup_io_lnode To: Nicholas Krause , JBottomley@odin.com References: <1451413394-21278-1-git-send-email-xerofoify@gmail.com> Cc: martin.petersen@oracle.com, anish@chelsio.com, hare@suse.de, davem@davemloft.net, hariprasad@chelsio.com, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org From: Jens Axboe Message-ID: <5682D09E.2070700@kernel.dk> Date: Tue, 29 Dec 2015 11:27:42 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 MIME-Version: 1.0 In-Reply-To: <1451413394-21278-1-git-send-email-xerofoify@gmail.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1620 Lines: 39 On 12/29/2015 11:23 AM, Nicholas Krause wrote: > This fixes locking issues in the function csio_scsim_cleanup_io_lnode > by locking around the call to the function csio_csci_gather_active_ios > with the function pair spin_lock_irq/spin_unlock_irq as any function > calling this particular function must do in order to avoid concurrent > threads of execution on the passed structure pointer of type csio_hw > as this structure pointer can be shared across mutliple threads in the > kernel. > > Signed-off-by: Nicholas Krause > --- > drivers/scsi/csiostor/csio_scsi.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/drivers/scsi/csiostor/csio_scsi.c b/drivers/scsi/csiostor/csio_scsi.c > index 2c4562d..c318855 100644 > --- a/drivers/scsi/csiostor/csio_scsi.c > +++ b/drivers/scsi/csiostor/csio_scsi.c > @@ -1327,7 +1327,9 @@ csio_scsim_cleanup_io_lnode(struct csio_scsim *scm, struct csio_lnode *ln) > sld.level = CSIO_LEV_LNODE; > sld.lnode = ln; > INIT_LIST_HEAD(&ln->cmpl_q); > + spin_lock_irq(&hw->lock); > csio_scsi_gather_active_ios(scm, &sld, &ln->cmpl_q); > + spin_unlock_irq(&hw->lock); All the callers grab that lock, you've just added a deadlock instead. Nick, I've said this before and I'll say this again. Stop sending me patches. They are all untested and broken, you are wasting peoples time. -- Jens Axboe -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/