Re: [PATCH] block: mq flush: fix race between IPI handler and mq flush worker

From: Ming Lei
Date: Mon May 19 2014 - 23:20:30 EST


On Mon, May 19, 2014 at 11:18 PM, Christoph Hellwig <hch@xxxxxx> wrote:
> On Mon, May 19, 2014 at 11:05:50PM +0800, Ming Lei wrote:
>> Another simple fix is to disable ipi for flush request, but looks
>> this one should be better.
>
> I think the first thing is to bite the bullet and sort out and document
> the various unions in struct request for real.

Considered the problem can be reproduced easily and cause
data loss on kvm-guest, I hope fix can be seen in 3.15. Also
it should be backported to 3.14 because someone may
enable ctx->ipi_redirect.

Thinking it further, looks the patch is fine:

- sizeof(call_single_data) and sizeof(work_struct) is very close
and both are not small, so it is reasonable to put the two in
one union for saving request space

- the conflict on the two structures just happens with flush
requests because rq->requeue_work is only used to queue
flush requests

- in the flush sequence, the conflict won't happen on request
with data, so it only happens with completing and queueing
PREFLUSH/POSTFLUSH request.

Any comments and suggestions?


Thanks,
--
Ming Lei
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/