Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 887e975c authored by Mike Christie's avatar Mike Christie Committed by Jens Axboe
Browse files

nbd: add missing config put



Fix bug added with the patch:

commit 8f3ea359
Author: Josef Bacik <josef@toxicpanda.com>
Date:   Mon Jul 16 12:11:35 2018 -0400

    nbd: handle unexpected replies better

where if the timeout handler runs when the completion path is and we fail
to grab the mutex in the timeout handler we will leave a config reference
and cannot free the config later.

Reviewed-by: default avatarJosef Bacik <josef@toxicpanda.com>
Signed-off-by: default avatarMike Christie <mchristi@redhat.com>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 00514677
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -373,8 +373,10 @@ static enum blk_eh_timer_return nbd_xmit_timeout(struct request *req,
	}
	config = nbd->config;

	if (!mutex_trylock(&cmd->lock))
	if (!mutex_trylock(&cmd->lock)) {
		nbd_config_put(nbd);
		return BLK_EH_RESET_TIMER;
	}

	if (config->num_connections > 1) {
		dev_err_ratelimited(nbd_to_dev(nbd),