]> git.sur5r.net Git - bacula/bacula/commitdiff
Fix bug when recycling DVD devices (append flag was removed).
authorNicolas Boichat <nicolas@boichat.ch>
Mon, 17 Oct 2005 23:15:05 +0000 (23:15 +0000)
committerNicolas Boichat <nicolas@boichat.ch>
Mon, 17 Oct 2005 23:15:05 +0000 (23:15 +0000)
git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@2459 91ce42f0-d328-0410-95d8-f526ca767f89

bacula/nb-1.37
bacula/src/stored/dev.c
bacula/src/stored/dvd.c

index 291ed0d1904a1308abc42de106abcb9b144ffd7c..e87982883771462830a7f0316b4a4262fc65014e 100644 (file)
@@ -4,10 +4,12 @@
 General:
 
 Changes to 1.37.*:
-16Oct05
+17Oct05
+ - Fix bug when recycling DVD devices (append flag was removed).
  - Add tests for dvd+rw-format in configure script.
  - scripts/dvd-handler: Reformat DVD-RW when needed. This needs dvd+rw-format.
  - Add patch for dvd+rw-tools in patches dir (this should probably be elsewhere).
+16Oct05
  - Remove scripts/dvd-freespace and scripts/dvd-writepart, as they are now
    merged into scripts/dvd-handler. Note: Documentation needs to be updated.
  - scripts/dvd-handler: "zero" brand-new DVD+/-RW to fix a problem with some
index 14c3d393550bc34361dfa5542458c62de8239f76..b01c6703832aa9026432f799a4c7e6b40f39ad93 100644 (file)
@@ -523,6 +523,7 @@ void DEVICE::open_dvd_device(DCR *dcr, int omode)
          if (!check_can_write_on_non_blank_dvd(dcr)) {
             Mmsg(errmsg, _("The media in the device %s is not empty, please blank it before writing anything to it.\n"), print_name());
             Emsg0(M_FATAL, 0, errmsg);
+            unmount_dev(this, 1); /* Unmount the device, so the operator can change it. */
             fd = -1;
             return;
          }
index af5ca1318b5b4cc2ee48430ed174db23dc409534..54ee86634727a9011a7f6e358222928a417373ca 100644 (file)
@@ -209,7 +209,7 @@ get_out:
    
    dev->set_mounted(mount);              /* set/clear mounted flag */
    free_pool_memory(results);
-   /* Do not check free space when unmounting (otherwise it will mount it again) */
+   /* Do not check free space when unmounting */
    if (mount) {
       update_free_space_dev(dev);
    }
@@ -505,8 +505,8 @@ int dvd_open_first_part(DCR *dcr, int mode)
 {
    DEVICE *dev = dcr->dev;
 
-   Dmsg4(29, "Enter: ==== open_first_part dev=%s Vol=%s mode=%d num_parts=%d\n", dev->print_name(), 
-         dev->VolCatInfo.VolCatName, dev->openmode, dev->num_parts);
+   Dmsg5(29, "Enter: ==== open_first_part dev=%s Vol=%s mode=%d num_parts=%d append=%d\n", dev->print_name(), 
+         dev->VolCatInfo.VolCatName, dev->openmode, dev->num_parts, dev->can_append());
 
    if (dev->fd >= 0) {
       close(dev->fd);
@@ -519,11 +519,16 @@ int dvd_open_first_part(DCR *dcr, int mode)
    
    Dmsg2(50, "Call dev->open(vol=%s, mode=%d)\n", dcr->VolCatInfo.VolCatName, 
          mode);
+   int append = dev->can_append();
    if (dev->open(dcr, mode) < 0) {
       Dmsg0(50, "open dev() failed\n");
       return -1;
    }
-   Dmsg1(50, "Leave open_first_part state=%s\n", dev->is_open()?"open":"not open");
+   if (append && (dev->part == dev->num_parts)) { /* If needed, set the append flag back */
+      dev->set_append();
+   }
+   Dmsg2(50, "Leave open_first_part state=%s append=%d\n", dev->is_open()?"open":"not open", dev->can_append());
+   
    return dev->fd;
 }