Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 9 Sep 2003 21:02:05 -0500 (CDT)
From:      Jeremy McMillan <aphor@aphor.net>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   kern/56664: bad file# in MTIO status buffer after MTEOD until MTREW
Message-ID:  <200309100202.h8A225CK068596@horizon.aphor.net>
Resent-Message-ID: <200309100210.h8A2AEZU018744@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         56664
>Category:       kern
>Synopsis:       bad file# in MTIO status buffer after MTEOD until MTREW
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Sep 09 19:10:13 PDT 2003
>Closed-Date:
>Last-Modified:
>Originator:     Jeremy McMillan
>Release:        FreeBSD 4.8-RC i386
>Organization:
>Environment:
System: FreeBSD horizon.aphor.net 4.8-RC FreeBSD 4.8-RC #1: Tue Mar 4 21:42:48 CST 2003 root@nell.notrecords.com:/obj/usr/usr/src/sys/SD11K7 i386
sa0 at ahc0 bus 0 target 4 lun 0
sa0: <SUN DLT7000 245F> Removable Sequential Access SCSI-2 device
sa0: 20.000MB/s transfers (10.000MHz, offset 8, 16bit)

>Description:
MTIO fails to report the actual file and record position in
mtget.mt_fileno after executing the MTEOD command. Breaks bacula port.
>How-To-Repeat:
Rewind your DLTIV tape.
use this C program to inspect the tape IO status buffer of the /dev/nrsa0
(asuming you have only a single DLTIV tape drive) after using mt(1) to 'fsf'
and 'bsf' around from file to file on your tape. Then use mt(1) to 'eod' and
see where the status buffer says you are. You can 'fsf' and 'bsf' around, but
the status buffer reports file number -1 and block number -1 until you rewind.
---cut---
/*
mtstat: print the contents of the mtget struct for human eyes after getting
status from a device
*/
#include sys/mtio.h 
#include fcntl.h 
#include stdio.h
#include stdlib.h
void st_status (struct mtget);

int main(int argc,char *argv[])
{
	int mtfd;
	char *tape;
	struct mtget mt_status;
	if (argc!=2)
		{printf("Usage:\n\t%s /dev/nrsa#\n",argv[0]);exit(1);}
	else
		{
			tape = argv[1];
			if ((mtfd = open(tape, O_RDONLY)) < 0)
				err(1, "%s", tape);
			if (ioctl(mtfd, MTIOCGET, &mt_status) < 0)
				err(1, NULL);
			printf(
					"%s location:\tFile=%d\tBlock=%d\n",
					tape,
					(int)mt_status.mt_fileno,
					(int)mt_status.mt_blkno
				);
		}
	exit(0);
}
---cut---

>Fix:
	


>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200309100202.h8A225CK068596>