Patchwork [Bug,16142] r8169: Kernel Panic when a lot of data is transferred through network interface

login
register
mail settings
Submitter Borislav Petkov
Date June 18, 2010, 7:45 a.m.
Message ID <20100618074510.GD32368@liondog.tnic>
Download mbox | patch
Permalink /patch/56146/
State Not Applicable
Delegated to: David Miller
Headers show

Comments

Borislav Petkov - June 18, 2010, 7:45 a.m.
From: Hans Mueller <hans42mueller@googlemail.com>
Date: Thu, Jun 17, 2010 at 03:00:08PM +0200

(readding original Cc list)

Ok, here's another debug/fix patch which should fix your issue. It boots
fine here but I can't hit your condition so please test it exactly
the same as yesterday and do catch the _complete_ output again. By
complete I mean not only the output from the ide-cd driver only but of
the machine from the very first line after it restarts for it could
contain valuable information there too.

Thanks a lot for your effort, here's the patch (you should replace this
one with the old patch, ask for help if you need any):

---
Hans Mueller - June 18, 2010, 1:08 p.m.
Hi,

a questions to you Boris:

On Fri, 18 Jun 2010 09:45:10 +0200
Borislav Petkov <bp@alien8.de> wrote:
> [...] and do catch the _complete_ output again.
Can you tell me how to do this? Can I make the kernel to wait until I connect 
with firescope?
As far as I know, I can only connect if the kernel already loaded / initialized the firewire drivers,
when using firescope. Therefore I cannot 'connect' before the kernel started booting, can I?


Regards Jonas
--
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Borislav Petkov - June 18, 2010, 3:02 p.m.
From: Hans Mueller <hans42mueller@googlemail.com>
Date: Fri, Jun 18, 2010 at 03:08:00PM +0200

> > [...] and do catch the _complete_ output again.

> Can you tell me how to do this? Can I make the kernel to wait until I
> connect with firescope? As far as I know, I can only connect if the
> kernel already loaded / initialized the firewire drivers, when using
> firescope. Therefore I cannot 'connect' before the kernel started
> booting, can I?

I haven't tried the firewire thing yet so I can't help you there. But
basically what I'm saying is simply try catching as much output as you
can and send me the whole thing you've caught - maybe that'll suffice.

Thanks.
Hans Mueller - June 18, 2010, 10:50 p.m.
Hi Boris,

I'm afraid I have to play the good answer, bad answer game ...

The good one:
The patch seems to solve the bug, no oops happen. (Tested copying
the file about 10 times). Good! :)

The bad one:
The system hang while shutting down. (happened several times)
The last message on the screen was: "Shutting down the Logical Volume
Manager"


The Kernel log is attached.


Regards Jonas



On Fri, 18 Jun 2010 09:45:10 +0200
Borislav Petkov <bp@alien8.de> wrote:
> 
> Ok, here's another debug/fix patch which should fix your issue. It boots
> fine here but I can't hit your condition so please test it exactly
> the same as yesterday and do catch the _complete_ output again. By
> complete I mean not only the output from the ide-cd driver only but of
> the machine from the very first line after it restarts for it could
> contain valuable information there too.
> 
> Thanks a lot for your effort, here's the patch (you should replace this
> one with the old patch, ask for help if you need any):
> 
> --
> [...]
> -- 
> Regards/Gruss,
>     Boris.

Patch

diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index 64207df..5ccc93d 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -506,15 +506,22 @@  int ide_cd_queue_pc(ide_drive_t *drive, const unsigned char *cmd,
 	return (flags & REQ_FAILED) ? -EIO : 0;
 }
 
-static void ide_cd_error_cmd(ide_drive_t *drive, struct ide_cmd *cmd)
+/*
+ * notify callers that we ended the rq by returning a !0 value
+ */
+static int ide_cd_error_cmd(ide_drive_t *drive, struct ide_cmd *cmd)
 {
 	unsigned int nr_bytes = cmd->nbytes - cmd->nleft;
 
 	if (cmd->tf_flags & IDE_TFLAG_WRITE)
 		nr_bytes -= cmd->last_xfer_len;
 
-	if (nr_bytes > 0)
+	if (nr_bytes > 0) {
 		ide_complete_rq(drive, 0, nr_bytes);
+		return 1;
+	}
+
+	return 0;
 }
 
 static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive)
@@ -552,8 +559,10 @@  static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive)
 	if (!OK_STAT(stat, 0, BAD_R_STAT)) {
 		rc = cdrom_decode_status(drive, stat);
 		if (rc) {
-			if (rc == 2)
+			if (rc == 2) {
+				printk(KERN_EMERG "%s: bad status with a sense rq: %p\n", __func__, rq);
 				goto out_end;
+			}
 			return ide_stopped;
 		}
 	}
@@ -667,8 +676,10 @@  out_end:
 		blk_end_request_all(rq, 0);
 		hwif->rq = NULL;
 	} else {
-		if (sense && uptodate)
+		if (sense && uptodate) {
+			printk(KERN_EMERG "%s: complete failed rq: %p\n", __func__, rq);
 			ide_cd_complete_failed_rq(drive, rq);
+		}
 
 		if (blk_fs_request(rq)) {
 			if (cmd->nleft == 0)
@@ -679,7 +690,10 @@  out_end:
 		}
 
 		if (uptodate == 0 && rq->bio)
-			ide_cd_error_cmd(drive, cmd);
+			if (ide_cd_error_cmd(drive, cmd)) {
+				printk(KERN_EMERG "ide_cd_error_cmd completes rq: %p\n", rq);
+				return ide_stopped;
+			}
 
 		/* make sure it's fully ended */
 		if (blk_fs_request(rq) == 0) {
@@ -688,10 +702,13 @@  out_end:
 				rq->resid_len += cmd->last_xfer_len;
 		}
 
+		printk(KERN_EMERG "%s: completing rq %p\n", __func__, rq);
 		ide_complete_rq(drive, uptodate ? 0 : -EIO, blk_rq_bytes(rq));
 
-		if (sense && rc == 2)
+		if (sense && rc == 2) {
+			printk(KERN_EMERG "%s: request sense failure, rq: %p\n", __func__, rq);
 			ide_error(drive, "request sense failure", stat);
+		}
 	}
 	return ide_stopped;
 }
diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c
index 172ac92..0952e3b 100644
--- a/drivers/ide/ide-io.c
+++ b/drivers/ide/ide-io.c
@@ -57,6 +57,8 @@ 
 int ide_end_rq(ide_drive_t *drive, struct request *rq, int error,
 	       unsigned int nr_bytes)
 {
+	dump_stack();
+
 	/*
 	 * decide whether to reenable DMA -- 3 is a random magic for now,
 	 * if we DMA timeout more than 3 times, just stay in PIO