History

pidfs: move setting flags into pidfs_alloc_file()

Instead od adding it into __pidfd_prepare() place it where the actual file allocation happens and update the outdated comment.

Christian Brauner committed 1 year ago

Commit 3155a191 parent b573bf62 files · +4 −5Browse files

Unified · Split

2 files
  1. fs/pidfs.c +4 −0
  2. kernel/fork.c +0 −5
fs/pidfs.c+4−0
@@ -696,6 +696,10 @@ struct file *pidfs_alloc_file(struct pid *pid, unsigned int flags) · 695 unmodified lines
696 return ERR_PTR(ret);696 return ERR_PTR(ret);
697 697
698 pidfd_file = dentry_open(&path, flags, current_cred());698 pidfd_file = dentry_open(&path, flags, current_cred());
699 /* Raise PIDFD_THREAD explicitly as do_dentry_open() strips it. */
700 if (!IS_ERR(pidfd_file))
701 pidfd_file->f_flags |= (flags & PIDFD_THREAD);
702
699 path_put(&path);703 path_put(&path);
700 return pidfd_file;704 return pidfd_file;
701}705}
kernel/fork.c+0−5
@@ -2042,11 +2042,6 @@ static int __pidfd_prepare(struct pid *pid, unsigned int flags, struct file **re · 2041 unmodified lines
2042 if (IS_ERR(pidfd_file))2042 if (IS_ERR(pidfd_file))
2043 return PTR_ERR(pidfd_file);2043 return PTR_ERR(pidfd_file);
2044 2044
2045 /*
2046 * anon_inode_getfile() ignores everything outside of the
2047 * O_ACCMODE | O_NONBLOCK mask, set PIDFD_THREAD manually.
2048 */
2049 pidfd_file->f_flags |= (flags & PIDFD_THREAD);
2050 *ret = pidfd_file;2045 *ret = pidfd_file;
2051 return take_fd(pidfd);2046 return take_fd(pidfd);
2052}2047}

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t