public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Re: [patch] kjournald locking fix
@ 2002-04-04 22:55 Ishan O. Jayawardena
  2002-04-04 18:40 ` Robert Love
  0 siblings, 1 reply; 5+ messages in thread
From: Ishan O. Jayawardena @ 2002-04-04 22:55 UTC (permalink / raw)
  To: marcelo; +Cc: akpm, linux-kernel

[-- Attachment #1: Type: TEXT/PLAIN, Size: 787 bytes --]

Greetings everyone,

	Here's an improved version of my previous patch. Thanks to Andrew
Morton for the advice. 2.5 needs this too I think, since preemption is
part of it now...

Ishan O. Jayawardena


----------------------------------------------------------------

--- linux-preempt/fs/jbd/journal.c.1	Wed Apr  3 08:05:08 2002
+++ linux-preempt/fs/jbd/journal.c	Thu Apr  4 16:41:56 2002
@@ -204,6 +204,7 @@ int kjournald(void *arg)
 
 	lock_kernel();
 	daemonize();
+	reparent_to_init();
 	spin_lock_irq(&current->sigmask_lock);
 	sigfillset(&current->blocked);
 	recalc_sigpending(current);
@@ -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;
 }

[-- Attachment #2: Type: TEXT/PLAIN, Size: 538 bytes --]

--- linux-preempt/fs/jbd/journal.c.1	Wed Apr  3 08:05:08 2002
+++ linux-preempt/fs/jbd/journal.c	Thu Apr  4 16:41:56 2002
@@ -204,6 +204,7 @@ int kjournald(void *arg)
 
 	lock_kernel();
 	daemonize();
+	reparent_to_init();
 	spin_lock_irq(&current->sigmask_lock);
 	sigfillset(&current->blocked);
 	recalc_sigpending(current);
@@ -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;
 }

^ permalink raw reply	[flat|nested] 5+ messages in thread
* [patch] kjournald locking fix
@ 2002-04-04 22:02 Ishan O. Jayawardena
  2002-04-04 10:19 ` Andrew Morton
  2002-04-04 18:40 ` Robert Love
  0 siblings, 2 replies; 5+ messages in thread
From: Ishan O. Jayawardena @ 2002-04-04 22:02 UTC (permalink / raw)
  To: akpm, linux-kernel

[-- Attachment #1: Type: TEXT/PLAIN, Size: 1423 bytes --]


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;
 }

[-- Attachment #2: Type: TEXT/PLAIN, Size: 537 bytes --]

--- 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;
 }

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2002-04-04 18:41 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-04-04 22:55 [patch] kjournald locking fix Ishan O. Jayawardena
2002-04-04 18:40 ` Robert Love
  -- strict thread matches above, loose matches on Subject: below --
2002-04-04 22:02 Ishan O. Jayawardena
2002-04-04 10:19 ` Andrew Morton
2002-04-04 18:40 ` Robert Love

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox