[stgt] [PATCH] SMC: do not allow load/unload of media that has been pinned down with PreventAllowMediumRemoval

Mark Harvey markh794 at gmail.com
Sun Feb 5 05:18:01 CET 2012


On Sun, Feb 5, 2012 at 10:43 AM, ronnie sahlberg
<ronniesahlberg at gmail.com> wrote:
> List, Tomo
>
> Please find attached a small patch for SMC.
> It now prevents the media changer commands from loading/unloading
> media to a data transfer device IF that data transfer device has the
> media removal prevention set via PreventAllowMediumRemoval.
>
> Initiators set this when they mount a device that is removable.
>
> For example if you have a removable SBC device like the sbc jukebox
> example, Linux for example will set the PreventAllowMediumRemoval when
> you:
> mount -o ro,noload <device> <mountpoint>
> just so that no one will eject the media while the filesystem is mounted.
>
> Similarly this also happens for MMC devices,   and I belive also on
> SSC devices, but I cant check SSC devices.
> (Mark, If I assume that backup applocations do use
> PreventAllowMediumRemoval when they have loaded a tape into the dt
> device?)
>
>
> regards
> ronnie sahlberg

The IBM SCSI Reference (11th edition) states..

------------
If the Prevent field is set, then eject requests from the front panel
are ignored and
Unload commands give Check Condition status. The Sense Key is set to Illegal
Request and the ASC/ASCQ to Medium Removal Prevented (5302).
All initiators that have prevented medium removal must enable it before the
medium can be removed from the drive.
-----------

This patch also checks status on destination slot, which I think is a
bit too aggressive.
Checking on unload on source slot should be fine.

Cheers
--
To unsubscribe from this list: send the line "unsubscribe stgt" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html



More information about the stgt mailing list