public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: James Bottomley <James.Bottomley@SteelEye.com>
To: Jens Axboe <jens.axboe@oracle.com>
Cc: linux-scsi <linux-scsi@vger.kernel.org>
Subject: Re: [PATCH] libsas: fix lockdep issue with ATA
Date: Tue, 17 Jul 2007 09:12:50 -0500	[thread overview]
Message-ID: <1184681570.3378.5.camel@localhost.localdomain> (raw)
In-Reply-To: <20070717112955.GR5195@kernel.dk>

On Tue, 2007-07-17 at 13:29 +0200, Jens Axboe wrote:
> On Mon, Jul 16 2007, James Bottomley wrote:
> > lockdep noticed that with ATA support the port->dev_list_lock was
> > entangled at irq context, so it now needs to become IRQ safe
> > 
> > ---
> > This applies against the aic94xx-sas-2.6 tree
> > 
> > James
> > 
> > diff --git a/drivers/scsi/libsas/sas_discover.c b/drivers/scsi/libsas/sas_discover.c
> > index a18c0f6..ce3385c 100644
> > --- a/drivers/scsi/libsas/sas_discover.c
> > +++ b/drivers/scsi/libsas/sas_discover.c
> > @@ -292,9 +292,9 @@ static int sas_get_port_device(struct asd_sas_port *port)
> >  	port->disc.max_level = 0;
> >  
> >  	dev->rphy = rphy;
> > -	spin_lock(&port->dev_list_lock);
> > +	spin_lock_irqsave(&port->dev_list_lock, flags);
> >  	list_add_tail(&dev->dev_list_node, &port->dev_list);
> > -	spin_unlock(&port->dev_list_lock);
> > +	spin_unlock_irqrestore(&port->dev_list_lock, flags);
> >  
> >  	return 0;
> >  }
> 
> already uses GFP_KERNEL, so spin_lock_irq() suffices.
> 
> > @@ -688,12 +688,14 @@ static void sas_discover_domain(struct work_struct *work)
> >  	}
> >  
> >  	if (error) {
> > +		unsigned long flags;
> > +
> >  		sas_rphy_free(dev->rphy);
> >  		dev->rphy = NULL;
> >  
> > -		spin_lock(&port->dev_list_lock);
> > +		spin_lock_irqsave(&port->dev_list_lock, flags);
> >  		list_del_init(&dev->dev_list_node);
> > -		spin_unlock(&port->dev_list_lock);
> > +		spin_unlock_irqrestore(&port->dev_list_lock, flags);
> >  
> >  		kfree(dev); /* not kobject_register-ed yet */
> >  		port->port_dev = NULL;
> 
> process context, no need to save flags here either.

OK, you caught me ... I was just doing the fastest thing I could to get
lockdep to shut up.  By the way, it dumps about 120KB of logs so it's
fun to get an actual trace of this...

I'll make the fixes and resubmit

James



  reply	other threads:[~2007-07-17 14:12 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-16 18:15 [PATCH] libsas: fix lockdep issue with ATA James Bottomley
2007-07-17 11:29 ` Jens Axboe
2007-07-17 14:12   ` James Bottomley [this message]
2007-07-17 16:35     ` James Bottomley
2007-07-18  8:10       ` Jens Axboe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1184681570.3378.5.camel@localhost.localdomain \
    --to=james.bottomley@steeleye.com \
    --cc=jens.axboe@oracle.com \
    --cc=linux-scsi@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox