Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
For bugs related to Red Hat Enterprise Linux 3 product line. The current stable release is 3.9. For Red Hat Enterprise Linux 6 and above, please visit Red Hat JIRA https://issues.redhat.com/secure/CreateIssue!default.jspa?pid=12332745 to report new issues.

Bug 253613

Summary: cpio: Fails to read table of contents from tape that spans multiple medium
Product: Red Hat Enterprise Linux 3 Reporter: David Milburn <dmilburn>
Component: cpioAssignee: Ondrej Vasik <ovasik>
Status: CLOSED NEXTRELEASE QA Contact: Brock Organ <borgan>
Severity: medium Docs Contact:
Priority: medium    
Version: 3.0CC: ovasik, tao
Target Milestone: ---   
Target Release: ---   
Hardware: i686   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2008-05-28 05:29:30 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
untested patch none

Description David Milburn 2007-08-20 21:21:02 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.12) Gecko/20050922 Fedora/1.0.7-1.1.fc3 Firefox/1.0.7

Description of problem:
Cannot use cpio to read backup sets that span multiple tapes.

Version-Release number of selected component (if applicable):
cpio-2.5-4.RHEL3

How reproducible:
Always


Steps to Reproduce:
1. Insert media in tape drive
2. mt -f /dev/nst0 rewind
3. mt -f /dev/nst0 setblk 0
4. mt -f /dev/nst0 defblksize 0
5. /bin/cpio -ocvC 32768 --force-local -M Tape_Change_Request < /tmp/longlist -F /dev/nst0
6. First tape hits end of media and is ejected, insert second tape
7. mt -f /dev/nst0 rewind
8. mt -f /dev/nst0 setblk 0
9. mt -f /dev/nst0 defblksize 0
10. Complete backup, eject second tape.
11. Put first media back in tape drive to read table of contents
12. /bin/cpio -tC 32768 -M Tape_Change_Request -F /dev/nst0

Failure when you reach the end of the first tape when reading table of contents:
/bin/cpio: read error: Input/output error



Actual Results:
Reproduced on this hardware

SCSI storage controller: Adaptec AHA-2940U/UW/D / AIC-7881U (rev 01)
Host: scsi0 Channel: 00 Id: 05 Lun: 00
  Vendor: COMPAQ   Model: SuperDLT1        Rev: 4B4B
  Type:   Sequential-Access                ANSI SCSI revision: 02

Turning debugging on in st.c driver shows the following:

========Backup hits the end of first tape===================
st0: Error: 8000002, cmd: a 0 0 80 0 0 Len: 32768
Info fld=0x0, EOM Current st09:00: sense key None
Additional sense indicates End-of-partition/medium detected
st0: Async write error (write) 7fffffff.
st0: Unloading tape.
============================================================

At this point cpio has not written a filemark at the end of the tape.

========Read hits the end of the first tape================
st0: Error: 8000002, cmd: 8 0 0 80 0 0 Len: 32768
Info fld=0x8000, Current st09:00: sense key Blank Check
Additional sense indicates End-of-data detected
st0: Sense: f0  0  8  0  0 80  0 16
===========================================================

At this point st hits end of data instead of filemark, cpio fails with I/O error.

/bin/cpio: read error: Input/output error


Expected Results:
Expect cpio to read a backup set that spans multiple tapes.

Additional info:
This has also been reproduced with this hardware:

SCSI storage controller: LSI Logic / Symbios Logic 53c1030 PCI-X Fusion-MPT Dual Ultra320 SCSI (rev 07)
Host: scsi0 Channel: 00 Id: 01 Lun: 00
  Vendor: HP       Model: Ultrium 2-SCSI   Rev: F43W
  Type:   Sequential-Access                ANSI SCSI revision: 03

========Backup hits the end of first tape===================
kernel: st0: Error: 28000002, cmd: a 0 0 80 0 0 Len: 32768
kernel: Info fld=0x8000, Deferred st09:00: sense key Medium Error
kernel: Additional sense indicates Write error
kernel: st0: Async write error (write) 28000002.
kernel: st0: Unloading tape.
============================================================

At this point cpio has not written a filemark at the end of the tape.

========Read hits the end of the first tape================
kernel: st0: Error: 28000002, cmd: 8 0 0 80 0 0 Len: 32768
kernel: Info fld=0x175, Current st09:00: sense key Medium Error
kernel: Additional sense indicates Recorded entity not found
kernel: st0: Sense: f0  0  3  0  0  1 75  e
========Read hits the end of first tape===================

/bin/cpio: read error: Input/output error

Comment 6 Radek Brich 2007-09-07 10:24:36 UTC
Created attachment 189681 [details]
untested patch

updated source package can be downloaded here:
http://rbrich.fedorapeople.org/cpio-2.5-5.1.RHEL3.src.rpm