git: 56b64e28e11c - main - nfscl: Do not flush when a write delegation is held
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 02 Jun 2022 19:12:57 UTC
The branch main has been updated by rmacklem:
URL: https://cgit.FreeBSD.org/src/commit/?id=56b64e28e11ce4f474b5d352ae3c0e218c345948
commit 56b64e28e11ce4f474b5d352ae3c0e218c345948
Author: Rick Macklem <rmacklem@FreeBSD.org>
AuthorDate: 2022-06-02 19:11:55 +0000
Commit: Rick Macklem <rmacklem@FreeBSD.org>
CommitDate: 2022-06-02 19:11:55 +0000
nfscl: Do not flush when a write delegation is held
When a NFSv4 byte range write lock is unlocked, all
data modifications need to be flushed to the server
to satisfy the coherency requirements for byte range
locking. However, if a write delegation for the
file is held by the client, flushing is not required,
since no other NFSv4 client can have the file NFSv4
Opened.
Found by inspection as suggested by a similar change
that was done to the Linux NFSv4 client.
---
sys/fs/nfsclient/nfs_clstate.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/sys/fs/nfsclient/nfs_clstate.c b/sys/fs/nfsclient/nfs_clstate.c
index 3b65828d5958..7a0d323a788a 100644
--- a/sys/fs/nfsclient/nfs_clstate.c
+++ b/sys/fs/nfsclient/nfs_clstate.c
@@ -1468,6 +1468,12 @@ nfscl_checkwritelocked(vnode_t vp, struct flock *fl,
*/
dp = nfscl_finddeleg(clp, np->n_fhp->nfh_fh, np->n_fhp->nfh_len);
if (dp != NULL) {
+ /* No need to flush if it is a write delegation. */
+ if ((dp->nfsdl_flags & NFSCLDL_WRITE) != 0) {
+ nfscl_clrelease(clp);
+ NFSUNLOCKCLSTATE();
+ return (0);
+ }
LIST_FOREACH(lp, &dp->nfsdl_lock, nfsl_list) {
if (!NFSBCMP(lp->nfsl_owner, own,
NFSV4CL_LOCKNAMELEN))