nbd: protect cmd->status with cmd->lock
authorJosef Bacik <josef@toxicpanda.com>
Mon, 21 Oct 2019 19:56:27 +0000 (15:56 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 10 Nov 2019 10:27:34 +0000 (11:27 +0100)
commit82b7c99ee1410a50b52283f4b80dca31fa7591b6
tree0ef8d47606ed84cf2d699c8059c9416f46b2cc1b
parent80b42f4381c25021cf6d3ca73eb0540c265018b7
nbd: protect cmd->status with cmd->lock

[ Upstream commit de6346ecbc8f5591ebd6c44ac164e8b8671d71d7 ]

We already do this for the most part, except in timeout and clear_req.
For the timeout case we take the lock after we grab a ref on the config,
but that isn't really necessary because we're safe to touch the cmd at
this point, so just move the order around.

For the clear_req cause this is initiated by the user, so again is safe.

Reviewed-by: Mike Christie <mchristi@redhat.com>
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/block/nbd.c