[patch] kjournald locking fix

From: Ishan O. Jayawardena (ioshadij@hotmail.com)
Date: Thu Apr 04 2002 - 17:02:29 EST


Greetings,

        kjournald seems to be missing an unlock_kernel() for a matching
lock_kernel(). A posting by Dennis Vadura to l-k mentions (among other
things) a kernel message that says kjournald exited with preempt_count ==
1. The attached patch (text/plain) adds the necessary
unlock_kernel(). [But I haven't been able to reproduce the hang that
Dennis experiences...]
        Tested only on UP. Patch is for 2.4.19-pre5 + prempt-kernel, _no_
lock-break. I hope the positioning of unlock_kernel() is correct... please
correct me if I'm wrong.

        Please CC me (ioshadij@hotmail.com). I can't subscribe to the list
with my own ISP because they aren't ECN-friendly, and subscribing via

PS: Of course, the reparent_to_init() isn't part of the fix, but I've seen
kjournald become a zombie in an ugly episode with a deadlock in devfs many
moons ago.

---------------------------------------------------------------
--- linux-preempt/fs/jbd/journal.c.1 Wed Apr 3 08:05:08 2002
+++ linux-preempt/fs/jbd/journal.c Thu Apr 4 15:09:29 2002
@@ -203,6 +203,7 @@ int kjournald(void *arg)
         current_journal = journal;
 
         lock_kernel();
+ reparent_to_init();
         daemonize();
         spin_lock_irq(&current->sigmask_lock);
         sigfillset(&current->blocked);
@@ -267,6 +268,7 @@ int kjournald(void *arg)
 
         journal->j_task = NULL;
         wake_up(&journal->j_wait_done_commit);
+ unlock_kernel();
         jbd_debug(1, "Journal thread exiting.\n");
         return 0;
 }



-
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 : Sun Apr 07 2002 - 22:00:13 EST