Skip to content

Commit

Permalink
NFS: Ensure nfs_readpage returns promptly when internal error occurs
Browse files Browse the repository at this point in the history
commit e0340f1 upstream.

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
DaveWysochanskiRH authored and gregkh committed Jul 20, 2021
1 parent 382f216 commit 9d94a3f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions fs/nfs/read.c
Expand Up @@ -374,10 +374,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, inode);

nfs_pageio_complete_read(&desc.pgio, inode);
ret = desc.pgio.pg_error < 0 ? desc.pgio.pg_error : 0;
if (!ret) {
ret = wait_on_page_locked_killable(page);
Expand Down

0 comments on commit 9d94a3f

Please sign in to comment.