lkml.org 
[lkml]   [2020]   [Oct]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[RFC PATCH 10/27] clean reverse_path_check_proc() a bit
    Date
    From: Al Viro <viro@zeniv.linux.org.uk>

    Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
    ---
    fs/eventpoll.c | 26 +++++++++-----------------
    1 file changed, 9 insertions(+), 17 deletions(-)

    diff --git a/fs/eventpoll.c b/fs/eventpoll.c
    index 0f540e91aa92..33af838046ea 100644
    --- a/fs/eventpoll.c
    +++ b/fs/eventpoll.c
    @@ -1317,23 +1317,15 @@ static int reverse_path_check_proc(struct file *file, int depth)
    /* CTL_DEL can remove links here, but that can't increase our count */
    rcu_read_lock();
    list_for_each_entry_rcu(epi, &file->f_ep_links, fllink) {
    - struct file *child_file = epi->ep->file;
    - if (is_file_epoll(child_file)) {
    - if (list_empty(&child_file->f_ep_links)) {
    - if (path_count_inc(depth)) {
    - error = -1;
    - break;
    - }
    - } else {
    - error = reverse_path_check_proc(child_file,
    - depth + 1);
    - }
    - if (error != 0)
    - break;
    - } else {
    - printk(KERN_ERR "reverse_path_check_proc: "
    - "file is not an ep!\n");
    - }
    + struct file *recepient = epi->ep->file;
    + if (WARN_ON(!is_file_epoll(recepient)))
    + continue;
    + if (list_empty(&recepient->f_ep_links))
    + error = path_count_inc(depth);
    + else
    + error = reverse_path_check_proc(recepient, depth + 1);
    + if (error != 0)
    + break;
    }
    rcu_read_unlock();
    return error;
    --
    2.11.0
    \
     
     \ /
      Last update: 2020-10-04 04:41    [W:4.537 / U:0.008 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site