I am pleased to sponsor this fast-track for Eric Schrock.  The binding
requested is minor release, and the timer is set for Monday March 3.

Thanks,

        -dp

------
sgen(7D) Multiple Opens
Eric Schrock

A. DESCRIPTION

When the sgen(7D) driver was introduced in PSARC 1999/525, the primary
targets were specialized SCSI devices such as scanners and tape devices.
These devices are typically stateful, requiring a single point of
control so that consumers don't overwrite the same state and get
confused.  Because of this, sgen(7D) enforces O_EXCL behavior even when
not requested by the consumer.  At the time, this made sense given the
devices targeted by sgen.

There are many devices, however, that do not require such exclusive
access because the protocol has built in safeguards to manage
simultaneous access.  The most notable of these is storage devices
implementing SES (SCSI Enclosure Services).  While these devices are
currently bound to ses(7D) by default on Solaris (which does support
multiple consumers), it is desirable to implement such consumers
entirely in userland via uscsi, regardless of the underlying driver.
The current design of sgen prevents this from being practical, as many
consumers will want to maintain an open SES handle, and being forced to
manage exclusive access across all such consumers is not practical.

This case seeks to relax the exclusivity of sgen devices to that of
normal devices, where concurrent opens are allowed unless O_EXCL is set.


B. DETAILS

This is a simple change to the sgen open routine, as the driver already
enforces serialized access when issuing uscsi commands.  If an O_EXCL
open request is received, this will be stored in the driver state so
that future opens will fail.

The sgen driver also has the behavior that if the driver is suspended,
all future operations return EIO until the device is re-opened.  With
multiple opens, it would be nice to allow future opens but have existing
references return EIO, but this would be quite complex to implement.  A
much simpler solution that preserves the original intent is to simply
prevent all opens until the last reference is closed.  Given the rarity
of suspend events, this seems sufficient.


C. MANPAGE DIFFS

***************
*** 384,394 ****
                         above.
  
  
  ERRORS
       EBUSY     The device was opened by another  thread  or  pro-
!                cess. The driver maintains a strict exclusive-open
  
  
  
  SunOS 5.11          Last change: 29 Sep 1999                    6
  
--- 384,395 ----
                         above.
  
  
  ERRORS
       EBUSY     The device was opened by another  thread  or  pro-
!                cess using the O_EXCL flag, or the device is
!              currently open and O_EXCL is being requested.
  
  
  
  SunOS 5.11          Last change: 29 Sep 1999                    6
  
***************
*** 399,411 ****
  
  Devices                                                  sgen(7D)
  
  
  
-                policy for each device.
- 
- 
       ENXIO     During opening, the device did not  respond  to  a
                 TEST UNIT READY SCSI command.
  
  
       ENOTTY    Indicates that the device does  not   support  the
--- 400,409 ----



-- 
Daniel Price - Solaris Kernel Engineering - dp at eng.sun.com - blogs.sun.com/dp

Reply via email to