linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Douglas Gilbert <dougg@torque.net>
To: brking@us.ibm.com
Cc: linux-scsi@vger.kernel.org
Subject: Re: drivers/block/scsi_ioctl problem
Date: Wed, 15 Dec 2004 15:32:47 +1000	[thread overview]
Message-ID: <41BFCC7F.2050005@torque.net> (raw)
In-Reply-To: <41BF7C18.9090303@us.ibm.com>

Brian King wrote:
> Can someone explain to me the need for this bit of code in 
> drivers/block/scsi_ioctl.c:
> 
> if (!(type & CMD_WARNED)) {
>     cmd_type[cmd[0]] = CMD_WARNED;
>     printk(KERN_WARNING "scsi: unknown opcode 0x%02x\n", cmd[0]);
> }
> 
> I'm trying to convert an application to use SG_IO to /dev/sd* devices 
> rather than using /dev/sg* devices and this is one problem I have been 
> running into. Any time I issue a vendor specific scsi opcode I end up 
> getting one of these error logs. Is there a good reason this error log 
> is needed?

Brian,
I think command filtering was retrofitted into the block
SG_IO code. You only need read permissions to execute an
ioctl and FORMAT could be unfortunate.


IMO this code snippet should be moved from below the snippet
you showed to the top of the procedural lines in that function:

         /* And root can do any command.. */
         if (capable(CAP_SYS_RAWIO))
                 return 0;


That command filtering seems pretty haphazard, aimed mainly at
cd/dvd devices. The START STOP command is regarded as "safe
for read"** while SERVICE ACTION IN (12), (16), MAINTENANCE IN
and PERSISTENT RESERVE IN are _not_ considered "safe for read".

** the sd driver doesn't react well when some other mechanism
explicity spins down a dsik.

Doug Gilbert



  reply	other threads:[~2004-12-15  5:31 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-12-14 23:49 drivers/block/scsi_ioctl problem Brian King
2004-12-15  5:32 ` Douglas Gilbert [this message]
2004-12-15  7:18 ` Jens Axboe
2004-12-15 19:13   ` Brian King
2004-12-15 22:44     ` Brian King
2004-12-16  6:32       ` Jens Axboe
2004-12-16 16:31         ` Brian King
2005-10-07 14:13         ` Brian King
2005-10-07 17:41           ` Jens Axboe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=41BFCC7F.2050005@torque.net \
    --to=dougg@torque.net \
    --cc=brking@us.ibm.com \
    --cc=linux-scsi@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).