netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: ebiederm@xmission.com (Eric W. Biederman)
To: Pavel Emelyanov <xemul@openvz.org>
Cc: "Rafael J. Wysocki" <rjw@sisk.pl>, Pavel Machek <pavel@ucw.cz>,
	kernel list <linux-kernel@vger.kernel.org>,
	netdev <netdev@vger.kernel.org>
Subject: Re: 2.6.24-rc3: find complains about /proc/net
Date: Tue, 20 Nov 2007 14:52:04 -0700	[thread overview]
Message-ID: <m11wakshyz.fsf@ebiederm.dsl.xmission.com> (raw)
In-Reply-To: <4743026B.2020907@openvz.org> (Pavel Emelyanov's message of "Tue, 20 Nov 2007 18:51:07 +0300")

Pavel Emelyanov <xemul@openvz.org> writes:

> Rafael J. Wysocki wrote:
>> On Monday, 19 of November 2007, Pavel Machek wrote:
>>> Hi!
>>>
>>> I think that this worked before:
>>>
>>> root@amd:/proc# find . -name "timer_info"
>>> find: WARNING: Hard link count is wrong for ./net: this may be a bug
>>> in your filesystem driver.  Automatically turning on find's -noleaf
>>> option.  Earlier results may have failed to include directories that
>>> should have been searched.
>>> root@amd:/proc#
>> 
>> I'm seeing that too.
>
> I have a better things with 2.6.24-rc3 ;)
>
> # cd /proc/net
> # ls ..
> ls: reading directory ..: Not a directory

