aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeilBrown <neilb@cse.unsw.edu.au>2005-07-07 20:59:16 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2005-07-07 21:24:08 -0400
commit375151773125f56b7f6d798d914ea469256b330b (patch)
tree2bc6c0d8d2a075b9daa2aa7dca440f572c566629
parent0dd395dc76071a06eea39839cc946c1241af3650 (diff)
[PATCH] nfsd4: stop overusing RECLAIM_BAD
A misreading of the spec lead us to convert all errors on open and lock reclaims to RECLAIM_BAD. This causes problems--for example, a reboot within the grace period could lead to reclaims with stale stateid's, and we'd like to return STALE errors in those cases. What rfc3530 actually says about RECLAIM_BAD: "The reclaim provided by the client does not match any of the server's state consistency checks and is bad." I'm assuming that "state consistency checks" refers to checks for consistency with the state recorded to stable storage, and that the error should be reserved for that case. Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu> Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--fs/nfsd/nfs4state.c25
1 files changed, 7 insertions, 18 deletions
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 92968c94c6e6..142b63bc2051 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -1531,8 +1531,6 @@ renew:
1531 status = nfs_ok; 1531 status = nfs_ok;
1532 renew_client(sop->so_client); 1532 renew_client(sop->so_client);
1533out: 1533out:
1534 if (status && open->op_claim_type == NFS4_OPEN_CLAIM_PREVIOUS)
1535 status = nfserr_reclaim_bad;
1536 return status; 1534 return status;
1537} 1535}
1538 1536
@@ -1688,17 +1686,11 @@ nfs4_upgrade_open(struct svc_rqst *rqstp, struct svc_fh *cur_fh, struct nfs4_sta
1688 1686
1689/* decrement seqid on successful reclaim, it will be bumped in encode_open */ 1687/* decrement seqid on successful reclaim, it will be bumped in encode_open */
1690static void 1688static void
1691nfs4_set_claim_prev(struct nfsd4_open *open, int *status) 1689nfs4_set_claim_prev(struct nfsd4_open *open)
1692{ 1690{
1693 if (open->op_claim_type == NFS4_OPEN_CLAIM_PREVIOUS) { 1691 open->op_stateowner->so_confirmed = 1;
1694 if (*status) 1692 open->op_stateowner->so_client->cl_firststate = 1;
1695 *status = nfserr_reclaim_bad; 1693 open->op_stateowner->so_seqid--;
1696 else {
1697 open->op_stateowner->so_confirmed = 1;
1698 open->op_stateowner->so_client->cl_firststate = 1;
1699 open->op_stateowner->so_seqid--;
1700 }
1701 }
1702} 1694}
1703 1695
1704/* 1696/*
@@ -1863,8 +1855,8 @@ nfsd4_process_open2(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nf
1863out: 1855out:
1864 if (fp) 1856 if (fp)
1865 put_nfs4_file(fp); 1857 put_nfs4_file(fp);
1866 /* CLAIM_PREVIOUS has different error returns */ 1858 if (status == 0 && open->op_claim_type == NFS4_OPEN_CLAIM_PREVIOUS)
1867 nfs4_set_claim_prev(open, &status); 1859 nfs4_set_claim_prev(open);
1868 /* 1860 /*
1869 * To finish the open response, we just need to set the rflags. 1861 * To finish the open response, we just need to set the rflags.
1870 */ 1862 */
@@ -2738,11 +2730,8 @@ nfsd4_lock(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_lock
2738 CHECK_FH | OPEN_STATE, 2730 CHECK_FH | OPEN_STATE,
2739 &open_sop, &open_stp, 2731 &open_sop, &open_stp,
2740 &lock->v.new.clientid); 2732 &lock->v.new.clientid);
2741 if (status) { 2733 if (status)
2742 if (lock->lk_reclaim)
2743 status = nfserr_reclaim_bad;
2744 goto out; 2734 goto out;
2745 }
2746 /* create lockowner and lock stateid */ 2735 /* create lockowner and lock stateid */
2747 fp = open_stp->st_file; 2736 fp = open_stp->st_file;
2748 strhashval = lock_ownerstr_hashval(fp->fi_inode, 2737 strhashval = lock_ownerstr_hashval(fp->fi_inode,