public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: ebiederm@xmission.com (Eric W. Biederman)
To: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Cc: al viro <viro@zeniv.linux.org.uk>,
	linux-fsdevel@vger.kernel.org,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] Revert "__d_unalias() should refuse to move mountpoints"
Date: Tue, 25 Sep 2012 03:42:50 -0700	[thread overview]
Message-ID: <87ipb2pemt.fsf@xmission.com> (raw)
In-Reply-To: <506173A6.2050705@canonical.com> (Maarten Lankhorst's message of "Tue, 25 Sep 2012 11:04:38 +0200")

Maarten Lankhorst <maarten.lankhorst@canonical.com> writes:

> Hey,
>
> Op 25-09-12 09:05, Eric W. Biederman schreef:
>> Maarten Lankhorst <maarten.lankhorst@canonical.com> wrote:
>>
>>> Hey,
>>>
>>> Op 25-09-12 05:39, Eric W. Biederman schreef:
>>>> Maarten Lankhorst <maarten.lankhorst@canonical.com> writes:
>>>>
>>>>> This reverts commit ee3efa91e240f513898050ef305a49a653c8ed90.
>>>>>
>>>>> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
>>>>>
>>>>> My thread about the regression seemed to have been ignored, so I can
>>> only
>>>>> conclude nobody objects against a full revert of this patch.
>>>>>
>>>>> My testcase is simply booting through netboot with / and ~/nfs as
>>> separate
>>>>> nfs filesystems, then doing 'ls ~/nfs' followed by 'ls ~' in a
>>> gnome-terminal
>>>>> window, then I get:
>>>> Do I read your description correctly:  Without using a bind mount you
>>>> have the same nfs filesystem mounted on / and on ~/nfs?
>>>>
>>>> Something is definitely off with your configuration but if to work
>>> you
>>>> need to move mount points around then that something seems much
>>> deeper
>>>> than the __d_unalias change.
>>>>
>>>> What filesystems do you have mounted where?
>>>>
>>> / is a nfs filesystem, ~/nfs is a different nfs filesystem.
>> Are both filesystems on the same server?
>>
>> Are the two filesystems distinct filesystem on the server?
>>
>> Unless there is duplication of something somewhere the d_unalias code should not trigger.
>
> They're both on the same physical filesystem on the server, but unique exports:
> /home/mlankhorst/nfs *(no_subtree_check,insecure,rw,all_squash,anonuid=1000,anongid=1000)
> /home/mlankhorst/kvm/quantal-amd64 *(no_subtree_check,insecure,rw,no_root_squash)

Modern NFS does some interesting things with disconnected roots and the
like.  I don't think it should be connecting those two filesytems
together because there are no overlapping directories.

I really don't get why using one filesystem causes confusion in the other.

> Rootfs is mounted by the kernel itself, I used a custom init script to mount /lib/modules
> early on:
>
> mount -t nfs -o nolock,vers=3 192.168.1.128:/home/mlankhorst/nfs /home/mlankhorst/nfs &&
> mkdir -p /lib/modules/$(uname -r)/kernel &&
> mount --bind /home/mlankhorst/nfs/linux /lib/modules/$(uname -r)/kernel &&
> ([ -f /lib/modules/$(uname -r)/modules.symbols ] || depmod)
>
> exec /sbin/init

Could you try the following patch?  This should report what directories
cannot be renamed because one of them is a mount point and it gives some
real insight into what is going on.

Eric


diff --git a/fs/dcache.c b/fs/dcache.c
index 8086636..193b7be 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -2374,6 +2374,7 @@ struct dentry *d_ancestor(struct dentry *p1, struct dentry *p2)
 	return NULL;
 }
 
+static char *__dentry_path(struct dentry *dentry, char *buf, int buflen);
 /*
  * This helper attempts to cope with remotely renamed directories
  *
@@ -2401,6 +2402,18 @@ static struct dentry *__d_unalias(struct inode *inode,
 		goto out_err;
 	m2 = &alias->d_parent->d_inode->i_mutex;
 out_unalias:
+#if 1
+	if (d_mountpoint(alias)) {
+		static char buf1[8192];
+		static char buf2[8192];
+		char *alias_name, *dentry_name;
+		alias_name = __dentry_path(alias, buf1, sizeof(buf1));
+		dentry_name = __dentry_path(dentry, buf2, sizeof(buf2));
+
+		printk(KERN_DEBUG "%s: %s -> %s\n",
+		       __func__, alias_name, dentry_name);
+	}
+#endif
 	if (likely(!d_mountpoint(alias))) {
 		__d_move(alias, dentry);
 		ret = alias;

  reply	other threads:[~2012-09-25 10:43 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-24 17:45 [PATCH] Revert "__d_unalias() should refuse to move mountpoints" Maarten Lankhorst
2012-09-25  3:39 ` Eric W. Biederman
2012-09-25  6:42   ` Maarten Lankhorst
2012-09-25  7:05     ` Eric W. Biederman
2012-09-25  9:04       ` Maarten Lankhorst
2012-09-25 10:42         ` Eric W. Biederman [this message]
2012-09-25 11:03           ` Maarten Lankhorst
2012-09-25 11:29             ` Eric W. Biederman
2012-09-25 11:59               ` Maarten Lankhorst
2012-10-12 13:25               ` Maarten Lankhorst
2012-11-29 20:06               ` Al Viro
2012-11-29 20:53                 ` Al Viro
2012-11-29 21:30                   ` Al Viro
2012-11-29 22:09                     ` Al Viro
2012-12-04 10:33                 ` Maarten Lankhorst
2012-12-04 10:37                   ` Maarten Lankhorst

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=87ipb2pemt.fsf@xmission.com \
    --to=ebiederm@xmission.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maarten.lankhorst@canonical.com \
    --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