From: "Vegard Nossum" <vegard.nossum@gmail.com>
To: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: "Andrew Morton" <akpm@linux-foundation.org>,
linux-kernel@vger.kernel.org,
"Pavel Emelyanov" <xemul@openvz.org>,
"David S. Miller" <davem@davemloft.net>
Subject: Re: find: WARNING: Hard link count is wrong for /proc/1
Date: Tue, 3 Jun 2008 06:06:27 +0200 [thread overview]
Message-ID: <19f34abd0806022106v47b1e139qcd012335e867261e@mail.gmail.com> (raw)
In-Reply-To: <m1fxrv18q2.fsf@x61.ebiederm.org>
On Tue, Jun 3, 2008 at 5:46 AM, Eric W. Biederman <ebiederm@xmission.com> wrote:
> Andrew Morton <akpm@linux-foundation.org> writes:
>>> #ifdef CONFIG_SECURITY
>>> inode->i_nlink += 1;
>>> #endif
>>> +#ifdef CONFIG_NET
>>> + inode->i_nlink += 1;
>>> +#endif
>>>
>>> dentry->d_op = &pid_dentry_operations;
>>
>> A bit more explanation would be nice.
>>
>> I assume that here we're accounting for a reference which net applies
>> to this dentry. But it would be clearer and more robust to do that at
>> the site where that reference is really taken, not over in
>> proc_pid_instantiate(). Possible?
>
> Yes. Potentially we can read through the tid_base_stuff and
> count the total number of directories at runtime whenever we
> open a /proc/<pid> directory. It is a smallish table and walking the
> entire table is likely to be lost in the noise, and that would
> certainly improve the maintainability of the code.
>
> Currently what we do is:
> inode->i_nlink = 5;
> #ifdef CONFIG_SECURITY
> inode->i_nlink += 1;
> #endif
>
> To get the hard link count of /proc/<pid> correct.
> With /proc/<pid>/net we have added one more optional possibly absent
> directory.
>
> So the above patch is trivially correct in the current form of the
> code but does not improve maintenance.
>
> I am tired and all I have the energy to do today is to review the
> patch and say: "Yes. The patch works for the correct reasons, let's
> fix this bug."
I can try for the counting fix if you give me a bit of time. I have an
exam today and tomorrow, so I'll likely be able to submit a fix after
that :-)
Maybe you can apply the fix for now and I can follow up with the nicer
counting patch afterwards? (Or if anybody else wants to write it
that's also fine :-))
Vegard
--
"The animistic metaphor of the bug that maliciously sneaked in while
the programmer was not looking is intellectually dishonest as it
disguises that the error is the programmer's own creation."
-- E. W. Dijkstra, EWD1036
next prev parent reply other threads:[~2008-06-03 4:06 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-06-02 6:31 Vegard Nossum
2008-06-02 7:00 ` Vegard Nossum
2008-06-02 7:03 ` Vegard Nossum
2008-06-02 15:53 ` Jan Kara
2008-06-02 16:11 ` Pekka Enberg
2008-06-02 16:14 ` Pekka Enberg
2008-06-03 1:59 ` Eric W. Biederman
2008-06-03 2:10 ` Andrew Morton
[not found] ` <m1fxrv18q2.fsf@x61.ebiederm.org>
2008-06-03 4:06 ` Vegard Nossum [this message]
2008-06-02 22:29 ` Rafael C. de Almeida
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=19f34abd0806022106v47b1e139qcd012335e867261e@mail.gmail.com \
--to=vegard.nossum@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=davem@davemloft.net \
--cc=ebiederm@xmission.com \
--cc=linux-kernel@vger.kernel.org \
--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
all inboxes | Powered by JetHome®