Re: /proc/pid/fd/ shows strange mode when executed via sudo.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux