linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Al Viro <viro@ZenIV.linux.org.uk>
To: Dave Chinner <david@fromorbit.com>
Cc: linux-fsdevel@vger.kernel.org, xfs@oss.sgi.com
Subject: Re: [BUG, 3.17-rc4] dentry still in use during unmount
Date: Tue, 16 Sep 2014 23:30:44 +0100	[thread overview]
Message-ID: <20140916223043.GY7996@ZenIV.linux.org.uk> (raw)
In-Reply-To: <20140916215336.GL4322@dastard>

On Wed, Sep 17, 2014 at 07:53:36AM +1000, Dave Chinner wrote:
> Hi Al,
> 
> One of my xfstest rigs tripped over this last night when running
> xfs/301 on a pair of 4G ramdisks during an auto group run:
> 
> BUG: Dentry ffff8803c14fc870{i=0,n=dir}  still in use (-127) [unmount of xfs ram1]

Umm... -127 == "already got past the beginning of __dentry_kill()".  And if
it had been seen by d_walk() callback, it must have gotten past the point where
__dentry_kill() unlocks that sucker.

Very interesting...  I don't see how that could happen, TBH - __dentry_kill()
is called with parent and victim locked; it sets DCACHE_DENTRY_KILLED and
removes the victim from parent's ->d_subdirs before dropping either lock.
Moreover, the victim can't have any children at that point - it must have
had the last reference held by called of __dentry_kill() and each child
would've contributed to refcount.

And d_walk() goes through the list of children with parent kept locked.
It does unlock the parent after walking one level deeper, but on the
way back it
	* checks that there had been no renames
	* checks that child isn't marked with DCACHE_DENTRY_KILLED
after relocking the parent.  In case of anything fishy it restarts the
whole thing with renames excluded.  If those tests succeed, we are guaranteed
that we'll continue walking the parent's list of children with parent locked,
AFAICS, not that there could legitimately be anything playing with the
dentry tree modifications in parallel with fs shutdown...

It might be interesting to slap WARN_ON(dentry->d_flags & DCACHE_DENTRY_KILLED)
for dentry and target in __d_move() and for anon in __d_materialise_dentry(),
after dentry_lock_for_move() in both functions.  And see if it triggers.
IOW, whether it's possible for doomed dentry to be readded to someone's
->d_subdirs after it has entered __dentry_kill().

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

  reply	other threads:[~2014-09-16 22:30 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-16 21:53 [BUG, 3.17-rc4] dentry still in use during unmount Dave Chinner
2014-09-16 22:30 ` Al Viro [this message]
2014-09-16 22:40   ` Dave Chinner

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=20140916223043.GY7996@ZenIV.linux.org.uk \
    --to=viro@zeniv.linux.org.uk \
    --cc=david@fromorbit.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=xfs@oss.sgi.com \
    /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).