On 11/20/2015 06:13 AM, Chris Mason wrote: > On Thu, Nov 19, 2015 at 05:49:37PM -0800, Liu Bo wrote: >> while xfstesting, this bug[1] is spotted by both btrfs/061 and btrfs/063, >> so those sub-stripe writes are gatherred into plug callback list and >> hopefully we can have a full stripe writes. >> >> However, while processing these plugged callbacks, it's within an atomic >> context which is provided by blk_sq_make_request() because of a get_cpu() >> in blk_mq_get_ctx(). >> >> This changes to always use btrfs_rmw_helper to complete the pending writes. >> > > Thanks Liu, but MD raid has the same troubles, we're not atomic in our unplugs. > > Jens? Yeah, blk-mq does have preemption disabled when it flushes, for the single queue setup. That's a bug. Attached is an untested patch that should fix it, can you try it? I'll rework this to be a proper patch, not convinced we want to add the new request before flush, that might destroy merging opportunities. I'll unify the mq/sq parts. -- Jens Axboe