kern/72010: mt -f /dev/rsa0.ctl comp off, or on, failes due to bug
in scsi_sa.c:saioctl
Carl Reisinger
cer at mirapoint.com
Wed Sep 22 12:50:22 PDT 2004
>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 at 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:
More information about the freebsd-bugs
mailing list