]> git.sur5r.net Git - bacula/bacula/commitdiff
kes Fix ANSI tape labeling. This fixes bug #954.
authorKern Sibbald <kern@sibbald.com>
Thu, 20 Sep 2007 13:22:04 +0000 (13:22 +0000)
committerKern Sibbald <kern@sibbald.com>
Thu, 20 Sep 2007 13:22:04 +0000 (13:22 +0000)
kes  Increase the max block size to 4MB fixes bug #957.

git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/branches/Branch-2.2@5609 91ce42f0-d328-0410-95d8-f526ca767f89

bacula/patches/2.2.4-ansi-label.patch [new file with mode: 0644]
bacula/src/stored/dev.c
bacula/src/stored/label.c
bacula/technotes-2.1

diff --git a/bacula/patches/2.2.4-ansi-label.patch b/bacula/patches/2.2.4-ansi-label.patch
new file mode 100644 (file)
index 0000000..2be8880
--- /dev/null
@@ -0,0 +1,36 @@
+ This patch fixes bug #954.
+ WEOF on non-appendable error when trying to label a tape with ANSI labels turned on.
+
+ Apply it to version 2.2.4 (possibly earlier versions with):
+
+ cd <bacula-source>
+ patch -p0 <2.2.4-verify.patch
+ ./configure (your options)
+ make
+ ...
+ make install
+
+Index: src/stored/label.c
+===================================================================
+--- src/stored/label.c (revision 5602)
++++ src/stored/label.c (working copy)
+@@ -344,6 +344,9 @@
+       }
+    }
++   /* Temporarily mark in append state to enable writing */
++   dev->set_append();
++
+    /* Create PRE_LABEL or VOL_LABEL if DVD */
+    create_volume_label(dev, VolName, PoolName, dvdnow);
+@@ -364,8 +367,6 @@
+    create_volume_label_record(dcr, dcr->rec);
+    dcr->rec->Stream = 0;
+-   /* Temporarily mark in append state to enable writing */
+-   dev->set_append();
+    if (!write_record_to_block(dcr->block, dcr->rec)) {
+       Dmsg2(130, "Bad Label write on %s: ERR=%s\n", dev->print_name(), dev->print_errmsg());
+       goto bail_out;
index d858e387c528c93579c065fcc234f69c8e8e8b4d..6a5eb392eca36ca0f45c4a74accf65fef0f89440 100644 (file)
@@ -109,6 +109,7 @@ init_dev(JCR *jcr, DEVRES *device)
    int errstat;
    DCR *dcr = NULL;
    DEVICE *dev;
+   uint32_t max_bs;
 
 
    /* If no device type specified, try to guess */
@@ -199,7 +200,17 @@ init_dev(JCR *jcr, DEVRES *device)
       }
    }
 
-   if (dev->max_block_size > 1000000) {
+   /* Sanity check */
+   if (dev->max_block_size == 0) {
+      max_bs = DEFAULT_BLOCK_SIZE;
+   } else {
+      max_bs = dev->max_block_size;
+   }
+   if (dev->min_block_size > max_bs) {
+      Jmsg(jcr, M_ERROR_TERM, 0, _("Min block size > max on device %s\n"), 
+           dev->print_name());
+   }
+   if (dev->max_block_size > 4096000) {
       Jmsg3(jcr, M_ERROR, 0, _("Block size %u on device %s is too large, using default %u\n"),
          dev->max_block_size, dev->print_name(), DEFAULT_BLOCK_SIZE);
       dev->max_block_size = 0;
index 19ca8badcdc1a868c3d4583c8f157f6b83ea83e4..089da8ebbe5713e4224f5794fd5bcdd521b67d88 100644 (file)
@@ -344,6 +344,9 @@ bool write_new_volume_label_to_dev(DCR *dcr, const char *VolName,
       }
    }
 
+   /* Temporarily mark in append state to enable writing */
+   dev->set_append();
+
    /* Create PRE_LABEL or VOL_LABEL if DVD */
    create_volume_label(dev, VolName, PoolName, dvdnow);
 
@@ -364,8 +367,6 @@ bool write_new_volume_label_to_dev(DCR *dcr, const char *VolName,
    create_volume_label_record(dcr, dcr->rec);
    dcr->rec->Stream = 0;
 
-   /* Temporarily mark in append state to enable writing */
-   dev->set_append();
    if (!write_record_to_block(dcr->block, dcr->rec)) {
       Dmsg2(130, "Bad Label write on %s: ERR=%s\n", dev->print_name(), dev->print_errmsg());
       goto bail_out;
index f2e110df42c2ce066237ed33c554458a70ac4160..6cdc15b69fb691f28801f29efd32f397449b6f19 100644 (file)
@@ -2,6 +2,8 @@
 
 General:
 20Sep07
+kes  Fix ANSI tape labeling.  This fixes bug #954.
+kes  Increase the max block size to 4MB fixes bug #957.
 kes  Apply 2.2.4-poll-mount fix, that resolves bug #908 where a tape 
      is not properly mounted (recognized) during a poll.
 kes  Apply 2.2.4-verify patch that resolves bug #958.  A Verify catalog