summaryrefslogtreecommitdiffstats
path: root/fs/notify
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2017-07-16 23:05:57 -0400
committerEric W. Biederman <ebiederm@xmission.com>2018-07-21 11:43:12 -0400
commit019191342fecce4a461978a7191a43f313e19e86 (patch)
treeb256a747d10ad9b2b674a5466f366b5109cc6509 /fs/notify
parent6883f81aac6f44e7df70a6af189b3689ff52cbfb (diff)
signal: Use PIDTYPE_TGID to clearly store where file signals will be sent
When f_setown is called a pid and a pid type are stored. Replace the use of PIDTYPE_PID with PIDTYPE_TGID as PIDTYPE_TGID goes to the entire thread group. Replace the use of PIDTYPE_MAX with PIDTYPE_PID as PIDTYPE_PID now is only for a thread. Update the users of __f_setown to use PIDTYPE_TGID instead of PIDTYPE_PID. For now the code continues to capture task_pid (when task_tgid would really be appropriate), and iterate on PIDTYPE_PID (even when type == PIDTYPE_TGID) out of an abundance of caution to preserve existing behavior. Oleg Nesterov suggested using the test to ensure we use PIDTYPE_PID for tgid lookup also be used to avoid taking the tasklist lock. Suggested-by: Oleg Nesterov <oleg@redhat.com> Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Diffstat (limited to 'fs/notify')
-rw-r--r--fs/notify/dnotify/dnotify.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/notify/dnotify/dnotify.c b/fs/notify/dnotify/dnotify.c
index e2bea2ac5dfb..484f2c3a33bb 100644
--- a/fs/notify/dnotify/dnotify.c
+++ b/fs/notify/dnotify/dnotify.c
@@ -19,6 +19,7 @@
19#include <linux/fs.h> 19#include <linux/fs.h>
20#include <linux/module.h> 20#include <linux/module.h>
21#include <linux/sched.h> 21#include <linux/sched.h>
22#include <linux/sched/signal.h>
22#include <linux/dnotify.h> 23#include <linux/dnotify.h>
23#include <linux/init.h> 24#include <linux/init.h>
24#include <linux/spinlock.h> 25#include <linux/spinlock.h>
@@ -353,7 +354,7 @@ int fcntl_dirnotify(int fd, struct file *filp, unsigned long arg)
353 goto out; 354 goto out;
354 } 355 }
355 356
356 __f_setown(filp, task_pid(current), PIDTYPE_PID, 0); 357 __f_setown(filp, task_pid(current), PIDTYPE_TGID, 0);
357 358
358 error = attach_dn(dn, dn_mark, id, fd, filp, mask); 359 error = attach_dn(dn, dn_mark, id, fd, filp, mask);
359 /* !error means that we attached the dn to the dn_mark, so don't free it */ 360 /* !error means that we attached the dn to the dn_mark, so don't free it */