Skip to contentSkip to conversation

md debug fixes

PATCH In review Paul Clements 2 participants 2 messages Jan 22, 2004 – Jan 23, 2004 MD RAID

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 md debug fixes

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

Index: drivers/md/md.c
===================================================================
RCS file: /home/cvs/CVSROOT/kernel/linux-2.6.0/drivers/md/md.c,v retrieving revision 1.6

md/md.c +8 -7
diff -p -u -r1.6 md.c
@@ -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);
#1 lore raw
Quoted 8 lines · On Thursday January 22, [email protected] wrote:

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).

Quoted 6 lines

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.

I've submitted it for 2.6. I don't think I'll bother for 2.4

Thanks,
NeilBrown