Re: [bug] block subsystem related crash with latest -git

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Jens Axboe <jens.axboe@...>
Cc: Ingo Molnar <mingo@...>, <linux-kernel@...>, Andrew Morton <akpm@...>
Date: Wednesday, October 17, 2007 - 1:52 pm

On Wed, 17 Oct 2007, Jens Axboe wrote:

I really don't think this should work.

Doing "sg_next()" on a valid sg is *always* ok. So if the old code didn't 
work, then "sg" wasn't valid to start with (and the code *after* the 
sg_next() would have oopsed even if you try to avoid using sg_next.

So avoiding the "sg_next()" on the last entry is pointless. 

Also, your patch makes the code almost totally unreadable, with that 
subtle issue of the "if (bvprv && cluster)" case not triggering on the 
first case, so the NULL initial sg is "safe".

So at a guess, I think the *real* problem is simply that the passed-in 
sglist was just too small. What guarantees that the sg list allocation 
(apparently done by scsi_alloc_sgtable()) is big enough? 

If I read things right, scsi_alloc_sgtable() will allocate "cmd->use_sg" 
SG enties, no? But I also notice that it does not seem to initialize the 
SG allocation, so those SG entries contain random crap - including, 
perhaps, a random - and bogus - chain pointer in sg->page..

Yes, we set sh->page *if* we create a chain, but if we don't chain, we 
leave the old random contents around which in turn may include old and 
stale chain pointers. Or am I missing something?

So when you added that "memset(sg, 0, sizeof(*sg))" into blk_rq_map_sg(), 
you did it way too late - it needs to be done when the sg chain is 
allocated, and for every entry (and then the "link" entry needs to be 
linked in separately)

I think.

		Linus

