Re: [PATCH RESEND 2/3 v2.6.39-rc7] block: make disk_block_events()properly wait for work cancellation

From: Tejun Heo
Date: Wed May 18 2011 - 07:07:42 EST


On Wed, May 18, 2011 at 12:04:51PM +0200, Tejun Heo wrote:
> Yeap, the problem was unblock/check being allowed to be called without
> sleeping context, which isn't used anymore and was broken due to
> cancellation race. We can just enclose the whole thing inside per-ev
> mutex and everything should be simple and fine. I'll post patches
> soon.

Oops, spoke too soon. Converting to mutex creates a circular
dependency. disk_block_events() acquires ev->lock and waits for
ev->dwork to finish, but ev->dwork also needs to acquire ev->lock to
update event states. So, no matter how we twist this, we need two
locks or a lock and a completion. The mutex approach seems simple
enough, so I suggest leaving it like that.

Thanks.

--
tejun
--
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/