Message ID | 20190809212610.19412-4-mchristi@redhat.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | nbd: cmd timeout fixes | expand |
On Fri, Aug 09, 2019 at 04:26:09PM -0500, Mike Christie wrote: > Fix bug added with the patch: > > commit 8f3ea35929a0806ad1397db99a89ffee0140822a > 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. > > Signed-off-by: Mike Christie <mchristi@redhat.com> Reviewed-by: Josef Bacik <josef@toxicpanda.com> Thanks, Josef
diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c index 131b541d07c3..93294000ce55 100644 --- a/drivers/block/nbd.c +++ b/drivers/block/nbd.c @@ -371,8 +371,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),
Fix bug added with the patch: commit 8f3ea35929a0806ad1397db99a89ffee0140822a 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. Signed-off-by: Mike Christie <mchristi@redhat.com> --- drivers/block/nbd.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)