From nobody@FreeBSD.ORG  Tue Oct  3 02:30:09 2000
Return-Path: <nobody@FreeBSD.ORG>
Received: by hub.freebsd.org (Postfix, from userid 32767)
	id CEF7637B503; Tue,  3 Oct 2000 02:30:09 -0700 (PDT)
Message-Id: <20001003093009.CEF7637B503@hub.freebsd.org>
Date: Tue,  3 Oct 2000 02:30:09 -0700 (PDT)
From: razuwaev@relex.ru
Sender: nobody@FreeBSD.ORG
To: freebsd-gnats-submit@FreeBSD.org
Subject: sa device driver bug
X-Send-Pr-Version: www-1.0

>Number:         21723
>Category:       kern
>Synopsis:       sa device driver bug
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Oct 03 02:40:00 PDT 2000
>Closed-Date:    Thu Oct 5 10:03:58 PDT 2000
>Last-Modified:  Thu Oct 05 10:04:16 PDT 2000
>Originator:     Andrew
>Release:        4.1-STABLE
>Organization:
Relex, Ltd.
>Environment:
FreeBSD p227.relex.ru 4.1-STABLE 
FreeBSD 4.1-STABLE #12: Mon Sep 25 15:50:49 MSD 2000
amass@p227.relex.ru:/usr/src/sys/compile/KERNEL-A  i386
>Description:
f=open("/dev/nrsa0",O_RDWR);
write(f, buf, size);
ioctl(fd, MTIOCRDSPOS, &offs); 
This sequence hangs up the task on waiting disk operation.
Driver waits for awake on sys/cam/cam_periph.c : cam_periph_getccb() on
tsleep(&periph->ccb_list, PRIBIO, "cgticb", 0);

>How-To-Repeat:
f=open("/dev/nrsa0",O_RDWR);
write(f, buf, size);
ioctl(fd, MTIOCRDSPOS, &offs); 

>Fix:
This problem is fixed by replace :
ccb = cam_periph_getccb(periph, 1); 
if (softc->flags & SA_FLAG_TAPE_WRITTEN) {
	error = sawritefilemarks(periph, 0, 0);
	if (error && error != EACCES)
		return (error);
}
to :
if (softc->flags & SA_FLAG_TAPE_WRITTEN) {
	error = sawritefilemarks(periph, 0, 0);
	if (error && error != EACCES)
		return (error);
}
ccb = cam_periph_getccb(periph, 1);



>Release-Note:
>Audit-Trail:

From: Matthew Jacob <mjacob@feral.com>
To: razuwaev@relex.ru
Cc: freebsd-gnats-submit@FreeBSD.ORG
Subject: Re: kern/21723: sa device driver bug
Date: Tue, 3 Oct 2000 08:08:01 -0700 (PDT)

 Good spotting, thanks...
 
 
 On Tue, 3 Oct 2000 razuwaev@relex.ru wrote:
 
 > 
 > >Number:         21723
 > >Category:       kern
 > >Synopsis:       sa device driver bug
 > >Confidential:   no
 > >Severity:       non-critical
 > >Priority:       low
 > >Responsible:    freebsd-bugs
 > >State:          open
 > >Quarter:        
 > >Keywords:       
 > >Date-Required:
 > >Class:          sw-bug
 > >Submitter-Id:   current-users
 > >Arrival-Date:   Tue Oct 03 02:40:00 PDT 2000
 > >Closed-Date:
 > >Last-Modified:
 > >Originator:     Andrew
 > >Release:        4.1-STABLE
 > >Organization:
 > Relex, Ltd.
 > >Environment:
 > FreeBSD p227.relex.ru 4.1-STABLE 
 > FreeBSD 4.1-STABLE #12: Mon Sep 25 15:50:49 MSD 2000
 > amass@p227.relex.ru:/usr/src/sys/compile/KERNEL-A  i386
 > >Description:
 > f=open("/dev/nrsa0",O_RDWR);
 > write(f, buf, size);
 > ioctl(fd, MTIOCRDSPOS, &offs); 
 > This sequence hangs up the task on waiting disk operation.
 > Driver waits for awake on sys/cam/cam_periph.c : cam_periph_getccb() on
 > tsleep(&periph->ccb_list, PRIBIO, "cgticb", 0);
 > 
 > >How-To-Repeat:
 > f=open("/dev/nrsa0",O_RDWR);
 > write(f, buf, size);
 > ioctl(fd, MTIOCRDSPOS, &offs); 
 > 
 > >Fix:
 > This problem is fixed by replace :
 > ccb = cam_periph_getccb(periph, 1); 
 > if (softc->flags & SA_FLAG_TAPE_WRITTEN) {
 > 	error = sawritefilemarks(periph, 0, 0);
 > 	if (error && error != EACCES)
 > 		return (error);
 > }
 > to :
 > if (softc->flags & SA_FLAG_TAPE_WRITTEN) {
 > 	error = sawritefilemarks(periph, 0, 0);
 > 	if (error && error != EACCES)
 > 		return (error);
 > }
 > ccb = cam_periph_getccb(periph, 1);
 > 
 > 
 > 
 > >Release-Note:
 > >Audit-Trail:
 > >Unformatted:
 > 
 > 
 > To Unsubscribe: send mail to majordomo@FreeBSD.org
 > with "unsubscribe freebsd-bugs" in the body of the message
 > 
 
 
State-Changed-From-To: open->closed 
State-Changed-By: mjacob 
State-Changed-When: Thu Oct 5 10:03:58 PDT 2000 
State-Changed-Why:  
Applied suggested (and correct) fix. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=21723 
>Unformatted:
