]> git.baikalelectronics.ru Git - kernel.git/commitdiff
NFS: Ensure nfs_readpage returns promptly when internal error occurs
authorDave Wysochanski <dwysocha@redhat.com>
Tue, 29 Jun 2021 09:11:28 +0000 (05:11 -0400)
committerTrond Myklebust <trond.myklebust@hammerspace.com>
Thu, 8 Jul 2021 18:03:26 +0000 (14:03 -0400)
A previous refactoring of nfs_readpage() might end up calling
wait_on_page_locked_killable() even if readpage_async_filler() failed
with an internal error and pg_error was non-zero (for example, if
nfs_create_request() failed).  In the case of an internal error,
skip over wait_on_page_locked_killable() as this is only needed
when the read is sent and an error occurs during completion handling.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
fs/nfs/read.c

index 684a730f6670f0177c26d01bc7bd8bc7f055b617..eb390eb618b30b3829ccc8cb921cf183d57b17a6 100644 (file)
@@ -373,10 +373,10 @@ int nfs_readpage(struct file *file, struct page *page)
                             &nfs_async_read_completion_ops);
 
        ret = readpage_async_filler(&desc, page);
+       if (ret)
+               goto out;
 
-       if (!ret)
-               nfs_pageio_complete_read(&desc.pgio);
-
+       nfs_pageio_complete_read(&desc.pgio);
        ret = desc.pgio.pg_error < 0 ? desc.pgio.pg_error : 0;
        if (!ret) {
                ret = wait_on_page_locked_killable(page);