From: Suparna Bhattacharya Filesystem aio read Converts the wait for page to become uptodate (wait for page lock) after readahead/readpage (in do_generic_mapping_read) to a retry exit. --- 25-akpm/mm/filemap.c | 21 ++++++++++++++++++--- 1 files changed, 18 insertions(+), 3 deletions(-) diff -puN mm/filemap.c~aio-03-fs_read mm/filemap.c --- 25/mm/filemap.c~aio-03-fs_read Thu Jan 8 15:26:25 2004 +++ 25-akpm/mm/filemap.c Thu Jan 8 15:26:25 2004 @@ -739,7 +739,12 @@ page_not_up_to_date: goto page_ok; /* Get exclusive access to the page ... */ - lock_page(page); + + if (lock_page_wq(page, current->io_wait)) { + pr_debug("queued lock page \n"); + error = -EIOCBRETRY; + goto sync_error; + } /* Did it get unhashed before we got the lock? */ if (!page->mapping) { @@ -761,13 +766,23 @@ readpage: if (!error) { if (PageUptodate(page)) goto page_ok; - wait_on_page_locked(page); + if (wait_on_page_locked_wq(page, current->io_wait)) { + pr_debug("queued wait_on_page \n"); + error = -EIOCBRETRY; + goto sync_error; + } + if (PageUptodate(page)) goto page_ok; error = -EIO; } - /* UHHUH! A synchronous read error occurred. Report it */ +sync_error: + /* We don't have uptodate data in the page yet */ + /* Could be due to an error or because we need to + * retry when we get an async i/o notification. + * Report the reason. + */ desc->error = error; page_cache_release(page); break; _