diff -urN linux-2.4.19/mm/filemap.c linux-2.4.19.SuSE/mm/filemap.c --- linux-2.4.19/mm/filemap.c 2003-02-06 16:00:16.000000000 +0100 +++ linux-2.4.19.SuSE/mm/filemap.c 2003-02-06 16:08:03.000000000 +0100 @@ -3632,17 +3632,21 @@ /* We haven't tried reading this page before, give it a go. */ pr_debug("attempting to read %lu\n", page->index); io->did_read = 1; - locked = 0; - io->err = page->mapping->a_ops->readpage(io->file, page); - if (!io->err) { - if (Page_Uptodate(page)) - goto again; - if (wtd_lock_page(&io->wtd, page)) { - locked = 1; - goto again; + if (likely(page->mapping)) { + locked = 0; + io->err = page->mapping->a_ops->readpage(io->file, page); + if (!io->err) { + if (Page_Uptodate(page)) + goto again; + if (wtd_lock_page(&io->wtd, page)) { + locked = 1; + goto again; + } + return; } - return; - } + } else + /* page not mapped, erroring out. */ + io->err = 0; } if (locked) @@ -3687,10 +3691,18 @@ wtd_queue(&io->wtd); return; } + /* + * Lock the page and if it is still mapped in the file, + * attempt to read it in. + */ if (!TryLockPage(page)) { - int ret = readpage(io->file, page); - if (ret) - printk(KERN_DEBUG "__generic_file_read_iodesc: readpage(%lu): %d\n", page->index, ret); + if (likely(page->mapping)) { + int ret = readpage(io->file, page); + if (ret) + pr_debug("__generic_file_read_iodesc: readpage(%lu): %d\n", page->index, ret); + } else + /* page not mapped, truncated! */ + unlock_page(page); } if (!Page_Uptodate(page) && io->good_idx == -1) {