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: NBen Hutchings <ben@decadent.org.uk> Signed-off-by: NMarkus Pargmann <mpa@pengutronix.de> Reviewed-by: NBen Hutchings <ben@decadent.org.uk> Fixes: 7e2893a1 ("nbd: Fix timeout detection") Signed-off-by: NJens Axboe <axboe@fb.com>
Showing
想要评论请 注册 或 登录