linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] NFSD: Don't give out read delegations on exclusive creates
@ 2013-05-15 18:51 Steve Dickson
  2013-05-21 18:43 ` Steve Dickson
  2013-05-21 19:23 ` J. Bruce Fields
  0 siblings, 2 replies; 7+ messages in thread
From: Steve Dickson @ 2013-05-15 18:51 UTC (permalink / raw)
  To: Bruce Fields; +Cc: Linux NFS Mailing list

When an exclusive create is done with the mode bits
set (aka open(testfile, O_CREAT | O_EXCL, 0777)) this
causes a OPEN op followed by a SETATTR op. When a
read delegation is given in the OPEN, it causes
the SETATTR to delay with EAGAIN until the
delegation is recalled.

This patch caused exclusive creates to give out
a write delegation (which turn into no delegation)
which allows the SETATTR seamlessly succeed.

Signed-off-by: Steve Dickson <steved@redhat.com>
---
 fs/nfsd/nfs4state.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 316ec84..6b45d0e 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -3035,8 +3035,16 @@ nfs4_open_delegation(struct net *net, struct svc_fh *fh,
 				goto out;
 			if (open->op_share_access & NFS4_SHARE_ACCESS_WRITE)
 				flag = NFS4_OPEN_DELEGATE_WRITE;
-			else
-				flag = NFS4_OPEN_DELEGATE_READ;
+			else {
+				switch(open->op_createmode) {
+				case NFS4_CREATE_EXCLUSIVE:
+				case NFS4_CREATE_EXCLUSIVE4_1:
+					flag = NFS4_OPEN_DELEGATE_WRITE;
+					break;
+				default:
+					flag = NFS4_OPEN_DELEGATE_READ;
+				}
+			}
 			break;
 		default:
 			goto out;
-- 
1.8.1.4


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2013-05-22 16:20 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-15 18:51 [PATCH] NFSD: Don't give out read delegations on exclusive creates Steve Dickson
2013-05-21 18:43 ` Steve Dickson
2013-05-21 18:52   ` J. Bruce Fields
2013-05-21 19:23 ` J. Bruce Fields
2013-05-21 20:25   ` J. Bruce Fields
2013-05-22 16:20     ` J. Bruce Fields
2013-05-21 20:26   ` J. Bruce Fields

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).