Bug 21723

Summary: sa device driver bug
Product: Base System Reporter: razuwaev <razuwaev>
Component: kernAssignee: freebsd-bugs (Nobody) <bugs>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: 4.1-STABLE   
Hardware: Any   
OS: Any   

Description razuwaev 2000-10-03 10:40:00 UTC
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);

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);
How-To-Repeat: f=open("/dev/nrsa0",O_RDWR);
write(f, buf, size);
ioctl(fd, MTIOCRDSPOS, &offs);
Comment 1 mjacob 2000-10-03 16:08:01 UTC
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
>
Comment 2 Matt Jacob freebsd_committer freebsd_triage 2000-10-05 18:03:58 UTC
State Changed
From-To: open->closed

Applied suggested (and correct) fix.