diff options
Diffstat (limited to 'fs/signalfd.c')
-rw-r--r-- | fs/signalfd.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/fs/signalfd.c b/fs/signalfd.c index 492465b451dd..7ae2a574cb25 100644 --- a/fs/signalfd.c +++ b/fs/signalfd.c | |||
@@ -30,6 +30,21 @@ | |||
30 | #include <linux/signalfd.h> | 30 | #include <linux/signalfd.h> |
31 | #include <linux/syscalls.h> | 31 | #include <linux/syscalls.h> |
32 | 32 | ||
33 | void signalfd_cleanup(struct sighand_struct *sighand) | ||
34 | { | ||
35 | wait_queue_head_t *wqh = &sighand->signalfd_wqh; | ||
36 | /* | ||
37 | * The lockless check can race with remove_wait_queue() in progress, | ||
38 | * but in this case its caller should run under rcu_read_lock() and | ||
39 | * sighand_cachep is SLAB_DESTROY_BY_RCU, we can safely return. | ||
40 | */ | ||
41 | if (likely(!waitqueue_active(wqh))) | ||
42 | return; | ||
43 | |||
44 | /* wait_queue_t->func(POLLFREE) should do remove_wait_queue() */ | ||
45 | wake_up_poll(wqh, POLLHUP | POLLFREE); | ||
46 | } | ||
47 | |||
33 | struct signalfd_ctx { | 48 | struct signalfd_ctx { |
34 | sigset_t sigmask; | 49 | sigset_t sigmask; |
35 | }; | 50 | }; |