Comment 123 for bug 1505564

Revision history for this message
Rafael David Tinoco (rafaeldtinoco) wrote :

Note to self:

The commit being backported to 3.19 and 3.13 has to contain this race fix:

commit dcc909d90ccdbb73226397ff6d298f7af35b0e11
Author: Markus Pargmann <email address hidden>
Date: Tue Oct 6 20:03:54 2015 +0200

    nbd: Add locking for tasks

    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 <email address hidden>
    Signed-off-by: Markus Pargmann <email address hidden>
    Reviewed-by: Ben Hutchings <email address hidden>
    Fixes: 7e2893a16d3e ("nbd: Fix timeout detection")
    Signed-off-by: Jens Axboe <email address hidden>

Also.