linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Al Viro <viro@ZenIV.linux.org.uk>
To: Jan Kara <jack@suse.cz>
Cc: linux-fsdevel@vger.kernel.org, Dave Chinner <dchinner@redhat.com>
Subject: Re: [PATCH RESEND] vfs: Fix missed wakeup in I_NEW handling
Date: Thu, 8 Mar 2012 03:19:16 +0000	[thread overview]
Message-ID: <20120308031916.GU23916@ZenIV.linux.org.uk> (raw)
In-Reply-To: <1331139940-32534-1-git-send-email-jack@suse.cz>

On Wed, Mar 07, 2012 at 06:05:40PM +0100, Jan Kara wrote:
> Commit 250df6ed removed wake_up_inode() (in particular a memory barrier before
> wake_up_bit()) on the basis that i_state transitions are protected by i_lock.
> That would be fine if all the readers of i_state were using i_lock as well. But
> wait_on_inode() doesn't use i_lock and thus the following can happen due to
> reordering:
> 
>    CPU 1				CPU 2
> unlock_new_inode()
>   spin_lock(&inode->i_lock);
>   wake_up_bit(&inode->i_state, __I_NEW);
> 					wait_on_inode()
> 					  wait_on_bit(&inode->i_state, __I_NEW);
>   inode->i_state &= ~I_NEW;
>   ^^^ this store was reordered
>   spin_unlock(&inode->i_lock);
> 
> And waiter on CPU2 sleeps forever (or for a really long time).
> 
> We fix the issue by using i_lock in wait_on_inode() in the spirit of commit
> 250df6ed.

Applied (along with a bunch of other stuff; will push to Linus tomorrow)

      reply	other threads:[~2012-03-08  3:19 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-07 17:05 [PATCH RESEND] vfs: Fix missed wakeup in I_NEW handling Jan Kara
2012-03-08  3:19 ` Al Viro [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=20120308031916.GU23916@ZenIV.linux.org.uk \
    --to=viro@zeniv.linux.org.uk \
    --cc=dchinner@redhat.com \
    --cc=jack@suse.cz \
    --cc=linux-fsdevel@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;
as well as URLs for NNTP newsgroup(s).