On Wed, Jul 19, 2017 at 7:04 AM, Shaohua Li <shli@xxxxxxxxxx> wrote: > On Wed, Jul 19, 2017 at 06:51:06AM +0800, Ming Lei wrote: >> On Wed, Jul 19, 2017 at 1:21 AM, Shaohua Li <shli@xxxxxxxxxx> wrote: >> > From: Shaohua Li <shli@xxxxxx> >> > >> > After bio is submitted, we should not clone it as its bi_iter might be >> > invalid by driver. This is the case of behind_master_bio. In certain >> > situration, we could dispatch behind_master_bio immediately for the >> > first disk and then clone it for other disks. >> >> If I understand it correctly, it should be caused by dispatching >> the master bio during the loop either via flushing plug or md_wakeup_thread(). >> >> If so, could we just add the bios into one temp pending list inside >> the loop? Then >> merge the temp list into conf->pending_bio_list after loop and >> schedule to dispatch >> them all? This way looks a bit more efficient. > > that's possible, but narrow_write_error will clone it after we already dispatch > the bio, so I thought it's more clean to just clone one bio. OK, looks fine: Reviewed-by: Ming Lei <ming.lei@xxxxxxxxxx> Thanks, Ming Lei