Ok.  That part is truly a bug.
Looks like you have tracked down the cause.
Grumble you are getting the wrong .. :(

> and this
>
> # cd /proc
> # find
> ...
> ./net
> find: . changed during execution of find
> # find net
> find: net changed during execution of find
> # find net/
> <this works ok however>
>
> Moreover. Program that opens /proc/net and dumps the /proc/self/fd
> files produces the following:
>
> # cd /
> # a.out /proc/net
> ...
> lr-x------  1 root root 64 Nov 20 18:02 3 -> /proc/net/net (deleted)
> ...
> # cd /proc/net
> # a.out .
> ...
> lr-x------  1 root root 64 Nov 20 18:03 3 -> /proc/net/net (deleted)
> ...

> # a.out ..
> ...
> lr-x------  1 root root 64 Nov 20 18:03 3 -> /proc/net
> ...

Yes all of those are nasty.  So much for my clever way of implementing
these things.  Grr. Simple hacks that almost work!

> This all is somehow related to the shadow proc files.
> E.g. the first problem (with -ENOTDIR) is due to the shadow /proc/net
> dentry doesn't implement the .readdir method:
>
> static const struct file_operations proc_net_dir_operations = {
>         .read                   = generic_read_dir,
> };
>
> And I haven't managed to find out why the rest problems
> occur...
>
> Eric, do you have fixes for it?

Not exactly.  It is tricky.  I have known there are issues but so far
the difficulty of a better solution has been higher then my annoyance
level with this problem.

A special solution for !CONFIG_NET_NS may be practical for 2.6.24.

The only way I know of to really solve this problem cleanly and
completely is to make /proc/net an explicit symlink to /proc/self/net
and make /proc/<pid>/net a magic mountpoint (ala nfs automounts) that
mounts a per network namespace filesystem.  Al Viro wasn't to happy
when I suggested it (mostly because he was convinced such a solution
was likely to be full of races).

The half assed clean solution is to ensure nothing under /proc/net
gets cached and ensure the dentry tree is built properly, for the
current reader of /proc.

A third option is to fix .. in /proc/net.  Although I'm a bit
dubious if that will do more then fix a few symptoms with the
current solution.

Eric

  reply	other threads:[~2007-11-20 21:53 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20071119191000.GA1560@elf.ucw.cz>
2007-11-19 22:04 ` 2.6.24-rc3: find complains about /proc/net Rafael J. Wysocki
2007-11-20 15:51   ` Pavel Emelyanov
2007-11-20 21:52     ` Eric W. Biederman [this message]
2007-11-20 21:59       ` Ingo Molnar
2007-11-20 22:17         ` Eric W. Biederman
2007-11-20 22:35           ` Ingo Molnar
2007-11-20 22:54             ` Roland McGrath
2007-11-20 23:01               ` Ingo Molnar
2007-11-20 23:06                 ` Guillaume Chazarain
2007-11-20 23:26                   ` Roland McGrath
2007-11-20 23:32                     ` Ulrich Drepper
2007-11-20 23:45                       ` Ingo Molnar
2007-11-20 23:51                         ` Roland McGrath
2007-11-21  0:47                           ` Eric W. Biederman
2007-11-21  1:01                           ` Rafael J. Wysocki
2007-11-21  0:41                       ` Eric W. Biederman
2007-11-20 23:43                   ` Ingo Molnar
2007-11-20 22:41         ` [PATCH] proc: Fix the threaded /proc/self Eric W. Biederman
2007-11-20 22:58           ` Guillaume Chazarain
2007-11-20 23:03           ` Ingo Molnar
2007-11-21  1:19     ` 2.6.24-rc3: find complains about /proc/net Eric W. Biederman
2007-11-21  6:36     ` Eric W. Biederman
2007-11-21  9:36       ` Pavel Emelyanov
2007-11-24 23:34     ` [CFT][PATCH] proc_net: Remove userspace visible changes Eric W. Biederman
2007-11-26  8:43       ` Eric W. Biederman
2007-11-26 22:17     ` [PATCH 2.6.24-rc3] Fix /proc/net breakage Eric W. Biederman
2007-11-27 11:20       ` Pavel Emelyanov
2007-11-27 12:36         ` Eric W. Biederman
2007-12-07  4:51       ` David Woodhouse
2007-12-07 10:23         ` Andrew Morton
2007-12-07 11:11           ` Denis V. Lunev
2007-12-27 17:40           ` Andreas Mohr
2007-12-27 18:41             ` Alexey Dobriyan
2007-12-27 22:17               ` Andreas Mohr
2007-12-28  6:22                 ` Alexey Dobriyan
2007-12-28  7:21                   ` Andreas Mohr
2007-12-30 16:14                     ` [usb regression] " Ingo Molnar
2007-12-30 20:34                       ` Alan Stern
2007-12-31  5:25                         ` Greg KH
2007-12-31 17:49                           ` Alan Stern
2007-12-31 19:26                             ` Greg KH
2008-01-02  6:00                               ` Greg KH
2008-01-02  6:13                                 ` Andreas Mohr
     [not found]                                   ` <20080102061308.GB30929-p/qQFhXj4MHA4IYVXhSI5GHfThorsUsI@public.gmane.org>
2008-01-02  7:14                                     ` Greg KH
     [not found]                                 ` <20080102060006.GA27693-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org>
2008-01-02 15:56                                   ` Alan Stern
     [not found]                                     ` <Pine.LNX.4.44L0.0801021052470.4861-100000-IYeN2dnnYyZXsRXLowluHWD2FQJk+8+b@public.gmane.org>
2008-01-02 18:48                                       ` David Brownell
2008-01-02  6:04                         ` Andreas Mohr
     [not found] <fa.zy7JwM3jsOSgOCtqK2+rvFfdGjQ@ifi.uio.no>
     [not found] ` <fa.Zx9jkdx74KRPk1qghLrg9BCvfFU@ifi.uio.no>
     [not found]   ` <fa.1TKmo5fKBZfHOQYq1bH4uMxOQek@ifi.uio.no>
     [not found]     ` <fa.fjJG0rd93RGzZ4PSv/glscvAI0A@ifi.uio.no>
     [not found]       ` <fa.7XLWa+gAWL3Q6I3O+hiS4UfcWpM@ifi.uio.no>
     [not found]         ` <fa.QqYdKsBUWKSLLGXmxJCAtZxLYnE@ifi.uio.no>
2007-11-21  1:21           ` 2.6.24-rc3: find complains about /proc/net Robert Hancock
2007-11-21  1:41             ` Eric W. Biederman

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=m11wakshyz.fsf@ebiederm.dsl.xmission.com \
    --to=ebiederm@xmission.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pavel@ucw.cz \
    --cc=rjw@sisk.pl \
    --cc=xemul@openvz.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).