From: Eric Bollengier Date: Wed, 6 Jul 2011 14:43:42 +0000 (+0200) Subject: Fix deadlock with autochanger X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=38b53b4eced06e0b6584f1c2cb3f19a3833f4013;p=bacula%2Fbacula Fix deadlock with autochanger --- 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(); }