]> git.sur5r.net Git - bacula/bacula/commitdiff
Fix deadlock with autochanger
authorEric Bollengier <eric@eb.homelinux.org>
Wed, 6 Jul 2011 14:43:42 +0000 (16:43 +0200)
committerEric Bollengier <eric@eb.homelinux.org>
Wed, 6 Jul 2011 14:43:42 +0000 (16:43 +0200)
bacula/src/stored/autochanger.c

index b63a585b18df2dcea3d5559584a97ed5042eb5b0..3d38739f44f7fabe0455006d4791d7f9d964d2a5 100644 (file)
@@ -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();
    }