On Tue, Dec 20 2016, Jinpu Wang wrote: > Hi Neil, >> This is the problem. 'hold' hasn't been initialised. >> We could either do: >> bio_list_init(&hold); >> bio_list_merge(&hold, &bio_list_on_stack); > I tried above variant first and it lead to panic in endio path: > ... > > [exception RIP: bio_check_pages_dirty+65] I can't explain that at all. Maybe if I saw the complete patch I would be able to see what went wrong (or maybe there is a separate cause). >> >> You didn't find 'hold' to be necessary in your testing, but I think that >> is more complex arrangements it could make an important difference. > > Could you elaborate a bit more, from my understanding, in later code, > we pop all bio from bio_list_on_stack, > add it to either "lower" or "same" bio_list, so merge both will have > the whole list again, right? If there are several bios on bio_list_on_stack, and if processing the first one causes several calls to generic_make_request(), then we want all the bios passed to generic_make_request() to be handled *before* the remaining bios that were originally on bio_list_on_stack. Of these new bios, we want to handle those for a lower level device first, and those for the same device after that. Only when all of those have been completely submitted (together with any subordinate bios submitted to generic_make_request()) do we move on to the rest of bio_list_on_stack (which are at the same level as the first bio, or higher in the device stack). The usage of 'hold' would become important when you have multiple levels. e.g. dm on md on scsi. If the first bio send to dm is split, then the first half needs to be processed all the way down to all the scsi devices, before the second half of the split is handled. Hope that helps, NeilBrown
Attachment:
signature.asc
Description: PGP signature