-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[bug] block subsystem related crash with latest -git, Ingo Molnar, (Wed Oct 17, 11:46 am)
Re: [bug] block subsystem related crash with latest -git, Linus Torvalds, (Wed Oct 17, 12:50 pm)
Re: [bug] block subsystem related crash with latest -git, Linus Torvalds, (Wed Oct 17, 1:52 pm)
Re: [bug] block subsystem related crash with latest -git, Linus Torvalds, (Wed Oct 17, 2:18 pm)
Re: [bug] block subsystem related crash with latest -git, Linus Torvalds, (Wed Oct 17, 2:22 pm)
Re: [bug] block subsystem related crash with latest -git, Linus Torvalds, (Wed Oct 17, 1:56 pm)
Re: [bug] block subsystem related crash with latest -git, Linus Torvalds, (Wed Oct 17, 2:14 pm)
Re: [bug] block subsystem related crash with latest -git, Linus Torvalds, (Wed Oct 17, 2:13 pm)
Re: [bug] block subsystem related crash with latest -git, Linus Torvalds, (Wed Oct 17, 2:58 pm)
Re: [bug] block subsystem related crash with latest -git, Linus Torvalds, (Wed Oct 17, 3:15 pm)
Re: [bug] block subsystem related crash with latest -git, Luca Tettamanti, (Wed Oct 17, 4:15 pm)
[bug] ata subsystem related crash with latest -git, Ingo Molnar, (Wed Oct 17, 1:45 pm)
Re: [bug] ata subsystem related crash with latest -git, Linus Torvalds, (Wed Oct 17, 2:08 pm)
Re: [bug] ata subsystem related crash with latest -git, Ingo Molnar, (Wed Oct 17, 2:13 pm)
Re: [bug] ata subsystem related crash with latest -git, Ingo Molnar, (Wed Oct 17, 3:09 pm)
Re: [bug] ata subsystem related crash with latest -git, Linus Torvalds, (Wed Oct 17, 3:28 pm)
Re: [bug] ata subsystem related crash with latest -git, Linus Torvalds, (Wed Oct 17, 3:42 pm)
Re: [bug] ata subsystem related crash with latest -git, Linus Torvalds, (Wed Oct 17, 3:45 pm)
Re: [bug] ata subsystem related crash with latest -git, Linus Torvalds, (Wed Oct 17, 4:24 pm)
Re: [bug] ata subsystem related crash with latest -git, Linus Torvalds, (Wed Oct 17, 5:11 pm)
Re: [bug] ata subsystem related crash with latest -git, FUJITA Tomonori, (Wed Oct 17, 7:00 pm)
Re: [bug] ata subsystem related crash with latest -git, Linus Torvalds, (Wed Oct 17, 9:07 pm)
Re: [bug] ata subsystem related crash with latest -git, Jeff Garzik, (Wed Oct 17, 9:14 pm)
Re: [bug] ata subsystem related crash with latest -git, David Miller, (Wed Oct 17, 9:19 pm)
Re: [bug] ata subsystem related crash with latest -git, Linus Torvalds, (Wed Oct 17, 9:36 pm)
Re: [bug] ata subsystem related crash with latest -git, Linus Torvalds, (Thu Oct 18, 12:01 am)
Re: [bug] ata subsystem related crash with latest -git, Jeff Garzik, (Thu Oct 18, 1:45 am)
Re: [bug] ata subsystem related crash with latest -git, Jeff Garzik, (Thu Oct 18, 3:30 am)
Re: [bug] ata subsystem related crash with latest -git, Linus Torvalds, (Thu Oct 18, 12:20 am)
Re: [bug] ata subsystem related crash with latest -git, Linus Torvalds, (Thu Oct 18, 12:45 am)
Re: [bug] ata subsystem related crash with latest -git, Jeff Garzik, (Thu Oct 18, 12:31 am)
Re: [bug] ata subsystem related crash with latest -git, Linus Torvalds, (Thu Oct 18, 12:53 am)
Re: [bug] ata subsystem related crash with latest -git, Jens Axboe, (Thu Oct 18, 10:04 am)
Re: [bug] ata subsystem related crash with latest -git, Jeff Garzik, (Thu Oct 18, 12:14 am)
Re: [bug] ata subsystem related crash with latest -git, David Miller, (Wed Oct 17, 9:49 pm)
Re: [bug] ata subsystem related crash with latest -git, Linus Torvalds, (Thu Oct 18, 12:55 pm)
Re: [bug] ata subsystem related crash with latest -git, Jeff Garzik, (Thu Oct 18, 3:20 pm)
Re: [bug] ata subsystem related crash with latest -git, Arjan van de Ven, (Thu Oct 18, 1:10 pm)
Re: [bug] ata subsystem related crash with latest -git, FUJITA Tomonori, (Fri Oct 19, 4:59 am)
Re: [bug] ata subsystem related crash with latest -git, David Miller, (Thu Oct 18, 7:55 am)
Re: [bug] ata subsystem related crash with latest -git, David Miller, (Thu Oct 18, 8:05 am)
Re: [bug] ata subsystem related crash with latest -git, Jens Axboe, (Thu Oct 18, 10:14 am)
Re: [bug] ata subsystem related crash with latest -git, Benny Halevy, (Thu Oct 18, 9:49 am)
Re: [bug] ata subsystem related crash with latest -git, Benny Halevy, (Thu Oct 18, 8:58 am)
Re: [bug] ata subsystem related crash with latest -git, Jens Axboe, (Thu Oct 18, 10:05 am)
Re: [bug] ata subsystem related crash with latest -git, Benny Halevy, (Thu Oct 18, 10:16 am)
Re: [bug] ata subsystem related crash with latest -git, Jens Axboe, (Thu Oct 18, 10:38 am)
Re: [bug] ata subsystem related crash with latest -git, Olof Johansson, (Thu Oct 18, 10:58 am)
Re: [bug] ata subsystem related crash with latest -git, Jens Axboe, (Thu Oct 18, 11:25 am)
Re: [bug] ata subsystem related crash with latest -git, David Miller, (Thu Oct 18, 8:36 am)
Re: [bug] ata subsystem related crash with latest -git, Ingo Molnar, (Wed Oct 17, 4:51 pm)
Re: [bug] ata subsystem related crash with latest -git, Ingo Molnar, (Thu Oct 18, 3:07 am)
Re: [bug] ata subsystem related crash with latest -git, Jeff Garzik, (Thu Oct 18, 4:22 am)
Re: [bug] ata subsystem related crash with latest -git, Torsten Kaiser, (Sat Oct 20, 7:55 am)
Re: [bug] ata subsystem related crash with latest -git, Jeff Garzik, (Thu Oct 18, 5:01 am)
Re: [bug] ata subsystem related crash with latest -git, Jeff Garzik, (Thu Oct 18, 5:32 am)
Re: [bug] ata subsystem related crash with latest -git, Jeff Garzik, (Thu Oct 18, 6:04 am)
Re: [bug] ata subsystem related crash with latest -git, Ingo Molnar, (Thu Oct 18, 6:13 am)
Re: [bug] ata subsystem related crash with latest -git, Ingo Molnar, (Thu Oct 18, 6:49 am)
Re: [bug] ata subsystem related crash with latest -git, Jeff Garzik, (Thu Oct 18, 6:50 am)
Re: [bug] ata subsystem related crash with latest -git, Jeff Garzik, (Thu Oct 18, 4:38 am)
Re: [bug] ata subsystem related crash with latest -git, Jeff Garzik, (Thu Oct 18, 4:51 am)
Re: [bug] ata subsystem related crash with latest -git, Ingo Molnar, (Thu Oct 18, 7:03 am)
Re: [bug] ata subsystem related crash with latest -git, Linus Torvalds, (Wed Oct 17, 4:10 pm)
Re: [bug] ata subsystem related crash with latest -git, Ingo Molnar, (Wed Oct 17, 4:05 pm)
Re: [bug] ata subsystem related crash with latest -git, Ingo Molnar, (Wed Oct 17, 3:04 pm)
Re: [bug] ata subsystem related crash with latest -git, Ingo Molnar, (Wed Oct 17, 3:14 pm)
Re: [bug] ata subsystem related crash with latest -git, Ingo Molnar, (Wed Oct 17, 3:17 pm)
Re: [bug] ata subsystem related crash with latest -git, Ingo Molnar, (Wed Oct 17, 1:58 pm)