Commit dcc909d9 authored by Markus Pargmann's avatar Markus Pargmann Committed by Jens Axboe
Browse files

nbd: Add locking for tasks

The timeout handling introduced in
	7e2893a1

 (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: default avatarBen Hutchings <ben@decadent.org.uk>
Signed-off-by: default avatarMarkus Pargmann <mpa@pengutronix.de>
Reviewed-by: default avatarBen Hutchings <ben@decadent.org.uk>
Fixes: 7e2893a1

 ("nbd: Fix timeout detection")
Signed-off-by: default avatarJens Axboe <axboe@fb.com>
parent c3984cc9
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment