FreeBSD src
Go to file
Matt Jacob 83e9f270b3 Clear SA_FLAG_ERR_PENDING for MTREW, MTERASE and MTRETENS ioctl cases.
Clear residual counts after a successful samount (the user doesn't
care that we got an N-kbyte residual on our test read).

Change a lot of error handling code.

1. If we end up in saerror, check more carefully about the kind of
error. If it is a CAM_SCSI_STATUS_ERROR and it is a read/write
command, we'll be handling this in saerror.  If it isn't a read/write
command, check to see whether this is just an EOM/EOP check condition-
if it is, just set residual and return normally. A residual and
then a NO SENSE check condiftion with the ASC of 0 and ASCQ of
between 1 and 4 are normal 'signifying' events, not errors per se,
and we shouldn't give the command to cam_periph_error to do something
relatively unpredictable with.

2. If we get a Bus Reset, had a BDR sent, or get the cam status of
CAM_REQUEUE_REQ, check the retry count on the command. The default
error handler, cam_periph_error, doesn't honor retry count in these
cases. This may change in the future, but for now, make sure we
set EIO and return without calling cam_periph_error if the retry
count for the command with an error is zero.

3. Clean up the pending error case goop and handle cases more
sensibly.

The rules are:

 If command was a Write:

  If we got a SSD_KEY_VOLUME_OVERFLOW, the resid is
  propagated and we set ENOSPC as the error.

  Else if we got an EOM condition- just mark EOM pending.

	And set a residual of zero. For the longest time I was just
        propagating residual from the sense data- but my tape
        comparison tests were always failing because all drives I
        tested with actually *do* write the data anyway- the EOM
        (early warning) condition occurred *prior* to all of the
        data going out to media- that is, it was still buffered by
        the drive. This case is described in SCSI-2, 10.2.14,
        paragraph #d for the meaning of 'information field'. A
        better fix for this would be to issue a WFM command of zero
        to cause the drive to flush any buffered data, but this
        would require a fairly extensive rewrite.

 Else if the command was a READ:

  If we got a SSD_KEY_BLANK_CHECK-
	If we have a One Filemark EOT model- mark EOM as pending,
	otherwise set EIO as the erorr.
  Else if we found a Filemark-
	If we're in Fixed Block mode- mark EOF pending.

 If we had an ILI (Incorrect Length Indicator)-
  If the residual is less than zero, whine about tape record
  being too big for user's buffer, otherwise if we were in
  Fixed Block mode, mark EIO as pending.

All 'pending' conditions mean that the command in question completes
without error indication. It had succeeded, but a signifying event
occurred during its execution which will apply to the *next* command
that would be exexcuted. Except for the one EOM case above, we always
propagate residual.

Now, way back in sastart- if we notice any of the PENDING bits set,
we don't run the command we've just pulled off the wait queue. Instead,
we then figure out it's disposition based upon a previous command's
association with a signifying event.

 If SA_FLAG_EOM_PENDING is set, we don't set an error. We just complete
 the command with residual set to the request count (not data moved,
 but no error). We continue on.

 If SA_FLAG_EOF_PENDING- if we have this, it's only because we're in
 Fixed Block mode- in which case we traverse all waiting buffers (which
 we can get in fixed block mode because physio has split things up) and
 mark them all as no error, but no data moved and complete them.

 If SA_FLAG_EIO_PENDING, just mark the buffer with an EIO error
 and complete it.

Then we clear all of the pending state bits- we're done.

