On Thu of July 4 2013, Radosław Korzeniewski wrote:
> Maybe it will be a simpler and most efficient approach for Bacula community
> to handle this (not so broken) lin_tape different behavior then force to
> fix this driver.
Fixing the driver would be a good idea, that's for certain. Returning an EIO
isn't exactly optimal behavior. I'll see if I can figure out how to fill a bug
with IBM (though anyone else is free to beat me to it :), though I wouldn't
hold my breath.
> Maybe we can add a configuration parameter to the Device
> resource which will handle this. It should not break current Bacula code
> (default will be a standard way) and allow smooth integration with
> lin_tape. What do you think about it?
Irrrespective of whether IBM fixes the driver upstream, it'd be useful for
bacula to at least give an option of being usable on current IBM hardware with
currenct software. I've attached a patch I'm using for this. (Part one at
least. Part two does ibm-specific error detection, so it's non-mergable. I'll
send it later, maybe it'll be useful to some people.)
What it's missing to be considering for inclusion:
1. Doc entries (with clear indication that there are some minor theoretical
risks involved with using it).
2. Code for btape to actually detect that a driver has this behavior and
suggest using this option.
Kern, would this be acceptable?
Also a technical suggestion for listadmin: since this list is subscribe-only
and non-subscribers can't email something in, I don't think it makes much
sense for it to CC: all recipents on each email.
--mmazur
diff -urN bacula-5.2.13.orig/src/stored/dev.h bacula-5.2.13/src/stored/dev.h
--- bacula-5.2.13.orig/src/stored/dev.h 2013-02-19 20:21:35.000000000 +0100
+++ bacula-5.2.13/src/stored/dev.h 2013-07-02 17:19:42.357413157 +0200
@@ -135,6 +135,7 @@
#define CAP_REQMOUNT (1<<21) /* Require mount/unmount */
#define CAP_CHECKLABELS (1<<22) /* Check for ANSI/IBM labels */
#define CAP_BLOCKCHECKSUM (1<<23) /* Create/test block checksum */
+#define CAP_IOERRATEOM (1<<24) /* IOError at EOM */
/* Test state */
#define dev_state(dev, st_state) ((dev)->state & (st_state))
diff -urN bacula-5.2.13.orig/src/stored/stored_conf.c bacula-5.2.13/src/stored/stored_conf.c
--- bacula-5.2.13.orig/src/stored/stored_conf.c 2013-02-19 20:21:35.000000000 +0100
+++ bacula-5.2.13/src/stored/stored_conf.c 2013-07-02 17:20:11.445744915 +0200
@@ -124,6 +124,7 @@
{"backwardspacerecord", store_bit, ITEM(res_dev.cap_bits), CAP_BSR, ITEM_DEFAULT, 1},
{"backwardspacefile", store_bit, ITEM(res_dev.cap_bits), CAP_BSF, ITEM_DEFAULT, 1},
{"bsfateom", store_bit, ITEM(res_dev.cap_bits), CAP_BSFATEOM, ITEM_DEFAULT, 0},
+ {"ioerrorateom", store_bit, ITEM(res_dev.cap_bits), CAP_IOERRATEOM, ITEM_DEFAULT, 0},
{"twoeof", store_bit, ITEM(res_dev.cap_bits), CAP_TWOEOF, ITEM_DEFAULT, 0},
{"forwardspacerecord", store_bit, ITEM(res_dev.cap_bits), CAP_FSR, ITEM_DEFAULT, 1},
{"forwardspacefile", store_bit, ITEM(res_dev.cap_bits), CAP_FSF, ITEM_DEFAULT, 1},
--- bacula-5.2.13.orig/src/stored/dev.c 2013-02-19 20:21:35.000000000 +0100
+++ bacula-5.2.13/src/stored/dev.c 2013-07-04 14:05:56.553769593 +0200
@@ -1193,10 +1193,18 @@
if (errno == ENOMEM) { /* tape record exceeds buf len */
stat = rbuf_len; /* This is OK */
/*
- * On IBM drives, they return ENOSPC at EOM
+ * Old IBM drivers return ENOSPC at EOM
* instead of EOF status
*/
} else if (at_eof() && errno == ENOSPC) {
+ Dmsg0(100, "Got ENOSPC on read, assuming that's due to EOD\n");
+ stat = 0;
+ /*
+ * Some drivers (like IBM's lin_tape) return EIO
+ * at EOM instead of EOF
+ */
+ } else if (has_cap(CAP_IOERRATEOM) && at_eof() && errno == EIO) {
+ Dmsg0(100, "Got EIO on read, assuming that's due to EOD\n");
stat = 0;
} else {
berrno be;
------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:
Build for Windows Store.
http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
Bacula-devel mailing list
Bacula-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-devel