mirror of
https://github.com/torvalds/linux.git
synced 2025-12-01 07:26:02 +07:00
pidfs: remove 32bit inode number handling
Now that we have a unified inode number handling model remove the custom ida-based allocation for 32bit. Link: https://lore.kernel.org/r/20241129-work-pidfs-v2-2-61043d66fbce@kernel.org Reviewed-by: Jeff Layton <jlayton@kernel.org> Reviewed-by: Amir Goldstein <amir73il@gmail.com> Reviewed-by: Jan Kara <jack@suse.cz> Signed-off-by: Christian Brauner <brauner@kernel.org>
This commit is contained in:
43
fs/pidfs.c
43
fs/pidfs.c
@@ -391,40 +391,6 @@ struct pid *pidfd_pid(const struct file *file)
|
||||
|
||||
static struct vfsmount *pidfs_mnt __ro_after_init;
|
||||
|
||||
#if BITS_PER_LONG == 32
|
||||
/*
|
||||
* Provide a fallback mechanism for 32-bit systems so processes remain
|
||||
* reliably comparable by inode number even on those systems.
|
||||
*/
|
||||
static DEFINE_IDA(pidfd_inum_ida);
|
||||
|
||||
static int pidfs_inum(struct pid *pid, unsigned long *ino)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = ida_alloc_range(&pidfd_inum_ida, RESERVED_PIDS + 1,
|
||||
UINT_MAX, GFP_ATOMIC);
|
||||
if (ret < 0)
|
||||
return -ENOSPC;
|
||||
|
||||
*ino = ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline void pidfs_free_inum(unsigned long ino)
|
||||
{
|
||||
if (ino > 0)
|
||||
ida_free(&pidfd_inum_ida, ino);
|
||||
}
|
||||
#else
|
||||
static inline int pidfs_inum(struct pid *pid, unsigned long *ino)
|
||||
{
|
||||
*ino = pidfs_ino(pid->ino);
|
||||
return 0;
|
||||
}
|
||||
#define pidfs_free_inum(ino) ((void)(ino))
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The vfs falls back to simple_setattr() if i_op->setattr() isn't
|
||||
* implemented. Let's reject it completely until we have a clean
|
||||
@@ -476,7 +442,6 @@ static void pidfs_evict_inode(struct inode *inode)
|
||||
|
||||
clear_inode(inode);
|
||||
put_pid(pid);
|
||||
pidfs_free_inum(inode->i_ino);
|
||||
}
|
||||
|
||||
static const struct super_operations pidfs_sops = {
|
||||
@@ -509,13 +474,9 @@ static int pidfs_init_inode(struct inode *inode, void *data)
|
||||
inode->i_mode |= S_IRWXU;
|
||||
inode->i_op = &pidfs_inode_operations;
|
||||
inode->i_fop = &pidfs_file_operations;
|
||||
inode->i_ino = pidfs_ino(pid->ino);
|
||||
inode->i_generation = pidfs_gen(pid->ino);
|
||||
/*
|
||||
* Inode numbering for pidfs start at RESERVED_PIDS + 1. This
|
||||
* avoids collisions with the root inode which is 1 for pseudo
|
||||
* filesystems.
|
||||
*/
|
||||
return pidfs_inum(data, &inode->i_ino);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void pidfs_put_data(void *data)
|
||||
|
||||
Reference in New Issue
Block a user