From: Al Viro <viro@ZenIV.linux.org.uk>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [RFC] st_nlink after rmdir() and rename()
Date: Thu, 3 Mar 2011 22:57:02 +0000 [thread overview]
Message-ID: <20110303225702.GQ22723@ZenIV.linux.org.uk> (raw)
In-Reply-To: <AANLkTinSiD3YakBTNfYXrE12YDsDREHX3GzLzCncduTV@mail.gmail.com>
On Thu, Mar 03, 2011 at 01:52:18PM -0800, Linus Torvalds wrote:
> On Thu, Mar 3, 2011 at 1:37 PM, OGAWA Hirofumi
> <hirofumi@mail.parknet.co.jp> wrote:
> >
> > And I can't only see is why you refuse to make consistent behavior (if
> > you are saying it). It's why I said if it's _really easy_.
>
> The thing is, it really isn't really easy. As mentioned, it's actually
> impossible on NFS, and it's possibly impossible on other filesystems
> too.
>
> So what I'm objecting to is "try to make something consistent that
> CANNOT be consistent anyway", and calling it a bug.
>
> I'm not saying there aren't real bugs there too (the actual races in
> i_nlink handling are real bugs). But I _am_ saying that it's simply
> not true that i_nlink must be zero if you do an "fstat()" after doing
> an rmdir on an fd that you held open. Nobody can reasonably care, and
> anybody who _does_ care is better off getting a nasty surprise early
> rather than late.
Ho-hum... OK, let me put it that way:
* pile I've sent a pull request for is really bug-only; none of it
has anything to do with what's discussed in that thread, other than "it's
also about i_nlink and found during the same code review". i_nlink races,
pair of fs corruptors and a braino in UDF (256 << sizeof(inode->i_nlink)
as a way to spell "maximal allowed number of links"; never really worked,
even before we had switched to 32bit internal i_nlink - the real limit is
0xffff, not 0x3ff or 0xfff).
* it's trivial to get the same behaviour on all local filesystems;
most of them have it and rely on it to detect the inodes that need to be
freed on final iput(). It has nothing to do with counting subdirs or any
such nonsense.
* inotify is broken for filesystems that don't get you zero ->i_nlink
when the last dentry pointing to doomed inode is dropped. Regardless of what
you get in fstat(). Excusable for remote fs, but not nice for local ones.
I'd *LOVE* to get rid of inotife/dnotify/etc., but it's probably not feasible
now.
* NFS is not hard to handle, actually, especially for directories.
Regular files may be trickier, but then we have many places in that area
where NFS is not quite POSIX-compliant, to put it mildly.
* I honestly don't know what's the real situation with other
remote filesystems; thus the RFC. Hopefully, people familiar with that
are on fsdevel...
BTW, I suspect that another exception among the local filesystems (affs)
is actually leaking blocks on rmdir. Need to experiment to verify that,
but it smells like another genuine bug.
next prev parent reply other threads:[~2011-03-03 22:57 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-03 3:24 [RFC] st_nlink after rmdir() and rename() Al Viro
2011-03-03 4:42 ` Al Viro
2011-03-03 5:17 ` Linus Torvalds
2011-03-03 6:03 ` Al Viro
2011-03-03 20:05 ` Linus Torvalds
2011-03-03 20:46 ` OGAWA Hirofumi
2011-03-03 20:50 ` OGAWA Hirofumi
2011-03-03 21:02 ` Linus Torvalds
2011-03-03 21:30 ` Al Viro
2011-03-03 21:37 ` OGAWA Hirofumi
2011-03-03 21:52 ` Linus Torvalds
2011-03-03 22:26 ` OGAWA Hirofumi
2011-03-03 22:37 ` Linus Torvalds
2011-03-03 23:14 ` OGAWA Hirofumi
2011-03-03 23:12 ` Al Viro
2011-03-03 22:57 ` Al Viro [this message]
2011-03-03 23:07 ` Al Viro
2011-03-04 6:55 ` omfs fixes Al Viro
2011-03-04 15:24 ` Bob Copeland
2011-03-03 21:23 ` [RFC] st_nlink after rmdir() and rename() Al Viro
2011-03-03 14:34 ` Theodore Tso
2011-03-03 16:17 ` Andreas Schwab
2011-03-03 19:16 ` Al Viro
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=20110303225702.GQ22723@ZenIV.linux.org.uk \
--to=viro@zeniv.linux.org.uk \
--cc=hirofumi@mail.parknet.co.jp \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@linux-foundation.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).