Skip to content

Commit f9fac1f

Browse files
committed
pidfs: add some CONFIG_DEBUG_VFS asserts
Allow to catch some obvious bugs. Link: https://lore.kernel.org/20250618-work-pidfs-persistent-v2-16-98f3456fd552@kernel.org Reviewed-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com> Signed-off-by: Christian Brauner <brauner@kernel.org>
1 parent 8c2ab04 commit f9fac1f

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

fs/pidfs.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -809,6 +809,8 @@ static struct dentry *pidfs_fh_to_dentry(struct super_block *sb,
809809
if (ret < 0)
810810
return ERR_PTR(ret);
811811

812+
VFS_WARN_ON_ONCE(!pid->attr);
813+
812814
mntput(path.mnt);
813815
return path.dentry;
814816
}
@@ -1038,6 +1040,8 @@ struct file *pidfs_alloc_file(struct pid *pid, unsigned int flags)
10381040
if (ret < 0)
10391041
return ERR_PTR(ret);
10401042

1043+
VFS_WARN_ON_ONCE(!pid->attr);
1044+
10411045
flags &= ~PIDFD_STALE;
10421046
flags |= O_RDWR;
10431047
pidfd_file = dentry_open(&path, flags, current_cred());

0 commit comments

Comments
 (0)