Bug 17374

Summary: Archive QIC02 tape-unit device randomly halts.
Product: Base System Reporter: jan <jan>
Component: i386Assignee: freebsd-bugs (Nobody) <bugs>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: 3.2-RELEASE   
Hardware: Any   
OS: Any   

Description jan 2000-03-14 19:50:02 UTC
The wt QIC02 tapedriver in thwe FreeBSD 3.x has a nice bug (could be
also in NetBSD and other BSD's ???)
The wt driver sometimes comes in a deadlock state (waiting for an 
wake-up event that never occurs). It may happen when you are doing 
longer backups on - I assume - some "slow" PC's like mine. 
The backup does not finish correctly, it "hangs".
The code is in /sys/i386/isa/wt.c.
The solution is simple. After changing it,
the bug never occurred (to me) again. 

Reason:
In the Interrupt routine wtintr() there is no provision for 
stopping the timeout() if all i/o (one block) is completed
(state 'i/o finished'). If an interrupt is generated at this moment,
it comes in an unexpected state ('continue i/o'). In this state,
there is of course no wakeup, so it keeps sleeping ... 

Patch:
*Allways put the timer off* if i/o is finished.
Add this line in the function body of wtintr(sc):
	untimeout(wtimer, (caddr_t)t, t->co_handler);
See context-diff below.
Remark:
In NetBSD ther is no call-out handler, the patch is even
more simple.

How-To-Repeat: 
Problem shows up every time I was making a longer backup, 
on my old 486 PC system.
(May be on a fast system it does not occure, because it is a timing problem)
Comment 1 Mike Barcroft freebsd_committer freebsd_triage 2001-07-22 01:20:09 UTC
State Changed
From-To: open->feedback


Does this problem still occur in newer versions of FreeBSD, 
such as 4.3-RELEASE?
Comment 2 Matt Jacob freebsd_committer freebsd_triage 2001-10-02 05:00:36 UTC
State Changed
From-To: feedback->closed

Too long in feedback state.