path: root/fs/locks.c
diff options
authorJ. Bruce Fields <bfields@redhat.com>2021-04-16 14:00:18 -0400
committerChuck Lever <chuck.lever@oracle.com>2021-04-19 16:41:36 -0400
commitaba2072f452346d56a462718bcde93d697383148 (patch)
treec42db8d613b8d0bf8d5de6717c5cd61225e9b506 /fs/locks.c
parentnfsd: reshuffle some code (diff)
nfsd: grant read delegations to clients holding writes
It's OK to grant a read delegation to a client that holds a write, as long as it's the only client holding the write. We originally tried to do this in commit 94415b06eb8a ("nfsd4: a client's own opens needn't prevent delegations"), which had to be reverted in commit 6ee65a773096 ("Revert "nfsd4: a client's own opens needn't prevent delegations""). Signed-off-by: J. Bruce Fields <bfields@redhat.com> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Diffstat (limited to 'fs/locks.c')
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/locks.c b/fs/locks.c
index 6125d2de39b8..bcc71c469ede 100644
--- a/fs/locks.c
+++ b/fs/locks.c
@@ -1808,6 +1808,9 @@ check_conflicting_open(struct file *filp, const long arg, int flags)
if (flags & FL_LAYOUT)
return 0;
+ if (flags & FL_DELEG)
+ /* We leave these checks to the caller */
+ return 0;
if (arg == F_RDLCK)
return inode_is_open_for_write(inode) ? -EAGAIN : 0;