lkml.org 
[lkml]   [2014]   [Sep]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 3.12 108/142] CIFS: Fix async reading on reconnects
    Date
    From: Pavel Shilovsky <pshilovsky@samba.org>

    3.12-stable review patch. If anyone has any objections, please let me know.

    ===============

    commit 038bc961c31b070269ecd07349a7ee2e839d4fec upstream.

    If we get into read_into_pages() from cifs_readv_receive() and then
    loose a network, we issue cifs_reconnect that moves all mids to
    a private list and issue their callbacks. The callback of the async
    read request sets a mid to retry, frees it and wakes up a process
    that waits on the rdata completion.

    After the connection is established we return from read_into_pages()
    with a short read, use the mid that was freed before and try to read
    the remaining data from the a newly created socket. Both actions are
    not what we want to do. In reconnect cases (-EAGAIN) we should not
    mask off the error with a short read but should return the error
    code instead.

    Acked-by: Jeff Layton <jlayton@samba.org>
    Signed-off-by: Pavel Shilovsky <pshilovsky@samba.org>
    Signed-off-by: Steve French <smfrench@gmail.com>
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>
    ---
    fs/cifs/file.c | 4 ++--
    1 file changed, 2 insertions(+), 2 deletions(-)

    diff --git a/fs/cifs/file.c b/fs/cifs/file.c
    index 643a18491bed..892a1e947b5a 100644
    --- a/fs/cifs/file.c
    +++ b/fs/cifs/file.c
    @@ -2847,7 +2847,7 @@ cifs_uncached_read_into_pages(struct TCP_Server_Info *server,
    total_read += result;
    }

    - return total_read > 0 ? total_read : result;
    + return total_read > 0 && result != -EAGAIN ? total_read : result;
    }

    static ssize_t
    @@ -3270,7 +3270,7 @@ cifs_readpages_read_into_pages(struct TCP_Server_Info *server,
    total_read += result;
    }

    - return total_read > 0 ? total_read : result;
    + return total_read > 0 && result != -EAGAIN ? total_read : result;
    }

    static int cifs_readpages(struct file *file, struct address_space *mapping,
    --
    2.1.0


    \
     
     \ /
      Last update: 2014-09-26 13:01    [W:4.149 / U:0.320 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site