]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
nfscl: Cache an open stateid for the "oneopenown" mount option
authorRick Macklem <rmacklem@FreeBSD.org>
Wed, 28 Jul 2021 22:48:27 +0000 (15:48 -0700)
committerRick Macklem <rmacklem@FreeBSD.org>
Wed, 28 Jul 2021 22:48:27 +0000 (15:48 -0700)
commitefea1bc1fd93831c29fa7594d67094e0c125fb88
treedd6c6b90f7a6aedbad31e3f0d6c1ede120acbec9
parent54ff3b3986741b9cd06ce20b90c96711cbe146d0
nfscl: Cache an open stateid for the "oneopenown" mount option

For NFSv4.1/4.2, if the "oneopenown" mount option is used,
there is, at most, only one open stateid for each NFS vnode.
When an open stateid for a file is acquired, set a pointer to
the open structure in the NFS vnode.  This pointer can be used to
acquire the open stateid without searching the open linked list
when the following is true:
- No delegations have been issued for the file.  Since delegations
  can outlive an NFS vnode for a file, use the global
  NFSMNTP_DELEGISSUED flag on the mount to determine this.
- No lock stateid has been issued for the file.  To determine
  this, a new NFS vnode flag called NMIGHTBELOCKED is set when a lock
  stateid is issued, which can then be tested.

When this open structure pointer can be used, it avoids the need to
acquire the NFSCLSTATELOCK() and searching the open structure list for
an open.  The NFSCLSTATELOCK() can be highly contended when there are
a lot of opens issued for the NFSv4.1/4.2 mount.

This patch only affects NFSv4.1/4.2 mounts when the "oneopenown"
mount option is used.

MFC after: 2 weeks
sys/fs/nfsclient/nfs_clnode.c
sys/fs/nfsclient/nfs_clrpcops.c
sys/fs/nfsclient/nfs_clstate.c
sys/fs/nfsclient/nfs_clvnops.c
sys/fs/nfsclient/nfsnode.h