diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2020-10-01 23:10:11 +0300 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2020-10-26 03:02:07 +0300 |
commit | d9f41e3c95a17c263bd72799ea8c33ea6138dc22 (patch) | |
tree | f44cf8d0831ad7d61d00447523ba5077c7cb89c0 /fs/eventpoll.c | |
parent | b62d2706a754887800a7cec4eb0592a9263a38fc (diff) | |
download | linux-d9f41e3c95a17c263bd72799ea8c33ea6138dc22.tar.xz |
epoll: massage the check list insertion
in the "non-epoll target" cases do it in ep_insert() rather than
in do_epoll_ctl(), so that we do it only with some epitem is already
guaranteed to exist.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/eventpoll.c')
-rw-r--r-- | fs/eventpoll.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/fs/eventpoll.c b/fs/eventpoll.c index 06674515132c..8f68095c5ce9 100644 --- a/fs/eventpoll.c +++ b/fs/eventpoll.c @@ -1375,6 +1375,10 @@ static int ep_insert(struct eventpoll *ep, const struct epoll_event *event, spin_lock(&tfile->f_lock); hlist_add_head_rcu(&epi->fllink, &tfile->f_ep_links); spin_unlock(&tfile->f_lock); + if (full_check && !tep) { + get_file(tfile); + list_add(&tfile->f_tfile_llink, &tfile_check_list); + } /* * Add the current item to the RB tree. All RB tree operations are @@ -2013,10 +2017,6 @@ int do_epoll_ctl(int epfd, int op, int fd, struct epoll_event *epds, error = -ELOOP; if (ep_loop_check(ep, tep) != 0) goto error_tgt_fput; - } else { - get_file(tf.file); - list_add(&tf.file->f_tfile_llink, - &tfile_check_list); } error = epoll_mutex_lock(&ep->mtx, 0, nonblock); if (error) |