Commit 2b5d018f authored by Neil Brown's avatar Neil Brown Committed by Linus Torvalds

[PATCH] fix in NFSv4 server for bad sequence id errors

From: "William A.(Andy) Adamson" <andros@citi.umich.edu>

this patch fixes the share state sequenceid bookeeping.

- increment the sequence id on an open that is confirmed
- increment the sequence id on close
parent cf430fc8
...@@ -846,7 +846,7 @@ release_file(struct nfs4_file *fp) ...@@ -846,7 +846,7 @@ release_file(struct nfs4_file *fp)
} }
void void
release_open_state(struct nfs4_stateid *stp) release_open_state(struct nfs4_stateid *stp, struct nfsd4_close *cl)
{ {
struct nfs4_stateowner *sop = stp->st_stateowner; struct nfs4_stateowner *sop = stp->st_stateowner;
struct nfs4_file *fp = stp->st_file; struct nfs4_file *fp = stp->st_file;
...@@ -861,6 +861,7 @@ release_open_state(struct nfs4_stateid *stp) ...@@ -861,6 +861,7 @@ release_open_state(struct nfs4_stateid *stp)
*/ */
if (sop->so_confirmed && list_empty(&sop->so_peropenstate)) { if (sop->so_confirmed && list_empty(&sop->so_peropenstate)) {
release_stateowner(sop); release_stateowner(sop);
cl->cl_stateowner = NULL;
} }
/* unused nfs4_file's are releseed. XXX slab cache? */ /* unused nfs4_file's are releseed. XXX slab cache? */
if (list_empty(&fp->fi_perfile)) { if (list_empty(&fp->fi_perfile)) {
...@@ -1573,7 +1574,7 @@ nfsd4_close(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_clos ...@@ -1573,7 +1574,7 @@ nfsd4_close(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_clos
memcpy(&close->cl_stateid, &stp->st_stateid, sizeof(stateid_t)); memcpy(&close->cl_stateid, &stp->st_stateid, sizeof(stateid_t));
/* release_open_state() calls nfsd_close() if needed */ /* release_open_state() calls nfsd_close() if needed */
release_open_state(stp); release_open_state(stp,close);
out: out:
up(&client_sema); up(&client_sema);
return status; return status;
......
...@@ -1631,6 +1631,8 @@ nfsd4_encode_close(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_clos ...@@ -1631,6 +1631,8 @@ nfsd4_encode_close(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_clos
WRITEMEM(&close->cl_stateid.si_opaque, sizeof(stateid_opaque_t)); WRITEMEM(&close->cl_stateid.si_opaque, sizeof(stateid_opaque_t));
ADJUST_ARGS(); ADJUST_ARGS();
} }
if ((close->cl_stateowner) && (close->cl_stateowner->so_confirmed))
close->cl_stateowner->so_seqid++;
} }
...@@ -1767,6 +1769,8 @@ nfsd4_encode_open(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_open ...@@ -1767,6 +1769,8 @@ nfsd4_encode_open(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_open
default: default:
BUG(); BUG();
} }
ENCODE_SEQID_OP_TAIL(open->op_stateowner);
} }
static int static int
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment