linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2.6] md debug fixes
@ 2004-01-22 20:59 Paul Clements
  2004-01-23  0:23 ` Neil Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Paul Clements @ 2004-01-22 20:59 UTC (permalink / raw)
  To: neilb; +Cc: linux-raid

[-- Attachment #1: Type: text/plain, Size: 534 bytes --]

Hi Neil,

While running md with debug turned on, I noticed a couple of things that
could maybe use changing. 

The first change simply makes one of the debug messages a little more
useful (printing a thread's name rather than just a hex pointer value). 

The second fix is necessary to avoid an oops when md_error is called.
Because md_error is generally called when a device has failed, the
chance of the rdev parameter being NULL is fairly high. I hit this oops
several times in testing.

Patch attached, please apply.

Thanks,
Paul

[-- Attachment #2: md_error_debug_fix.diff --]
[-- Type: text/x-patch, Size: 1505 bytes --]

Index: drivers/md/md.c
===================================================================
RCS file: /home/cvs/CVSROOT/kernel/linux-2.6.0/drivers/md/md.c,v
retrieving revision 1.6
diff -p -u -r1.6 md.c
--- drivers/md/md.c	2004/01/12 20:33:10	1.6
+++ drivers/md/md.c	2004/01/22 19:00:35
@@ -2903,7 +2892,7 @@ int md_thread(void * arg)
 void md_wakeup_thread(mdk_thread_t *thread)
 {
 	if (thread) {
-		dprintk("md: waking up MD thread %p.\n", thread);
+		dprintk("md: waking up MD thread %s.\n", thread->tsk->comm);
 		set_bit(THREAD_WAKEUP, &thread->flags);
 		wake_up(&thread->wqueue);
 	}
@@ -2964,12 +2953,6 @@ void md_unregister_thread(mdk_thread_t *
 
 void md_error(mddev_t *mddev, mdk_rdev_t *rdev)
 {
-	dprintk("md_error dev:(%d:%d), rdev:(%d:%d), (caller: %p,%p,%p,%p).\n",
-		MD_MAJOR,mdidx(mddev),
-		MAJOR(rdev->bdev->bd_dev), MINOR(rdev->bdev->bd_dev),
-		__builtin_return_address(0),__builtin_return_address(1),
-		__builtin_return_address(2),__builtin_return_address(3));
-
 	if (!mddev) {
 		MD_BUG();
 		return;
@@ -2977,6 +2960,13 @@ void md_error(mddev_t *mddev, mdk_rdev_t
 
 	if (!rdev || rdev->faulty)
 		return;
+
+	dprintk("md_error dev:(%d:%d), rdev:(%d:%d), (caller: %p,%p,%p,%p).\n",
+		MD_MAJOR,mdidx(mddev),
+		MAJOR(rdev->bdev->bd_dev), MINOR(rdev->bdev->bd_dev),
+		__builtin_return_address(0),__builtin_return_address(1),
+		__builtin_return_address(2),__builtin_return_address(3));
+
 	if (!mddev->pers->error_handler)
 		return;
 	mddev->pers->error_handler(mddev,rdev);

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

end of thread, other threads:[~2004-01-23  0:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-01-22 20:59 [PATCH 2.6] md debug fixes Paul Clements
2004-01-23  0:23 ` Neil Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).