diff options
author | J. Bruce Fields <bfields@citi.umich.edu> | 2006-01-18 20:43:36 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-01-18 22:20:26 -0500 |
commit | fb553c0f17444e090db951b96df4d2d71b4f4b6b (patch) | |
tree | 4eb83eab183f5dd8786aef63768a15fca1155fa6 | |
parent | 0f442aa299bb47046db4077d9c122a1b539311ce (diff) |
[PATCH] nfsd4: don't create on open that fails due to ERR_GRACE
In an earlier patch (commit b648330a1d741d5df8a5076b2a0a2519c69c8f41) I noted
that a too-early grace-period check was preventing us from bumping the
sequence id on open. Unfortunately in that patch I stupidly moved the
grace-period check back too far, so now an open for create can succesfully
create the file while still returning ERR_GRACE.
The correct place for that check is after we've set the open_owner and handled
any replays, but before we actually start mucking with the filesystem.
Thanks to Avishay Traeger for reporting the bug.
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Signed-off-by: Neil Brown <neilb@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r-- | fs/nfsd/nfs4proc.c | 8 | ||||
-rw-r--r-- | fs/nfsd/nfs4state.c | 6 |
2 files changed, 8 insertions, 6 deletions
diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c index 89028f2d8d26..b3f169f400db 100644 --- a/fs/nfsd/nfs4proc.c +++ b/fs/nfsd/nfs4proc.c | |||
@@ -192,6 +192,14 @@ nfsd4_open(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_open | |||
192 | } | 192 | } |
193 | if (status) | 193 | if (status) |
194 | goto out; | 194 | goto out; |
195 | |||
196 | /* Openowner is now set, so sequence id will get bumped. Now we need | ||
197 | * these checks before we do any creates: */ | ||
198 | if (nfs4_in_grace() && open->op_claim_type != NFS4_OPEN_CLAIM_PREVIOUS) | ||
199 | return nfserr_grace; | ||
200 | if (!nfs4_in_grace() && open->op_claim_type == NFS4_OPEN_CLAIM_PREVIOUS) | ||
201 | return nfserr_no_grace; | ||
202 | |||
195 | switch (open->op_claim_type) { | 203 | switch (open->op_claim_type) { |
196 | case NFS4_OPEN_CLAIM_DELEGATE_CUR: | 204 | case NFS4_OPEN_CLAIM_DELEGATE_CUR: |
197 | status = nfserr_inval; | 205 | status = nfserr_inval; |
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index b92dc9e08973..7167dcf8e1fe 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c | |||
@@ -1732,12 +1732,6 @@ nfsd4_process_open2(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nf | |||
1732 | struct nfs4_delegation *dp = NULL; | 1732 | struct nfs4_delegation *dp = NULL; |
1733 | int status; | 1733 | int status; |
1734 | 1734 | ||
1735 | if (nfs4_in_grace() && open->op_claim_type != NFS4_OPEN_CLAIM_PREVIOUS) | ||
1736 | return nfserr_grace; | ||
1737 | |||
1738 | if (!nfs4_in_grace() && open->op_claim_type == NFS4_OPEN_CLAIM_PREVIOUS) | ||
1739 | return nfserr_no_grace; | ||
1740 | |||
1741 | status = nfserr_inval; | 1735 | status = nfserr_inval; |
1742 | if (!TEST_ACCESS(open->op_share_access) || !TEST_DENY(open->op_share_deny)) | 1736 | if (!TEST_ACCESS(open->op_share_access) || !TEST_DENY(open->op_share_deny)) |
1743 | goto out; | 1737 | goto out; |