Bug 192285

Summary: sa(4) fails to correctly report current tape position after "mt fsf 32767"
Product: Base System Reporter: Joerg Wunsch <joerg>
Component: kernAssignee: freebsd-bugs (Nobody) <bugs>
Status: Closed FIXED    
Severity: Affects Many People    
Priority: ---    
Version: 10.0-STABLE   
Hardware: Any   
OS: Any   

Description Joerg Wunsch freebsd_committer freebsd_triage 2014-07-31 06:01:40 UTC
When performing an "mt fsf 32767", the expectation is the driver moves
the tape to EOD, and then "mt status" reports the number of tape files
(filemarks) that have been encountered before reaching EOD.

However, it (usually) reports 32767 instead.

The bug was triggered by SVN r256843 (on HEAD, merged to 10-stable in
r260387).

See the discussion starting at:

http://docs.freebsd.org/cgi/mid.cgi?20140729090724.GA26577

for details.
Comment 1 commit-hook freebsd_committer freebsd_triage 2014-07-31 22:09:53 UTC
A commit references this bug:

Author: joerg
Date: Thu Jul 31 22:09:50 UTC 2014
New revision: 269353
URL: http://svnweb.freebsd.org/changeset/base/269353

Log:
  Fix breakage introduced by r256843: removing the SA_CCB_WAITING bit
  left some of the decisions based on its counterpart, SA_CCB_BUFFER_IO
  being random.  As a result, propagation of the residual information
  for the SPACE command was broken, so the number of filemarks
  encountered during a SPACE operation was miscalculated.  Consequently,
  systems relying on properly tracked filemark counters (like Bacula)
  fell apart.

  The change also removes a switch/case in sadone() which r256843
  degraded to a single remaining case label.

  PR:		192285
  Approved by:	ken
  MFC after:	2 weeks

Changes:
  head/sys/cam/scsi/scsi_sa.c
Comment 2 commit-hook freebsd_committer freebsd_triage 2014-08-08 14:42:44 UTC
A commit references this bug:

Author: joerg
Date: Fri Aug  8 14:42:04 UTC 2014
New revision: 269717
URL: http://svnweb.freebsd.org/changeset/base/269717

Log:
  Merge r269353:

  Fix breakage introduced by r256843: removing the SA_CCB_WAITING bit
  left some of the decisions based on its counterpart, SA_CCB_BUFFER_IO
  being random.  As a result, propagation of the residual information
  for the SPACE command was broken, so the number of filemarks
  encountered during a SPACE operation was miscalculated.  Consequently,
  systems relying on properly tracked filemark counters (like Bacula)
  fell apart.

  The change also removes a switch/case in sadone() which r256843
  degraded to a single remaining case label.

  PR:		192285

Changes:
_U  stable/10/
  stable/10/sys/cam/scsi/scsi_sa.c
Comment 3 Joerg Wunsch freebsd_committer freebsd_triage 2014-08-08 15:01:43 UTC
Fixed in both, head and stable/10.  Not affecting older stable branches.