Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 4 Feb 1998 03:27:58 -0500 (EST)
From:      "Christopher T. Johnson" <cjohnson@neunacht.netgsi.com>
To:        FreeBSD-gnats-submit@FreeBSD.ORG
Subject:   kern/5643: NCR 810/815 do not handle rewind correctly
Message-ID:  <199802040827.DAA00475@neunacht.netgsi.com>

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

>Number:         5643
>Category:       kern
>Synopsis:       NCR 810/815 do not handle rewind correctly
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    freebsd-bugs
>State:          open
>Quarter:
>Keywords:
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Feb  4 00:30:01 PST 1998
>Last-Modified:
>Originator:     Christopher T. Johnson
>Organization:
NetGSI, INC
>Release:        FreeBSD 3.0-CURRENT i386
>Environment:

	

Problem presents itself with both an 810 and 815 SCSI card.  In both
a 486 (AMD X6/133 40MB) and a P166 Dual processor system.  The dual
processor system shows the problem in both uni and multi processor mode.

Problem has been present in CURRENT since atleast Nov 1st 1997.


>Description:

	When the following sequence is executed with an NCR810/815 
	SCSI control card, the second rewind generates an I/O error
	with no message logged.

		open("/dev/nrst0", O_RDONLY);
		rewind via ioctl();
		read(fd, buffer, 32k);
		close(fd);
		open("/dev/nrst0", O_RDWR);
		rewind via ioctl();

	The type drive is an older EXABYTE 8200 and it is more than a
little slow in doing any tape motion.


>How-To-Repeat:
#include <stdio.h>
#include "tapeio.h"
main()
{
	int fd;
	char buffer[32768];
	char bout[32768];
	int flag;

	strcpy(bout,"AMANDA: TAPESTART DATE X TAPE NET004\n");
	fd = tape_open("/dev/nrst0", 0);	/* O_RDONLY */
	if (fd < 0) {
		perror("Tape open");
		exit(1);
	}

	flag = tapefd_rewind(fd);
	if (flag < 0 ) {
		perror("rewind 1");
		exit(2);
	}
	flag = read(fd, buffer, 32768);
	if (flag != 32768) {
		perror("read");
	}

	flag = close(fd);
	if (flag != 0) {
		perror("tape close");
		exit(4);
	}

	fd = tape_open("/dev/nrst0", 2);	/* O_RDWR */
	if (fd < 0) {
		perror("open rdwr");
		exit(4);
	}

	flag = tapefd_rewind(fd);
	if (flag < 0) {
		perror("rewind 2");
		fprintf(stderr,"Trying to rewind a second time\n");
		sleep(5);
		flag = tapefd_rewind(fd);
		if (flag < 0) {
			perror("rewind 3");
		}
	}
	flag = write(fd, bout, 32768);
	if (flag != 32768) {
		perror("write");
		exit(6);
	}
	flag = close(fd);
	if (flag != 0) {
		perror("close 2");
		exit(7);
	}
	exit(0);
}
#include <sys/mtio.h>

int tapefd_rewind(tapefd)
int tapefd;
{
    struct mtop mt;

    mt.mt_op = MTREW;
    mt.mt_count = 1;
    return ioctl(tapefd, MTIOCTOP, &mt);
}
int tape_open(filename, mode)
char *filename;
int mode;
{
    return open(filename, mode);
}

	

>Fix:
	
	

Because of the fact that the work around shows that there is a timing need
I suspect that the ncr code is not waiting for something to settle.

This problem does NOT happen with the same equipment but with an 
Adaptec 1542cp
>Audit-Trail:
>Unformatted:



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