lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 19 Feb 2007 18:11:55 +0100
From:	Miklos Szeredi <miklos@...redi.hu>
To:	akpm@...ux-foundation.org
CC:	linux-kernel@...r.kernel.org, linux-mm@...ck.org
Subject: Re: dirty balancing deadlock

How about this?

Solves the FUSE deadlock, but not the throttle_vm_writeout() one.
I'll try to tackle that one as well.

If the per-bdi dirty counter goes below 16, balance_dirty_pages()
returns.

Does the constant need to tunable?  If it's too large, then the global
threshold is more easily exceeded.  If it's too small, then in a tight
situation progress will be slower.

Thanks,
Miklos

Index: linux/mm/page-writeback.c
===================================================================
--- linux.orig/mm/page-writeback.c	2007-02-19 17:32:41.000000000 +0100
+++ linux/mm/page-writeback.c	2007-02-19 18:05:28.000000000 +0100
@@ -198,6 +198,25 @@ static void balance_dirty_pages(struct a
 			dirty_thresh)
 				break;
 
+		/*
+		 * Acquit this producer if there's little or nothing
+		 * to write back to this particular queue
+		 *
+		 * Without this check a deadlock is possible in the
+		 * following case:
+		 *
+		 * - filesystem A writes data through filesystem B
+		 * - filesystem A has dirty pages over dirty_thresh
+		 * - writeback is started, this triggers a write in B
+		 * - balance_dirty_pages() is called synchronously
+		 * - the write to B blocks
+		 * - the writeback completes, but dirty is still over threshold
+		 * - the blocking write prevents futher writes from happening
+		 */
+		if (atomic_long_read(&bdi->nr_dirty) +
+		    atomic_long_read(&bdi->nr_writeback) < 16)
+			break;
+
 		if (!dirty_exceeded)
 			dirty_exceeded = 1;
 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists