bugfix: SA driver will unwind when close device even with SA_MODE_NOREWIND

Peter Xu xzpeter at gmail.com
Fri Feb 6 04:07:02 UTC 2015


I think I was misguided by the source code. In saregister() of scsi_sa.c,
it might be confusing that the loop to create the .[0-3] devices are using
SA_NUM_MODES:

for (i = 0; i < SA_NUM_MODES; i++) {

Thanks for the clarify. :)

Peter

On Fri, Feb 6, 2015 at 6:38 AM, Kenneth D. Merry <ken at freebsd.org> wrote:

> On Fri, Jan 30, 2015 at 13:55:17 +0800, Peter Xu wrote:
> > Hi,
> >
> > In BSD system, when tape devices are discovered, CAM will create specific
> > /dev/saX.[0-3] automatically. Here when we does not the tape to auto
> rewind
> > when closing the device, we should access /dev/saX.1 (which means we are
> > using SA_MODE_NOREWIND mode).
> >
> > Found one bug that tape will auto rewind even accessing /dev/saX.1.
>
> That isn't a bug, it is the way things are supposed to work.  The minor
> device terminology in the man page may be a little confusing.
>
> The man page says:
>
> FILES
>      /dev/[n][e]sa[0-9]  general form:
>      /dev/sa0            Rewind on close
>      /dev/nsa0           No rewind on close
>      /dev/esa0           Eject on close (if capable)
>      /dev/sa0.ctl        Control mode device (to examine state while
> another
>                          program is accessing the device, e.g.).
>
> The naming convention carries over to the /dev/[n][e]sa[0-9].[0-3] devices.
>
> If you want a non-rewound device, you would need to use /dev/nsaX, or
> /dev/nsaX.[0-3].  If you want the tape to be ejected, you would use the
> /dev/esaX.[0-3] device.
>
> The idea behind the .[0-3] devices was that they were to be for different
> possible tape drive densities.  If you look at the output of 'mt status',
> it has output entries that could be filled with possible densities, but
> that aren't actually used.
>
> Just as the entries in 'mt status' aren't used, the .[0-3] entries are not
> used.  There is no difference between those entries and the standard device
> names.
>
> I've considered removing the .[0-3] entries, since they are primarily just
> confusing for anyone who sees them.  If anyone thinks we should keep them,
> let me know.  Otherwise I may just take them out with the upcoming round of
> sa(4) driver changes.
>
> There are modern tape drives (e.g. IBM TS1140, TS1150) that are capable
> of writing at multiple densities, but I don't know that we need to
> necessarily let the user switch density by using a different device.
> You can also do a 'mt density X' and switch that way.
>
> Ken
> --
> Kenneth Merry
> ken at FreeBSD.ORG
>


More information about the freebsd-scsi mailing list