The type of open that is being done by vn_open is passed in the
ts_sysd1 field. This open can be one of the following:
- VNOPEN_FILE
- A traditional POSIX open() or NFS V4 v_open(). These actions
request access rights and optionally can place share reservations
on the file. They contend with any other opens that may already
be established for this file. The call can fail due to an existing
reservation that denies the access requested, or the call can fail
if it attempts to deny an access that is already established. Both
conflicts cause the call to be rejected with RC=EBUSY. If the PFS
does not support Share Reservations, the LFS uses Rsn=JRShrConflict
for the former and Rsn=JRAccessConflict for the later.
This call
can be blocking or nonblocking, but the LFS does not allow blocking
with share reservations requested. That is, if either O_DENYRD or
O_DENYWRT are set then O_NONBLOCK must also be set. When the call
is blocking it should wait for any conflicting Share Reservations
to be removed. When nonblocking, it should be rejected immediately
with RC=EBUSY if there is a conflict. The Share reservations established
here inhibit any conflicting reading or writing that occur outside
of an open context. See Considerations for reading and writing and SetAttr for
more information.
- VNOPEN_NLM_SHR
- This type of open is for a Network Lock Manager Share Reservation.
It is not an open in the traditional sense, although there is really
no difference to the PFS. SAF/RACF is called for a normal access
check . These calls are always nonblocking.
The corresponding
vn_close also indicates that it is for a VNOPEN_NLM_SHR, so that the
appropriate deny counters can be decremented.
Note that the
SMB server also issues v_rdwr outside of an open context. But on the
first read or write to a file the LFS issues a vn_open(VNOPEN_FILE
) for it, so once SMB starts reading or writing a file it cannot be
denied that access later. That first read or write is rejected if
there is already a conflicting Share Reservation that causes the vn_open
to be rejected.
NLM opens contend with all other previous opens,
but the reservations established do not inhibit subsequent reads and
writes from an NFS V3 client. An NFS client does not have an open
context and its reads and writes are allowed to violate NLM Share
Reservations, but they are rejected if they conflict with a V4 Share
Reservation. There are two requirements to correctly enforce Reservations
with respect to NFS V3 reads and writes:
- The PFS must maintain two pairs of deny counters. These are for
(V4_DenyWrt,V4_DenyRd) and (NLM_DenyWrt,NLM_DenyRd).
- For a vn_rdwr operation the LFS must pass the type of client that
is doing the read or write. This is done in terms of the type of checking
that should be performed by the PFS. See Considerations for reading and writing and SetAttr for
more information.
- VNOPEN_INTERNAL
- An internal open issued by the LFS. This is for read and write
access, or for read-only access if the file system is Read-only. This
operation never denies any accesses. This open should bypass all Share
checking, and it does not inhibit later Share Reservations. There
may be more than one internal vn_open issued for a file. For each
internal vn_open there will be a corresponding internal vn_close.
These internal opens are done with system credentials.