MFC after:	4 weeks
2001-08-30 16:25:24 +00:00
bin On today's kernels masking with ~KERNBASE is turning out to be less 2001-08-24 09:56:44 +00:00
contrib Merge after 4.1.0 import. 2001-08-29 15:15:59 +00:00
crypto Manually unifdef(1) CRAY, UNICOS, hpux and sun uselsess code. 2001-08-29 14:16:17 +00:00
etc chown syntax is user:group now. 2001-08-29 19:59:30 +00:00
games Put the correct path for robots_roll in /var/games. 2001-08-15 19:22:04 +00:00
gnu Dynamically adapt to kernbase changes on crashdumps, falling back to 2001-08-24 09:12:04 +00:00
include Implement getpeereid(3), a front-end to the LOCAL_PEERCRED 2001-08-17 22:09:15 +00:00
kerberos5 style fixes (by the way of bde) 2001-08-27 13:25:43 +00:00
kerberosIV Diff reduce all the crypto telnet Makefiles. 2001-08-20 12:32:45 +00:00
lib o Remove some GCCisms in src/powerpc/include/endian.h. 2001-08-30 00:04:19 +00:00
libexec Manually unifdef(1) CRAY, UNICOS, hpux and sun uselsess code. 2001-08-29 14:16:17 +00:00
release DS10 has it's USB interface disabled (by Compaq/DEC). I wonder where I got 2001-08-30 12:46:53 +00:00
sbin restore(8) doesn't need to be setgid `tty', and never did. 2001-08-30 09:18:55 +00:00
secure Fixed world breakage in rev.1.13. -lpam must never be used directly since 2001-08-29 07:07:48 +00:00
share Mega update to the aac driver. 2001-08-29 23:34:05 +00:00
sys Clear SA_FLAG_ERR_PENDING for MTREW, MTERASE and MTRETENS ioctl cases. 2001-08-30 16:25:24 +00:00
tools ISO_ -> ISO 2001-06-11 01:29:40 +00:00
usr.bin Restore the `-perm +mode' feature. 2001-08-30 13:17:58 +00:00
usr.sbin Fixed breakage of NOSHARED worlds in previous commit. -lreadline was 2001-08-30 10:37:28 +00:00
COPYRIGHT Update to add the July 22, 1999 addendum. 1999-09-05 21:33:47 +00:00
Makefile Make it possible to build manpages for the entire source tree. 2001-03-27 08:43:28 +00:00
Makefile.inc1 Fixed world breakage. mkdir was not copied to ${INSTALLTMP}, but it is 2001-08-29 09:11:03 +00:00
Makefile.upgrade $Id$ -> $FreeBSD$ 1999-08-28 01:35:59 +00:00
README Slightly improve the description of "crypto". "DES" is a subset of 2000-08-31 17:59:01 +00:00
UPDATING Use Brian Sommers' named entry 2001-08-24 21:43:35 +00:00

This is the top level of the FreeBSD source directory.  This file
was last revised on:
$FreeBSD$

For copyright information, please see the file COPYRIGHT in this
directory (additional copyright information also exists for some
sources in this tree - please see the specific source directories for
more information).

The Makefile in this directory supports a number of targets for
building components (or all) of the FreeBSD source tree, the most
commonly used one being ``world'', which rebuilds and installs
everything in the FreeBSD system from the source tree except the
kernel, the kernel-modules and the contents of /etc.  The
``buildkernel'' and ``installkernel'' targets build and install
the kernel and the modules (see below).  Please see the top of
the Makefile in this directory for more information on the
standard build targets and compile-time flags.

Building a kernel is a somewhat more involved process, documentation
for which can be found at:
   http://www.freebsd.org/handbook/kernelconfig.html
And in the config(8) man page.
Note: If you want to build and install the kernel with the
``buildkernel'' and ``installkernel'' targets, you have to build
world before.  More information is available in the handbook.

The sample kernel configuration files reside in the sys/i386/conf
sub-directory (assuming that you've installed the kernel sources), the
file named GENERIC being the one used to build your initial installation
kernel.  The file NOTES contains entries and documentation for all possible
devices, not just those commonly used.  It is the successor of the ancient
LINT file, but in contrast to LINT, it is not buildable as a kernel but a
pure reference and documentation file.


Source Roadmap:
---------------
bin		System/User commands.

contrib		Packages contributed by 3rd parties.

crypto		Cryptography stuff (see crypto/README).

etc		Template files for /etc

games		Amusements.

gnu		Various commands and libraries under the GNU Public License.
		Please see gnu/COPYING* for more information.

include		System include files.

kerberosIV	Kerberos package.

lib		System libraries.

libexec		System daemons.

release		Release building Makefile & associated tools.

sbin		System commands.

secure		Cryptographic libraries and commands.

share		Shared resources.

sys		Kernel sources.

tools		Utilities for regression testing and miscellaneous tasks.

usr.bin		User commands.

usr.sbin	System administration commands.


For information on synchronizing your source tree with one or more of
the FreeBSD Project's development branches, please see:

  http://www.freebsd.org/handbook/synching.html