Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 21 Jun 1995 17:49:29 -0500 (CDT)
From:      Mike Pritchard <mpp@legarto.minn.net>
To:        deischen@iworks.InterWorks.org (Daniel M. Eischen)
Cc:        gibbs@freebsd.org, mikebo@TELLABS.COM, questions@freebsd.org
Subject:   Re: FBSD 2.xR: AIC7xxx driver vs. st() driver vs. tape drives
Message-ID:  <199506212249.RAA00258@mpp.com>
In-Reply-To: <9506212000.AA13314@iworks.InterWorks.org> from "Daniel M. Eischen" at Jun 21, 95 03:00:56 pm

next in thread | previous in thread | raw e-mail | index | archive | help
> >DEBUG: Notify: Attempting to extract from SCSI tape drive...
> >DEBUG: Executing command 'cpio -iBduVm -H tar -I /dev/rst0' (Magic 0)
> >st0(ahc1:2:0): ILLEGAL REQUEST
> >st0: Cannot set selected mode
> >st0: bad request, must be between 0 and 0
> >cpio: read error: Input/output error
> >DEBUG: Command 'cpio -iBduVm -H tar -I /dev/rst0' returns status of 1

Are you booting with a tape in the drive?  I just tracked down
the "bad request, must be between 0 and 0" problem that
I've seen before.  If a tape is in the drive at boot time,
st_mode_sense is called and sets the MEDIA_LOADED flag.  
When st_mount_tape is called and then calls st_rd_blk_lim,
st_rd_blk_lim sees the MEDIA_LOADED flag and returns without doing 
anything, thus causing the above error.

I fixed it by changing st_mode_sense to not set the MEDIA_LOADED
flag, since st_mount_tape sets it when the mount is complete, and
other code in the driver causes the MEDIA_LOADED flag to track
the mount status, so changing the mode_sense routine to not fiddle
with the MEDIA_LOADED flag seemed like the thing to do.  I also 
removed the MEDIA_LOADED check from st_rd_blk_lim, since it is 
only called by st_mount_tape, and it makes sense to always read 
this information when mounting a new tape, just in cause
the MEDIA_LOADED flag got confused somewhere along the way.

Here is a patch to fix the problem (it also fixes a typo).  It may also 
fix/or help the problem described in PR misc/531.

*** orig/st.c	Wed Jun 21 17:09:04 1995
--- st.c	Wed Jun 21 17:21:42 1995
***************
*** 1017,1023 ****
  		st->buf_queue = bp->b_actf;
  
  		/*
! 		 * if the device has been unmounted byt the user
  		 * then throw away all requests until done
  		 */
  		if ((!(st->flags & ST_MOUNTED))
--- 1017,1023 ----
  		st->buf_queue = bp->b_actf;
  
  		/*
! 		 * if the device has been unmounted by the user
  		 * then throw away all requests until done
  		 */
  		if ((!(st->flags & ST_MOUNTED))
***************
*** 1359,1370 ****
  	errval  errno;
  
  	/*
- 	 * First check if we have it all loaded
- 	 */
- 	if ((sc_link->flags & SDEV_MEDIA_LOADED))
- 		return 0;
- 
- 	/*
  	 * do a 'Read Block Limits'
  	 */
  	bzero(&scsi_cmd, sizeof(scsi_cmd));
--- 1359,1364 ----
***************
*** 1481,1487 ****
  	if (page) {
  		bcopy(&dat.page, page, pagelen);
  	}
- 	sc_link->flags |= SDEV_MEDIA_LOADED;
  	return 0;
  }
  
--- 1475,1480 ----
-- 
Mike Pritchard
mpp@legarto.minn.net
"Go that way.  Really fast.  If something gets in your way, turn"



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199506212249.RAA00258>