[PATCH] reiserfs_write_inode calls during memory pressure

From: Chris Mason (mason@suse.com)
Date: Thu Jun 28 2001 - 10:02:53 EST

[ one more time ]

Hi guys,

This patch makes reiserfs_write_inode skip the commit when it is called
during memory pressure with sync == 1. In this case, reiserfs already has
the inode logged, and triggering an immediate commit might force kswapd
to wait on the log, which can lead to deadlock.

More details can be found in the VM deadlock thread on both of these

It has passed minimal testing on my machine, I'll start more (yura, please
do the same).


diff -Nru a/fs/reiserfs/inode.c b/fs/reiserfs/inode.c
--- a/fs/reiserfs/inode.c Thu Jun 28 10:56:04 2001
+++ b/fs/reiserfs/inode.c Thu Jun 28 10:56:04 2001
@@ -1284,7 +1284,12 @@
                           inode->i_ino) ;
         return ;
- if (do_sync) {
+ /* memory pressure can sometimes initiate write_inode calls with sync == 1,
+ ** these cases are just when the system needs ram, not when the
+ ** inode needs to reach disk for safety, and they can safely be
+ ** ignored because the altered inode has already been logged.
+ */
+ if (do_sync && !(current->flags & PF_MEMALLOC)) {
         lock_kernel() ;
         journal_begin(&th, inode->i_sb, jbegin_count) ;
         reiserfs_update_sd (&th, inode);

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

This archive was generated by hypermail 2b29 : Sat Jun 30 2001 - 21:00:19 EST