Skip to content

Commit 37e62da

Browse files
committed
pidfs: use anon_inode_getattr()
So far pidfs did use it's own version. Just use the generic version. We use our own wrappers because we're going to be implementing our own retrieval properties soon. Link: https://lore.kernel.org/[email protected] Reviewed-by: Jeff Layton <[email protected]> Signed-off-by: Christian Brauner <[email protected]>
1 parent cfd86ef commit 37e62da

File tree

1 file changed

+1
-23
lines changed

1 file changed

+1
-23
lines changed

fs/pidfs.c

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -572,33 +572,11 @@ static int pidfs_setattr(struct mnt_idmap *idmap, struct dentry *dentry,
572572
return -EOPNOTSUPP;
573573
}
574574

575-
576-
/*
577-
* User space expects pidfs inodes to have no file type in st_mode.
578-
*
579-
* In particular, 'lsof' has this legacy logic:
580-
*
581-
* type = s->st_mode & S_IFMT;
582-
* switch (type) {
583-
* ...
584-
* case 0:
585-
* if (!strcmp(p, "anon_inode"))
586-
* Lf->ntype = Ntype = N_ANON_INODE;
587-
*
588-
* to detect our old anon_inode logic.
589-
*
590-
* Rather than mess with our internal sane inode data, just fix it
591-
* up here in getattr() by masking off the format bits.
592-
*/
593575
static int pidfs_getattr(struct mnt_idmap *idmap, const struct path *path,
594576
struct kstat *stat, u32 request_mask,
595577
unsigned int query_flags)
596578
{
597-
struct inode *inode = d_inode(path->dentry);
598-
599-
generic_fillattr(&nop_mnt_idmap, request_mask, inode, stat);
600-
stat->mode &= ~S_IFMT;
601-
return 0;
579+
return anon_inode_getattr(idmap, path, stat, request_mask, query_flags);
602580
}
603581

604582
static const struct inode_operations pidfs_inode_operations = {

0 commit comments

Comments
 (0)