There have been a number of page cache problems with deadlocks on trying to
flush dirty pages to disk since >= pre7-4. In particular, this broke both
ReiserFS (3.6.5 patch for pre6) and a variety of other common programs when they
munmapped dirty write mappings, truncated files, etc., etc. I personally had
problems with su hanging upon updating the syslog file, crond crashing on
startup because of the same, etc., etc.
Well, I tracked the problem down to several lines in filemap.c that totally
changed the filemap_write_page locking semantics between pre7-3 and pre7-4. A
patch is attached that appears to fix the problem on both ReiserFS and (the much
less common case) on ext2 filesystems. I don't know how this affects other code,
but since filemap_write_page is private to filemap.c, I'm guessing it doesn't
matter much. The problem seems to arise since filemap_swapout does NOT
lock/unlock the page (it wrongly still assumes filemap_write_page does this),
while filemap_sync_pte (i.e., called from munmap) DOES try to lock the page (but
not anymore, since I fixed it.) In any case, I restored the old semantics and
everything seems to work fine now.
Patch to 2.3.99-pre9-2:
--- mm/filemap.c.orig Wed May 17 18:48:16 2000
+++ mm/filemap.c Wed May 17 18:48:39 2000
@@ -1543,7 +1543,11 @@
* vma/file is guaranteed to exist in the unmap/sync cases because
* mmap_sem is held.
*/
- return page->mapping->a_ops->writepage(file, page);
+ int result;
+ lock_page(page);
+ result = page->mapping->a_ops->writepage(file, page);
+ UnlockPage(page);
+ return result;
}
@@ -1601,9 +1605,7 @@
printk("weirdness: pgoff=%lu index=%lu address=%lu vm_start=%lu
vm_pgoff=%lu\n",
pgoff, page->index, address, vma->vm_start, vma->vm_pgoff);
}
- lock_page(page);
error = filemap_write_page(vma->vm_file, page, 1);
- UnlockPage(page);
page_cache_free(page);
return error;
}
I hope this works without any other side effects.
- Matt Yourst
-------------------------------------------------------------
Matt T. Yourst Massachusetts Institute of Technology
yourst@mit.edu 617.225.7690
513 French House - 476 Memorial Drive - Cambridge, MA 02136
-------------------------------------------------------------
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/
This archive was generated by hypermail 2b29 : Tue May 23 2000 - 21:00:13 EST