diff mbox series

[04/11] proc_fd_getattr(): don't bother with S_ISDIR() check

Message ID 20240812064427.240190-4-viro@zeniv.linux.org.uk (mailing list archive)
State New
Headers show
Series [01/11] get rid of ...lookup...fdget_rcu() family | expand

Commit Message

Al Viro Aug. 12, 2024, 6:44 a.m. UTC
that thing is callable only as ->i_op->getattr() instance and only
for directory inodes (/proc/*/fd and /proc/*/task/*/fd)

Reviewed-by: Christian Brauner <brauner@kernel.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
---
 fs/proc/fd.c | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)
diff mbox series

Patch

diff --git a/fs/proc/fd.c b/fs/proc/fd.c
index 077c51ba1ba7..f3c5767db3d4 100644
--- a/fs/proc/fd.c
+++ b/fs/proc/fd.c
@@ -351,18 +351,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 = {