linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Paris <eparis@redhat.com>
To: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Cc: John McCutchan <john@johnmccutchan.com>,
	Robert Love <rlove@rlove.org>,
	linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org
Subject: Re: Race inotify_rm_watch vs umount
Date: Fri, 10 Jun 2011 09:46:05 -0400	[thread overview]
Message-ID: <1307713566.2577.20.camel@localhost.localdomain> (raw)
In-Reply-To: <87r572nd9k.fsf@devron.myhome.or.jp>

On Fri, 2011-06-10 at 20:20 +0900, OGAWA Hirofumi wrote:
> Hi,
> 
> I'm looking the race inotify_rm_watch() vs umount(). This race become the
> cause of Oops. You can see the oops at
> 
> https://bugzilla.kernel.org/show_bug.cgi?id=22602
> 
> So, what race?

Ok, I see what you are saying, I'll see what I can do.  I'm a little
scared to call something like iput() under a lock though.  I might be
able to make the bigest lock a mutex and fix this....

I'll add this to my test suite.

-Eric
> 
> umount                               inotify_rm_watch
>   ...                                  fsnotify_destroy_mark()
>                                          fsnotify_destroy_inode_mark()
>                                            /* removed from i_fsnotify_marks */
>     generic_shutdown_super()
>       fsnotify_unmount_inodes()
>         put_super()
>                                            iput()
>                                              iput_final()
>                                                /* this is after put_super() */
> 
> Like above, inotify doesn't guarantee to call final iput() before
> put_super(). With this violation, FS driver can oops.
> 
> Well, so, what are requested for inotify?  We can't simply take
> sb->s_umount in inotify_rm_watch()?
> 
> Any ideas?
> 
> Thanks.

  reply	other threads:[~2011-06-10 13:46 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-10 11:20 Race inotify_rm_watch vs umount OGAWA Hirofumi
2011-06-10 13:46 ` Eric Paris [this message]
2011-06-10 14:35   ` Al Viro
     [not found]     ` <CAGHUO11rNGU9VMAPQNdXtpQeAixFX6zxJc-tWur1McqbpYpYpQ@mail.gmail.com>
2012-03-06 21:09       ` Joseph Salisbury

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=1307713566.2577.20.camel@localhost.localdomain \
    --to=eparis@redhat.com \
    --cc=hirofumi@mail.parknet.co.jp \
    --cc=john@johnmccutchan.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rlove@rlove.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).