why does proc_fd_getattr() bother with S_ISDIR(inode->i_mode)?
Subsystems (2)
Al Viro
maintainer... when the only way to get to it is via ->getattr() in
proc_fd_inode_operations? Note that proc_fd_inode_operations has ->lookup() in it; it _can't_ be ->i_op of a non-directory.
Am I missing something here?
Quoted 6 lines · Al Viro
... when the only way to get to it is via ->getattr() in
proc_fd_inode_operations? Note thatproc_fd_inode_operationshas ->lookup() in it; it _can't_ be ->i_op of a non-directory.Am I missing something here?
It's been two years, but I think I was just extra cautious.
Al Viro
maintainerQuoted 9 lines · Ivan Babrou
Quoted 6 lines · Al Viro
... when the only way to get to it is via ->getattr() in
proc_fd_inode_operations? Note thatproc_fd_inode_operationshas ->lookup() in it; it _can't_ be ->i_op of a non-directory.Am I missing something here?
It's been two years, but I think I was just extra cautious.
Does anyone have objections against the following?
[PATCH] proc_fd_getattr(): don't bother with S_ISDIR() check
that thing is callable only as ->i_op->getattr() instance and only for directory inodes (/proc/*/fd and /proc/*/task/*/fd)
---
fs/proc/fd.c +1 -10
@@ -357,18 +357,9 @@ static int proc_fd_getattr(struct mnt_idmap *idmap, u32 request_mask, unsigned int query_flags) { struct inode *inode = d_inode(path->dentry); -int rv =0 ;generic_fillattr (&nop_mnt_idmap, request_mask, inode, stat); - -/* If it's a directory, put the number of open fds there */ -if (S_ISDIR (inode->i_mode)) { - rv =proc_readfd_count (inode, &stat->size); -if (rv <0 ) -return rv; - } - -return rv; +return proc_readfd_count (inode, &stat->size); } const struct inode_operations proc_fd_inode_operations = {
Quoted 13 lines · Al Viro
Quoted 9 lines · Ivan Babrou
Quoted 6 lines · Al Viro
... when the only way to get to it is via ->getattr() in
proc_fd_inode_operations? Note thatproc_fd_inode_operationshas ->lookup() in it; it _can't_ be ->i_op of a non-directory.Am I missing something here?
It's been two years, but I think I was just extra cautious.
Does anyone have objections against the following?
Quoted 7 lines
[PATCH]
proc_fd_getattr(): don't bother withS_ISDIR()checkthat thing is callable only as ->i_op->getattr() instance and only for directory inodes (
/proc/*/fdand/proc/*/task/*/fd)Signed-off-by Al Viro <[email protected]>---
Kill it,