Skip to content

Commit b5ba648

Browse files
Al Virobrauner
authored andcommitted
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) Signed-off-by: Al Viro <[email protected]> Link: https://lore.kernel.org/20250615003321.GC3011112@ZenIV Reviewed-by: Christian Brauner <[email protected]> Signed-off-by: Christian Brauner <[email protected]>
1 parent 88b1de5 commit b5ba648

File tree

1 file changed

+1
-10
lines changed

1 file changed

+1
-10
lines changed

fs/proc/fd.c

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -352,18 +352,9 @@ static int proc_fd_getattr(struct mnt_idmap *idmap,
352352
u32 request_mask, unsigned int query_flags)
353353
{
354354
struct inode *inode = d_inode(path->dentry);
355-
int rv = 0;
356355

357356
generic_fillattr(&nop_mnt_idmap, request_mask, inode, stat);
358-
359-
/* If it's a directory, put the number of open fds there */
360-
if (S_ISDIR(inode->i_mode)) {
361-
rv = proc_readfd_count(inode, &stat->size);
362-
if (rv < 0)
363-
return rv;
364-
}
365-
366-
return rv;
357+
return proc_readfd_count(inode, &stat->size);
367358
}
368359

369360
const struct inode_operations proc_fd_inode_operations = {

0 commit comments

Comments
 (0)