diff options
-rw-r--r-- | mm/filemap.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/mm/filemap.c b/mm/filemap.c index 407b94d8ce00..6024d15998a4 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -2327,10 +2327,15 @@ page_ok: page_not_up_to_date: /* Get exclusive access to the page ... */ - if (iocb->ki_flags & IOCB_WAITQ) + if (iocb->ki_flags & IOCB_WAITQ) { + if (written) { + put_page(page); + goto out; + } error = lock_page_async(page, iocb->ki_waitq); - else + } else { error = lock_page_killable(page); + } if (unlikely(error)) goto readpage_error; @@ -2373,10 +2378,15 @@ readpage: } if (!PageUptodate(page)) { - if (iocb->ki_flags & IOCB_WAITQ) + if (iocb->ki_flags & IOCB_WAITQ) { + if (written) { + put_page(page); + goto out; + } error = lock_page_async(page, iocb->ki_waitq); - else + } else { error = lock_page_killable(page); + } if (unlikely(error)) goto readpage_error; |