All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Mason <chris.mason@oracle.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Josef Bacik <josef@redhat.com>, linux-btrfs@vger.kernel.org
Subject: Re: Btrfs: fix num_workers_starting bug and other bugs in async thread
Date: Fri, 23 Dec 2011 08:21:26 -0500	[thread overview]
Message-ID: <20111223132126.GN19266@shiny> (raw)
In-Reply-To: <20111223130603.GM19266@shiny>

On Fri, Dec 23, 2011 at 08:06:03AM -0500, Chris Mason wrote:
> On Fri, Dec 23, 2011 at 01:44:53PM +0300, Dan Carpenter wrote:
> > Hi Josef,
> > 
> > Smatch complains about this change introduces a double unlock.
> > 
> > fs/btrfs/async-thread.c +608 find_worker(49) error: double unlock 'spin_lock:&workers->lock'
> > 
> >    579                          spin_unlock_irqrestore(&workers->lock, flags);
> >                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> 
> Thanks Dan, fixing.
> >    602  found:
> >    603          /*
> >    604           * this makes sure the worker doesn't exit before it is placed
> >    605           * onto a busy/idle list
> >    606           */
> >    607          atomic_inc(&worker->num_pending);
> >    608          spin_unlock_irqrestore(&workers->lock, flags);
> >                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> > And again here.
> > 
> > Btw, does find_worker() ever get called with IRQs disabled?  If so then
> > __btrfs_start_workers() enables them.  Maybe that function should use
> > spin_lock_irqsave() instead of spin_lock_irq().
> 
> Patching this too.

Read that too quickly.  __btrfs_start_workers() can't be called with
irqs off, kthread_run schedules.

-chris


      reply	other threads:[~2011-12-23 13:21 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-23 10:44 Btrfs: fix num_workers_starting bug and other bugs in async thread Dan Carpenter
2011-12-23 13:06 ` Chris Mason
2011-12-23 13:21   ` Chris Mason [this message]

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=20111223132126.GN19266@shiny \
    --to=chris.mason@oracle.com \
    --cc=dan.carpenter@oracle.com \
    --cc=josef@redhat.com \
    --cc=linux-btrfs@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.