From: "Jan Beulich" Subject: Re: [PATCH Linux-2.6.18] scsifront: avoid aquiring same lock twice if ring is full Date: Wed, 14 Jan 2015 09:40:39 +0000 Message-ID: <54B647A70200007800054A87@mail.emea.novell.com> References: <1421166178-626-1-git-send-email-jgross@suse.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1421166178-626-1-git-send-email-jgross@suse.com> Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Juergen Gross Cc: xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org >>> On 13.01.15 at 17:22, <"jgross@suse.com".non-mime.internet> wrote: > The locking in scsifront_dev_reset_handler() is obviously wrong. In > case of a full ring the host lock is aquired twice. > > Fixing this issue enables to get rid of the endless fo loop with an > explicit break statement. Perhaps worth noting that it was my c/s 1209:4d1471ca031e that screwed this up. Jan > Signed-off-by: Juergen Gross > --- > > diff -r 078f1bb69ea5 drivers/xen/scsifront/scsifront.c > --- a/drivers/xen/scsifront/scsifront.c Wed Dec 10 10:22:39 2014 +0100 > +++ b/drivers/xen/scsifront/scsifront.c Tue Jan 13 14:32:33 2015 +0100 > @@ -447,12 +447,10 @@ static int scsifront_dev_reset_handler(s > uint16_t rqid; > int err = 0; > > - for (;;) { > #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,12) > - spin_lock_irq(host->host_lock); > + spin_lock_irq(host->host_lock); > #endif > - if (!RING_FULL(&info->ring)) > - break; > + while (RING_FULL(&info->ring)) { > if (err) { > #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,12) > spin_unlock_irq(host->host_lock);