[PATCH] Freezer: Fix JFFS2 garbage collector freezing issue (was: Re: JFFS2 garbage collection threads not freezing?)

From: Rafael J. Wysocki
Date: Sat Dec 01 2007 - 14:55:55 EST


On Friday, 30 of November 2007, Pete MacKay wrote:
> We've ported from 2.6.18 to 2.6.24-rc3 on a pxa270-based machine and can
> no longer enter 'standby' or 'mem' states. I've stripped down the kernel
> and talked with the freezer maintainer and we believe the jffs2 garbage
> collection threads may not be calling try_to_freeze() or marking
> themselves properly. (We have two mounted jffs2 file systems - mtd2 and
> mtd3). The following is some cleaned-up output:
>
> Freezing remaining freezable tasks ...
> Freezing of tasks failed after 20.00 seconds (2 tasks refusing to freeze):
> task PC stack pid father
> init D c0244b90 0 1 0
> kthreadd S c0244b90 0 2 0
> ksoftirqd/0 S c0244b90 0 3 2
> events/0 S c0244b90 0 4 2
> khelper S c0244b90 0 5 2
> kblockd/0 S c0244b90 0 51 2
> ksuspend_usbd D c0244b90 0 59 2
> khubd D c0244b90 0 64 2
> kseriod D c0244b90 0 67 2
> pdflush D c0244b90 0 90 2
> pdflush D c0244b90 0 91 2
> kswapd0 D c0244b90 0 92 2
> aio/0 S c0244b90 0 93 2
> mtdblockd S c0244b90 0 192 2
> udevd D c0244b90 0 619 1
> jffs2_gcd_mtd R running 0 1533 2
> jffs2_gcd_mtd R running 0 1598 2
> syslogd D c0244b90 0 2248 1
> klogd D c0244b90 0 2250 1
> hcid D c0244b90 0 2273 1
> sdpd D c0244b90 0 2277 1
> hidd D c0244b90 0 2281 1
> sh D c0244b90 0 2292 1
> getty D c0244b90 0 2293 1
> echo R running 0 2303 2292
> jffs2_gcd_mtd2
> jffs2_gcd_mtd3
>
> Restarting tasks ... done.

I think that the appended patch is necessary to fix this problem.

Greetings,
Rafael

---
Subject: Freezer: Fix JFFS2 garbage collector freezing issue
From: Rafael J. Wysocki <rjw@xxxxxxx>

Fix breakage caused by commit d5d8c5976d6adeddb8208c240460411e2198b393
"freezer: do not send signals to kernel threads" in
jffs2_garbage_collect_thread() that assumed it would be sent signals
by the freezer.

Signed-off-by: Rafael J. Wysocki <rjw@xxxxxxx>
Cc: Pete MacKay <armlinux@xxxxxxxxxxxxxxxxxx>
Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
---
fs/jffs2/background.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)

Index: linux-2.6/fs/jffs2/background.c
===================================================================
--- linux-2.6.orig/fs/jffs2/background.c
+++ linux-2.6/fs/jffs2/background.c
@@ -103,15 +103,17 @@ static int jffs2_garbage_collect_thread(
get there first. */
yield();

+ /* If system suspend is in progress, go to the refrigerator and
+ start again when the suspend is done */
+ if (try_to_freeze())
+ goto again;
+
/* Put_super will send a SIGKILL and then wait on the sem.
*/
while (signal_pending(current)) {
siginfo_t info;
unsigned long signr;

- if (try_to_freeze())
- goto again;
-
signr = dequeue_signal_lock(current, &current->blocked, &info);

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