Re: [PATCH] nbd: Add locking for tasks

From: Jens Axboe
Date: Thu Oct 08 2015 - 16:22:05 EST


On 10/08/2015 02:14 PM, Ben Hutchings wrote:
On Tue, 2015-10-06 at 20:03 +0200, Markus Pargmann wrote:
The timeout handling introduced in
> 7e2893a16d3e (nbd: Fix timeout detection)
introduces a race condition which may lead to killing of tasks that are
not in nbd context anymore. This was not observed or reproducable yet.

This patch adds locking to critical use of task_recv and task_send to
avoid killing tasks that already left the NBD thread functions. This
lock is only acquired if a timeout occures or the nbd device
starts/stops.

Reported-by: Ben Hutchings <ben@xxxxxxxxxxxxxxx>
Signed-off-by: Markus Pargmann <mpa@xxxxxxxxxxxxxx>

Reviewed-by: Ben Hutchings <ben@xxxxxxxxxxxxxxx>

You could add 'Fixes: 7e2893a16d3e ("nbd: Fix timeout detection")' to
the commit message as well.

I've added your review and the Fixes and added it for this series. Thanks guys.

--
Jens Axboe

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