Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 22 Sep 2004 19:45:47 GMT
From:      Carl Reisinger <cer@mirapoint.com>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   kern/72010: mt -f /dev/rsa0.ctl comp off, or on, failes due to bug in scsi_sa.c:saioctl
Message-ID:  <200409221945.i8MJjlGu086495@www.freebsd.org>
Resent-Message-ID: <200409221950.i8MJoLNp016621@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         72010
>Category:       kern
>Synopsis:       mt -f /dev/rsa0.ctl comp off, or on, failes due to bug in scsi_sa.c:saioctl
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Sep 22 19:50:20 GMT 2004
>Closed-Date:
>Last-Modified:
>Originator:     Carl Reisinger
>Release:        4.9-STABLE
>Organization:
Mirapoint
>Environment:
FreeBSD trillian.mirapoint.com 4.9-STABLE FreeBSD 4.9-STABLE #2: Sat Feb 7 14:59:42 PST 2004   root@trillian.mirapoint.com:/usr/src/sys/compile/Trillian  i386   
>Description:
The comments in scsi_sa.c:saioctl claim one should be able to disable/enable compression via the tape control device (along with setting blocksize and density). However this does not work.

The issue is the switch(cmd) statement (second switch in the sourse code). The cases for MTSETBSIZ, MTSETDNSTY and MTCOMP are incorrect. These three are operations belonging to the cmd MTIOCTOP.
>How-To-Repeat:
With a SCSI tape device attached and no tape mounted

mt -f /dev/rsa0.ctl comp off

EINVAL is returned from the ioctl performed by mt(1).

With a tape mounted a

mt -f /dev/rsa0 comp off

will work
>Fix:
Brute force copy and paste approach:

case MTIOCSETEOTMODEL:
     /*
      * We need to acquire the peripheral here rather
      * than at open time because we are sharing writable
      * access to data structures.
      */
      s = splsoftcam();
      error = cam_periph_lock(periph, PRIBIO|PCATCH);
      if (error != 0) {
              splx(s);
              return (error);
      }
      didlockperiph = 1;
      break;

case MTIOCTOP: {
     struct mtop *mt;

     mt = (struct mtop *)arg;
     switch (mt->mt_op) {
     case MTSETBSIZ:
     case MTSETDNSTY:
     case MTCOMP:
     /*
      * We need to acquire the peripheral here rather
      * than at open time because we are sharing
      * writable access to data structures.
      */
          s = splsoftcam();
          error = cam_periph_lock(periph, PRIBIO|PCATCH);
          if (error != 0) {
                 splx(s);
                 return (error);
          }
          didlockperiph = 1;
          break;

default:
      return (EINVAL);
}

>Release-Note:
>Audit-Trail:
>Unformatted:



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