Commit f2327d9a authored by Neil Brown's avatar Neil Brown Committed by Linus Torvalds

[PATCH] nfsd4: move replay_owner

It seems more natural to move the setting of the replay_owner into the
relevant procedure instead of doing it in nfsv4_proc_compound.
Signed-off-by: default avatarJ. Bruce Fields <bfields@citi.umich.edu>
Signed-off-by: default avatarNeil Brown <neilb@suse.de>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 849823c5
...@@ -162,7 +162,7 @@ do_open_fhandle(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_ ...@@ -162,7 +162,7 @@ do_open_fhandle(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_
static inline int static inline int
nfsd4_open(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_open *open) nfsd4_open(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_open *open, struct nfs4_stateowner **replay_owner)
{ {
int status; int status;
dprintk("NFSD: nfsd4_open filename %.*s op_stateowner %p\n", dprintk("NFSD: nfsd4_open filename %.*s op_stateowner %p\n",
...@@ -238,8 +238,10 @@ nfsd4_open(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_open ...@@ -238,8 +238,10 @@ nfsd4_open(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_open
*/ */
status = nfsd4_process_open2(rqstp, current_fh, open); status = nfsd4_process_open2(rqstp, current_fh, open);
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;
}
nfs4_unlock_state(); nfs4_unlock_state();
return status; return status;
} }
...@@ -809,8 +811,7 @@ nfsd4_proc_compound(struct svc_rqst *rqstp, ...@@ -809,8 +811,7 @@ nfsd4_proc_compound(struct svc_rqst *rqstp,
op->status = nfsd4_access(rqstp, current_fh, &op->u.access); op->status = nfsd4_access(rqstp, current_fh, &op->u.access);
break; break;
case OP_CLOSE: case OP_CLOSE:
op->status = nfsd4_close(rqstp, current_fh, &op->u.close); op->status = nfsd4_close(rqstp, current_fh, &op->u.close, &replay_owner);
replay_owner = op->u.close.cl_stateowner;
break; break;
case OP_COMMIT: case OP_COMMIT:
op->status = nfsd4_commit(rqstp, current_fh, &op->u.commit); op->status = nfsd4_commit(rqstp, current_fh, &op->u.commit);
...@@ -831,15 +832,13 @@ nfsd4_proc_compound(struct svc_rqst *rqstp, ...@@ -831,15 +832,13 @@ nfsd4_proc_compound(struct svc_rqst *rqstp,
op->status = nfsd4_link(rqstp, current_fh, save_fh, &op->u.link); op->status = nfsd4_link(rqstp, current_fh, save_fh, &op->u.link);
break; break;
case OP_LOCK: case OP_LOCK:
op->status = nfsd4_lock(rqstp, current_fh, &op->u.lock); op->status = nfsd4_lock(rqstp, current_fh, &op->u.lock, &replay_owner);
replay_owner = op->u.lock.lk_stateowner;
break; break;
case OP_LOCKT: case OP_LOCKT:
op->status = nfsd4_lockt(rqstp, current_fh, &op->u.lockt); op->status = nfsd4_lockt(rqstp, current_fh, &op->u.lockt);
break; break;
case OP_LOCKU: case OP_LOCKU:
op->status = nfsd4_locku(rqstp, current_fh, &op->u.locku); op->status = nfsd4_locku(rqstp, current_fh, &op->u.locku, &replay_owner);
replay_owner = op->u.locku.lu_stateowner;
break; break;
case OP_LOOKUP: case OP_LOOKUP:
op->status = nfsd4_lookup(rqstp, current_fh, &op->u.lookup); op->status = nfsd4_lookup(rqstp, current_fh, &op->u.lookup);
...@@ -853,16 +852,13 @@ nfsd4_proc_compound(struct svc_rqst *rqstp, ...@@ -853,16 +852,13 @@ nfsd4_proc_compound(struct svc_rqst *rqstp,
op->status = nfs_ok; op->status = nfs_ok;
break; break;
case OP_OPEN: case OP_OPEN:
op->status = nfsd4_open(rqstp, current_fh, &op->u.open); op->status = nfsd4_open(rqstp, current_fh, &op->u.open, &replay_owner);
replay_owner = op->u.open.op_stateowner;
break; break;
case OP_OPEN_CONFIRM: case OP_OPEN_CONFIRM:
op->status = nfsd4_open_confirm(rqstp, current_fh, &op->u.open_confirm); op->status = nfsd4_open_confirm(rqstp, current_fh, &op->u.open_confirm, &replay_owner);
replay_owner = op->u.open_confirm.oc_stateowner;
break; break;
case OP_OPEN_DOWNGRADE: case OP_OPEN_DOWNGRADE:
op->status = nfsd4_open_downgrade(rqstp, current_fh, &op->u.open_downgrade); op->status = nfsd4_open_downgrade(rqstp, current_fh, &op->u.open_downgrade, &replay_owner);
replay_owner = op->u.open_downgrade.od_stateowner;
break; break;
case OP_PUTFH: case OP_PUTFH:
op->status = nfsd4_putfh(rqstp, current_fh, &op->u.putfh); op->status = nfsd4_putfh(rqstp, current_fh, &op->u.putfh);
......
...@@ -2286,7 +2286,7 @@ nfs4_preprocess_seqid_op(struct svc_fh *current_fh, u32 seqid, stateid_t *statei ...@@ -2286,7 +2286,7 @@ nfs4_preprocess_seqid_op(struct svc_fh *current_fh, u32 seqid, stateid_t *statei
} }
int int
nfsd4_open_confirm(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_open_confirm *oc) nfsd4_open_confirm(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_open_confirm *oc, struct nfs4_stateowner **replay_owner)
{ {
int status; int status;
struct nfs4_stateowner *sop; struct nfs4_stateowner *sop;
...@@ -2320,8 +2320,10 @@ nfsd4_open_confirm(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfs ...@@ -2320,8 +2320,10 @@ nfsd4_open_confirm(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfs
nfsd4_create_clid_dir(sop->so_client); nfsd4_create_clid_dir(sop->so_client);
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;
}
nfs4_unlock_state(); nfs4_unlock_state();
return status; return status;
} }
...@@ -2352,7 +2354,7 @@ reset_union_bmap_deny(unsigned long deny, unsigned long *bmap) ...@@ -2352,7 +2354,7 @@ reset_union_bmap_deny(unsigned long deny, unsigned long *bmap)
} }
int int
nfsd4_open_downgrade(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_open_downgrade *od) nfsd4_open_downgrade(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_open_downgrade *od, struct nfs4_stateowner **replay_owner)
{ {
int status; int status;
struct nfs4_stateid *stp; struct nfs4_stateid *stp;
...@@ -2394,8 +2396,10 @@ nfsd4_open_downgrade(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct n ...@@ -2394,8 +2396,10 @@ nfsd4_open_downgrade(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct n
memcpy(&od->od_stateid, &stp->st_stateid, sizeof(stateid_t)); memcpy(&od->od_stateid, &stp->st_stateid, sizeof(stateid_t));
status = nfs_ok; status = nfs_ok;
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;
}
nfs4_unlock_state(); nfs4_unlock_state();
return status; return status;
} }
...@@ -2404,7 +2408,7 @@ nfsd4_open_downgrade(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct n ...@@ -2404,7 +2408,7 @@ nfsd4_open_downgrade(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct n
* nfs4_unlock_state() called after encode * nfs4_unlock_state() called after encode
*/ */
int int
nfsd4_close(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_close *close) nfsd4_close(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_close *close, struct nfs4_stateowner **replay_owner)
{ {
int status; int status;
struct nfs4_stateid *stp; struct nfs4_stateid *stp;
...@@ -2430,8 +2434,10 @@ nfsd4_close(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_clos ...@@ -2430,8 +2434,10 @@ nfsd4_close(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_clos
/* release_state_owner() calls nfsd_close() if needed */ /* release_state_owner() calls nfsd_close() if needed */
release_state_owner(stp, OPEN_STATE); release_state_owner(stp, OPEN_STATE);
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;
}
nfs4_unlock_state(); nfs4_unlock_state();
return status; return status;
} }
...@@ -2675,7 +2681,7 @@ check_lock_length(u64 offset, u64 length) ...@@ -2675,7 +2681,7 @@ check_lock_length(u64 offset, u64 length)
* LOCK operation * LOCK operation
*/ */
int int
nfsd4_lock(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_lock *lock) nfsd4_lock(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_lock *lock, struct nfs4_stateowner **replay_owner)
{ {
struct nfs4_stateowner *open_sop = NULL; struct nfs4_stateowner *open_sop = NULL;
struct nfs4_stateid *lock_stp; struct nfs4_stateid *lock_stp;
...@@ -2835,8 +2841,10 @@ nfsd4_lock(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_lock ...@@ -2835,8 +2841,10 @@ nfsd4_lock(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_lock
release_state_owner(lock_stp, LOCK_STATE); release_state_owner(lock_stp, LOCK_STATE);
} }
out: out:
if (lock->lk_stateowner) if (lock->lk_stateowner) {
nfs4_get_stateowner(lock->lk_stateowner); nfs4_get_stateowner(lock->lk_stateowner);
*replay_owner = lock->lk_stateowner;
}
nfs4_unlock_state(); nfs4_unlock_state();
return status; return status;
} }
...@@ -2925,7 +2933,7 @@ nfsd4_lockt(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_lock ...@@ -2925,7 +2933,7 @@ nfsd4_lockt(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_lock
} }
int int
nfsd4_locku(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_locku *locku) nfsd4_locku(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_locku *locku, struct nfs4_stateowner **replay_owner)
{ {
struct nfs4_stateid *stp; struct nfs4_stateid *stp;
struct file *filp = NULL; struct file *filp = NULL;
...@@ -2981,8 +2989,10 @@ nfsd4_locku(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_lock ...@@ -2981,8 +2989,10 @@ nfsd4_locku(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_lock
memcpy(&locku->lu_stateid, &stp->st_stateid, sizeof(stateid_t)); memcpy(&locku->lu_stateid, &stp->st_stateid, sizeof(stateid_t));
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;
}
nfs4_unlock_state(); nfs4_unlock_state();
return status; return status;
......
...@@ -438,17 +438,22 @@ extern int nfsd4_process_open1(struct nfsd4_open *open); ...@@ -438,17 +438,22 @@ extern int nfsd4_process_open1(struct nfsd4_open *open);
extern int nfsd4_process_open2(struct svc_rqst *rqstp, extern int 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 int nfsd4_open_confirm(struct svc_rqst *rqstp, extern int nfsd4_open_confirm(struct svc_rqst *rqstp,
struct svc_fh *current_fh, struct nfsd4_open_confirm *oc); struct svc_fh *current_fh, struct nfsd4_open_confirm *oc,
struct nfs4_stateowner **);
extern int nfsd4_close(struct svc_rqst *rqstp, struct svc_fh *current_fh, extern int nfsd4_close(struct svc_rqst *rqstp, struct svc_fh *current_fh,
struct nfsd4_close *close); struct nfsd4_close *close,
struct nfs4_stateowner **replay_owner);
extern int nfsd4_open_downgrade(struct svc_rqst *rqstp, extern int nfsd4_open_downgrade(struct svc_rqst *rqstp,
struct svc_fh *current_fh, struct nfsd4_open_downgrade *od); struct svc_fh *current_fh, struct nfsd4_open_downgrade *od,
struct nfs4_stateowner **replay_owner);
extern int nfsd4_lock(struct svc_rqst *rqstp, struct svc_fh *current_fh, extern int nfsd4_lock(struct svc_rqst *rqstp, struct svc_fh *current_fh,
struct nfsd4_lock *lock); struct nfsd4_lock *lock,
struct nfs4_stateowner **replay_owner);
extern int nfsd4_lockt(struct svc_rqst *rqstp, struct svc_fh *current_fh, extern int nfsd4_lockt(struct svc_rqst *rqstp, struct svc_fh *current_fh,
struct nfsd4_lockt *lockt); struct nfsd4_lockt *lockt);
extern int nfsd4_locku(struct svc_rqst *rqstp, struct svc_fh *current_fh, extern int nfsd4_locku(struct svc_rqst *rqstp, struct svc_fh *current_fh,
struct nfsd4_locku *locku); struct nfsd4_locku *locku,
struct nfs4_stateowner **replay_owner);
extern int extern int
nfsd4_release_lockowner(struct svc_rqst *rqstp, nfsd4_release_lockowner(struct svc_rqst *rqstp,
struct nfsd4_release_lockowner *rlockowner); struct nfsd4_release_lockowner *rlockowner);
......
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