From 0780c898160fb907afcb6c89b88a3b4324e85345 Mon Sep 17 00:00:00 2001 From: Eric Bollengier Date: Wed, 6 Jul 2011 16:43:42 +0200 Subject: [PATCH] Fix deadlock with autochanger --- bacula/src/stored/autochanger.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/bacula/src/stored/autochanger.c b/bacula/src/stored/autochanger.c index b63a585b18..3d38739f44 100644 --- a/bacula/src/stored/autochanger.c +++ b/bacula/src/stored/autochanger.c @@ -405,10 +405,14 @@ bool unload_autochanger(DCR *dcr, int loaded) dev->set_slot(0); /* nothing loaded */ } - free_volume(dev); /* Free any volume associated with this drive */ free_pool_memory(changer); } unlock_changer(dcr); + + if (loaded > 0) { /* free_volume outside from changer lock */ + free_volume(dev); /* Free any volume associated with this drive */ + } + if (ok) { dev->clear_unload(); } -- 2.39.5