On Thu, Mar 09 2017, Shaohua Li wrote: > On Fri, Mar 10, 2017 at 11:51:09AM +1100, Neil Brown wrote: >> On Thu, Mar 09 2017, Shaohua Li wrote: .... >> > I think it's ok to add this part into bitmap_destroy, as we need to call >> > bitmap_destroy before mddev_detach. Look at the usage of mddev_detach, at in >> > one place (level_store()), we wait for the IO without bitmap_destroy. I think >> > we should keep this part code in mddev_detach. Maybe create a small function, >> > let both mddev_detach and bitmap_destroy call it. >> >> I don't think level_store() needs to explicitly wait for behind io. >> It calls mddev_suspend(), which calls the ->quiesce function in the >> personality, which is responsible for waiting for all pending IO, >> including behind. raid1.c does this correctly. > > Can you elaborate Where >quiesce waits for behind IO in raid1? It's not > obvious. It really should though. Ahh - you are correct. allow_barrier() is called by call_bio_endio(), which can be called before behind-writes complete. My bi_phys_segments series actually fixed that, by counting every write request in nr_pending so that nr_pending wouldn't drop to zero until all the writes had completed. We should probably come up with a simple fix for -stable. Unfortunately it doesn't look at all easy. I'll revisit my bi_phys_segments series next week and try to sort out the best way to fix this issue. NeilBrown
Attachment:
signature.asc
Description: PGP signature