On Fri, May 18, 2012 at 12:10 PM, Al Viro <viro@xxxxxxxxxxxxxxxxxx> wrote: > > Umm... I'd rather do it other way - do that test *before* bothering > with allocating an inode. IOW, use it as early cutoff, with > tid_fd_revalidate() called in the end closing any races about > file getting closed while we'd been allocating an inode, etc. I think you're optimizing the wrong case, and adding code to do so. The ENOENT case never happens in practice - there's no sane situation where you'd look up a non-existend /proc/xyz/fd/X file. So rather than "optimize" the case where you don't need an inode allocation, you're just wasting time doing the file lookup twice, and adding more code. Also, thinking some more about it: while I do agree that doing things at getattr() time is a really clean approach, we still do need the dentry revalidation for the existence check. And at that point it's actually pretty much free to just update the inode information, since we had to do the file lookup anyway. So I'm actually starting to think that I prefer my original simpler patch after all. It handles the case we care about, and doesn't add any unnecessary code. Linus -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html