[PATCH] knfsd: nfsd4: move replay_owner to cstate

Tuck away the replay_owner in the cstate while we're at it.

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>
This commit is contained in:
J.Bruce Fields 2006-12-13 00:35:28 -08:00 committed by Linus Torvalds
parent d9e626f1e2
commit a4f1706a9b
3 changed files with 31 additions and 39 deletions

View file

@ -163,7 +163,7 @@ do_open_fhandle(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_
static inline __be32 static inline __be32
nfsd4_open(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, nfsd4_open(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
struct nfsd4_open *open, struct nfs4_stateowner **replay_owner) struct nfsd4_open *open)
{ {
__be32 status; __be32 status;
dprintk("NFSD: nfsd4_open filename %.*s op_stateowner %p\n", dprintk("NFSD: nfsd4_open filename %.*s op_stateowner %p\n",
@ -255,7 +255,7 @@ nfsd4_open(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
out: out:
if (open->op_stateowner) { if (open->op_stateowner) {
nfs4_get_stateowner(open->op_stateowner); nfs4_get_stateowner(open->op_stateowner);
*replay_owner = open->op_stateowner; cstate->replay_owner = open->op_stateowner;
} }
nfs4_unlock_state(); nfs4_unlock_state();
return status; return status;
@ -761,6 +761,7 @@ static void cstate_free(struct nfsd4_compound_state *cstate)
return; return;
fh_put(&cstate->current_fh); fh_put(&cstate->current_fh);
fh_put(&cstate->save_fh); fh_put(&cstate->save_fh);
BUG_ON(cstate->replay_owner);
kfree(cstate); kfree(cstate);
} }
@ -773,6 +774,7 @@ static struct nfsd4_compound_state *cstate_alloc(void)
return NULL; return NULL;
fh_init(&cstate->current_fh, NFS4_FHSIZE); fh_init(&cstate->current_fh, NFS4_FHSIZE);
fh_init(&cstate->save_fh, NFS4_FHSIZE); fh_init(&cstate->save_fh, NFS4_FHSIZE);
cstate->replay_owner = NULL;
return cstate; return cstate;
} }
@ -786,7 +788,6 @@ nfsd4_proc_compound(struct svc_rqst *rqstp,
{ {
struct nfsd4_op *op; struct nfsd4_op *op;
struct nfsd4_compound_state *cstate = NULL; struct nfsd4_compound_state *cstate = NULL;
struct nfs4_stateowner *replay_owner = NULL;
int slack_bytes; int slack_bytes;
__be32 status; __be32 status;
@ -876,7 +877,7 @@ nfsd4_proc_compound(struct svc_rqst *rqstp,
break; break;
case OP_CLOSE: case OP_CLOSE:
op->status = nfsd4_close(rqstp, cstate, op->status = nfsd4_close(rqstp, cstate,
&op->u.close, &replay_owner); &op->u.close);
break; break;
case OP_COMMIT: case OP_COMMIT:
op->status = nfsd4_commit(rqstp, cstate, op->status = nfsd4_commit(rqstp, cstate,
@ -901,15 +902,13 @@ nfsd4_proc_compound(struct svc_rqst *rqstp,
op->status = nfsd4_link(rqstp, cstate, &op->u.link); op->status = nfsd4_link(rqstp, cstate, &op->u.link);
break; break;
case OP_LOCK: case OP_LOCK:
op->status = nfsd4_lock(rqstp, cstate, &op->u.lock, op->status = nfsd4_lock(rqstp, cstate, &op->u.lock);
&replay_owner);
break; break;
case OP_LOCKT: case OP_LOCKT:
op->status = nfsd4_lockt(rqstp, cstate, &op->u.lockt); op->status = nfsd4_lockt(rqstp, cstate, &op->u.lockt);
break; break;
case OP_LOCKU: case OP_LOCKU:
op->status = nfsd4_locku(rqstp, cstate, &op->u.locku, op->status = nfsd4_locku(rqstp, cstate, &op->u.locku);
&replay_owner);
break; break;
case OP_LOOKUP: case OP_LOOKUP:
op->status = nfsd4_lookup(rqstp, cstate, op->status = nfsd4_lookup(rqstp, cstate,
@ -926,17 +925,15 @@ nfsd4_proc_compound(struct svc_rqst *rqstp,
break; break;
case OP_OPEN: case OP_OPEN:
op->status = nfsd4_open(rqstp, cstate, op->status = nfsd4_open(rqstp, cstate,
&op->u.open, &replay_owner); &op->u.open);
break; break;
case OP_OPEN_CONFIRM: case OP_OPEN_CONFIRM:
op->status = nfsd4_open_confirm(rqstp, cstate, op->status = nfsd4_open_confirm(rqstp, cstate,
&op->u.open_confirm, &op->u.open_confirm);
&replay_owner);
break; break;
case OP_OPEN_DOWNGRADE: case OP_OPEN_DOWNGRADE:
op->status = nfsd4_open_downgrade(rqstp, cstate, op->status = nfsd4_open_downgrade(rqstp, cstate,
&op->u.open_downgrade, &op->u.open_downgrade);
&replay_owner);
break; break;
case OP_PUTFH: case OP_PUTFH:
op->status = nfsd4_putfh(rqstp, cstate, &op->u.putfh); op->status = nfsd4_putfh(rqstp, cstate, &op->u.putfh);
@ -1001,16 +998,16 @@ nfsd4_proc_compound(struct svc_rqst *rqstp,
encode_op: encode_op:
if (op->status == nfserr_replay_me) { if (op->status == nfserr_replay_me) {
op->replay = &replay_owner->so_replay; op->replay = &cstate->replay_owner->so_replay;
nfsd4_encode_replay(resp, op); nfsd4_encode_replay(resp, op);
status = op->status = op->replay->rp_status; status = op->status = op->replay->rp_status;
} else { } else {
nfsd4_encode_operation(resp, op); nfsd4_encode_operation(resp, op);
status = op->status; status = op->status;
} }
if (replay_owner) { if (cstate->replay_owner) {
nfs4_put_stateowner(replay_owner); nfs4_put_stateowner(cstate->replay_owner);
replay_owner = NULL; cstate->replay_owner = NULL;
} }
/* XXX Ugh, we need to get rid of this kind of special case: */ /* XXX Ugh, we need to get rid of this kind of special case: */
if (op->opnum == OP_READ && op->u.read.rd_filp) if (op->opnum == OP_READ && op->u.read.rd_filp)

View file

@ -2242,8 +2242,7 @@ nfs4_preprocess_seqid_op(struct svc_fh *current_fh, u32 seqid, stateid_t *statei
__be32 __be32
nfsd4_open_confirm(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, nfsd4_open_confirm(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
struct nfsd4_open_confirm *oc, struct nfsd4_open_confirm *oc)
struct nfs4_stateowner **replay_owner)
{ {
__be32 status; __be32 status;
struct nfs4_stateowner *sop; struct nfs4_stateowner *sop;
@ -2280,7 +2279,7 @@ nfsd4_open_confirm(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
out: out:
if (oc->oc_stateowner) { if (oc->oc_stateowner) {
nfs4_get_stateowner(oc->oc_stateowner); nfs4_get_stateowner(oc->oc_stateowner);
*replay_owner = oc->oc_stateowner; cstate->replay_owner = oc->oc_stateowner;
} }
nfs4_unlock_state(); nfs4_unlock_state();
return status; return status;
@ -2314,8 +2313,7 @@ reset_union_bmap_deny(unsigned long deny, unsigned long *bmap)
__be32 __be32
nfsd4_open_downgrade(struct svc_rqst *rqstp, nfsd4_open_downgrade(struct svc_rqst *rqstp,
struct nfsd4_compound_state *cstate, struct nfsd4_compound_state *cstate,
struct nfsd4_open_downgrade *od, struct nfsd4_open_downgrade *od)
struct nfs4_stateowner **replay_owner)
{ {
__be32 status; __be32 status;
struct nfs4_stateid *stp; struct nfs4_stateid *stp;
@ -2361,7 +2359,7 @@ nfsd4_open_downgrade(struct svc_rqst *rqstp,
out: out:
if (od->od_stateowner) { if (od->od_stateowner) {
nfs4_get_stateowner(od->od_stateowner); nfs4_get_stateowner(od->od_stateowner);
*replay_owner = od->od_stateowner; cstate->replay_owner = od->od_stateowner;
} }
nfs4_unlock_state(); nfs4_unlock_state();
return status; return status;
@ -2372,7 +2370,7 @@ nfsd4_open_downgrade(struct svc_rqst *rqstp,
*/ */
__be32 __be32
nfsd4_close(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, nfsd4_close(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
struct nfsd4_close *close, struct nfs4_stateowner **replay_owner) struct nfsd4_close *close)
{ {
__be32 status; __be32 status;
struct nfs4_stateid *stp; struct nfs4_stateid *stp;
@ -2405,7 +2403,7 @@ nfsd4_close(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
out: out:
if (close->cl_stateowner) { if (close->cl_stateowner) {
nfs4_get_stateowner(close->cl_stateowner); nfs4_get_stateowner(close->cl_stateowner);
*replay_owner = close->cl_stateowner; cstate->replay_owner = close->cl_stateowner;
} }
nfs4_unlock_state(); nfs4_unlock_state();
return status; return status;
@ -2646,7 +2644,7 @@ check_lock_length(u64 offset, u64 length)
*/ */
__be32 __be32
nfsd4_lock(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, nfsd4_lock(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
struct nfsd4_lock *lock, struct nfs4_stateowner **replay_owner) struct nfsd4_lock *lock)
{ {
struct nfs4_stateowner *open_sop = NULL; struct nfs4_stateowner *open_sop = NULL;
struct nfs4_stateowner *lock_sop = NULL; struct nfs4_stateowner *lock_sop = NULL;
@ -2796,7 +2794,7 @@ nfsd4_lock(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
release_stateowner(lock_sop); release_stateowner(lock_sop);
if (lock->lk_replay_owner) { if (lock->lk_replay_owner) {
nfs4_get_stateowner(lock->lk_replay_owner); nfs4_get_stateowner(lock->lk_replay_owner);
*replay_owner = lock->lk_replay_owner; cstate->replay_owner = lock->lk_replay_owner;
} }
nfs4_unlock_state(); nfs4_unlock_state();
return status; return status;
@ -2888,7 +2886,7 @@ nfsd4_lockt(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
__be32 __be32
nfsd4_locku(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, nfsd4_locku(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
struct nfsd4_locku *locku, struct nfs4_stateowner **replay_owner) struct nfsd4_locku *locku)
{ {
struct nfs4_stateid *stp; struct nfs4_stateid *stp;
struct file *filp = NULL; struct file *filp = NULL;
@ -2946,7 +2944,7 @@ nfsd4_locku(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
out: out:
if (locku->lu_stateowner) { if (locku->lu_stateowner) {
nfs4_get_stateowner(locku->lu_stateowner); nfs4_get_stateowner(locku->lu_stateowner);
*replay_owner = locku->lu_stateowner; cstate->replay_owner = locku->lu_stateowner;
} }
nfs4_unlock_state(); nfs4_unlock_state();
return status; return status;

View file

@ -47,6 +47,7 @@
struct nfsd4_compound_state { struct nfsd4_compound_state {
struct svc_fh current_fh; struct svc_fh current_fh;
struct svc_fh save_fh; struct svc_fh save_fh;
struct nfs4_stateowner *replay_owner;
}; };
struct nfsd4_change_info { struct nfsd4_change_info {
@ -442,25 +443,21 @@ extern __be32 nfsd4_process_open1(struct nfsd4_open *open);
extern __be32 nfsd4_process_open2(struct svc_rqst *rqstp, extern __be32 nfsd4_process_open2(struct svc_rqst *rqstp,
struct svc_fh *current_fh, struct nfsd4_open *open); struct svc_fh *current_fh, struct nfsd4_open *open);
extern __be32 nfsd4_open_confirm(struct svc_rqst *rqstp, extern __be32 nfsd4_open_confirm(struct svc_rqst *rqstp,
struct nfsd4_compound_state *, struct nfsd4_open_confirm *oc, struct nfsd4_compound_state *, struct nfsd4_open_confirm *oc);
struct nfs4_stateowner **);
extern __be32 nfsd4_close(struct svc_rqst *rqstp, extern __be32 nfsd4_close(struct svc_rqst *rqstp,
struct nfsd4_compound_state *, struct nfsd4_compound_state *,
struct nfsd4_close *close, struct nfsd4_close *close);
struct nfs4_stateowner **replay_owner);
extern __be32 nfsd4_open_downgrade(struct svc_rqst *rqstp, extern __be32 nfsd4_open_downgrade(struct svc_rqst *rqstp,
struct nfsd4_compound_state *, struct nfsd4_open_downgrade *od, struct nfsd4_compound_state *,
struct nfs4_stateowner **replay_owner); struct nfsd4_open_downgrade *od);
extern __be32 nfsd4_lock(struct svc_rqst *rqstp, struct nfsd4_compound_state *, extern __be32 nfsd4_lock(struct svc_rqst *rqstp, struct nfsd4_compound_state *,
struct nfsd4_lock *lock, struct nfsd4_lock *lock);
struct nfs4_stateowner **replay_owner);
extern __be32 nfsd4_lockt(struct svc_rqst *rqstp, extern __be32 nfsd4_lockt(struct svc_rqst *rqstp,
struct nfsd4_compound_state *, struct nfsd4_compound_state *,
struct nfsd4_lockt *lockt); struct nfsd4_lockt *lockt);
extern __be32 nfsd4_locku(struct svc_rqst *rqstp, extern __be32 nfsd4_locku(struct svc_rqst *rqstp,
struct nfsd4_compound_state *, struct nfsd4_compound_state *,
struct nfsd4_locku *locku, struct nfsd4_locku *locku);
struct nfs4_stateowner **replay_owner);
extern __be32 extern __be32
nfsd4_release_lockowner(struct svc_rqst *rqstp, nfsd4_release_lockowner(struct svc_rqst *rqstp,
struct nfsd4_release_lockowner *rlockowner); struct nfsd4_release_lockowner *rlockowner);