linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Omar Sandoval <osandov@osandov.com>
To: Ivan Delalande <colona@arista.com>,
	"Eric W. Biederman" <ebiederm@xmission.com>,
	Al Viro <viro@zeniv.linux.org.uk>
Cc: linux-fsdevel@vger.kernel.org
Subject: Re: Warning: empty root dentry name after lazy mount removal
Date: Wed, 20 May 2015 03:05:57 -0700	[thread overview]
Message-ID: <20150520100557.GB32189@mew> (raw)
In-Reply-To: <20150515185820.GQ20468@ycc.fr>

[-- Attachment #1: Type: text/plain, Size: 1673 bytes --]

On Fri, May 15, 2015 at 08:58:20PM +0200, Ivan Delalande wrote:
> Hi,
> 
> Since commit 8ed936b "vfs: Lazily remove mounts on unlinked files and
> directories.", I’m seeing a new warning from prepend_path() at
> fs/dcache.c:2937 saying:
> 
> 	Root dentry has weird name <>
> 
> Our particular occurrence happens because we are using an older version
> of iproute (< v3.10, commit bcb9d40, but this also works with the master
> and just reverting that commit), and the following scenario:
> 
> 	term1# ip netns add foo
> 	term1# ip netns exec foo sh
> 	term1# ls -l /proc/self/fd/4
> 	lr-x------ 1 root root 64 May 15 11:02 /proc/self/fd/4 -> /var/run/netns/foo
> 	term2# ip netns del foo
> 	term1# ls -l /proc/self/fd/4
> 	[dmesg] WARNING: [...]
> 	[dmesg] Root dentry has weird name <>
> 	lr-x------ 1 root root 64 May 15 11:04 /proc/self/fd/4 -> /
> 
> Relevant moutinfo chunks before the `ip netns del`:
> 
> 	29 0 8:2 / / rw,relatime - ext4 /dev/sda2 rw,data=ordered
> 	82 29 0:3 / /var/run/netns/foo rw,nosuid,nodev,noexec,relatime - proc proc rw
> 
> What I could observe is that after the namespace deletion, that mount 82
> get isolated (mnt->parent = mnt), and so prepend_path considers it as
> the global root. But the name of that dentry has d_name.len == 0, which
> triggers the WARN in that function.
> 
> I’m still struggling to understand all the relations between the VFS
> structures and at which point they get initialized precisely. Do you
> have any idea how to fix this problem?
> 

I'm attaching a minimal script that reproduces this on 4.1-rc4. I'm
taking a look, but Eric or Al will probably figure this out before I get
the chance :)

-- 
Omar

[-- Attachment #2: repro.sh --]
[-- Type: text/plain, Size: 433 bytes --]

#!/bin/sh

set -e

MNT=testmnt

# Create a new namespace and bind-mount it to keep it alive.
(
touch "$MNT"
unshare --net mount --bind /proc/self/ns/net "$MNT"
)

rm -f barrier && mkfifo barrier

# Hold a reference while the namespace gets unmounted.
(
exec 4<"$MNT"
ls -l /proc/self/fd
cat < barrier
ls -l /proc/self/fd
) &

# Unmount the namespace while there's still a reference.
cat /dev/null > barrier
umount --lazy "$MNT"
wait

  reply	other threads:[~2015-05-20 10:05 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-15 18:58 Warning: empty root dentry name after lazy mount removal Ivan Delalande
2015-05-20 10:05 ` Omar Sandoval [this message]
2015-05-20 22:05   ` [PATCH] vfs: Fix, simpliy and stop using d_dname for the /proc/*/ns/* files Eric W. Biederman
2015-05-20 23:00     ` Omar Sandoval
2015-05-20 23:08     ` Ivan Delalande
2015-05-20 23:23     ` Al Viro
2015-06-03 20:51       ` Ivan Delalande
2015-06-06 19:27         ` Eric W. Biederman
2015-06-06 19:30           ` [PATCH] vfs: Remove incorrect debugging WARN in prepend_path Eric W. Biederman
2015-06-06 20:08           ` [PATCH] vfs: Fix, simpliy and stop using d_dname for the /proc/*/ns/* files Ivan Delalande

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=20150520100557.GB32189@mew \
    --to=osandov@osandov.com \
    --cc=colona@arista.com \
    --cc=ebiederm@xmission.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /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).