aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfsd/nfs4proc.c
diff options
context:
space:
mode:
authorKinglong Mee <kinglongmee@gmail.com>2014-03-26 05:10:37 -0400
committerJ. Bruce Fields <bfields@redhat.com>2014-03-28 18:01:40 -0400
commit4daeed25aded7dd3febaeaf887f0364b5d05899b (patch)
tree628b280b9b870a998947043c4b14b18ea21183b0 /fs/nfsd/nfs4proc.c
parent679b033df48422191c4cac52b610d9980e019f9b (diff)
NFSD: simplify saved/current fh uses in nfsd4_proc_compound
Signed-off-by: Kinglong Mee <kinglongmee@gmail.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'fs/nfsd/nfs4proc.c')
-rw-r--r--fs/nfsd/nfs4proc.c28
1 files changed, 15 insertions, 13 deletions
diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c
index b9048e5e349e..b8ad1c518bc0 100644
--- a/fs/nfsd/nfs4proc.c
+++ b/fs/nfsd/nfs4proc.c
@@ -1273,6 +1273,8 @@ nfsd4_proc_compound(struct svc_rqst *rqstp,
1273 struct nfsd4_op *op; 1273 struct nfsd4_op *op;
1274 struct nfsd4_operation *opdesc; 1274 struct nfsd4_operation *opdesc;
1275 struct nfsd4_compound_state *cstate = &resp->cstate; 1275 struct nfsd4_compound_state *cstate = &resp->cstate;
1276 struct svc_fh *current_fh = &cstate->current_fh;
1277 struct svc_fh *save_fh = &cstate->save_fh;
1276 int slack_bytes; 1278 int slack_bytes;
1277 u32 plen = 0; 1279 u32 plen = 0;
1278 __be32 status; 1280 __be32 status;
@@ -1288,11 +1290,11 @@ nfsd4_proc_compound(struct svc_rqst *rqstp,
1288 resp->tag = args->tag; 1290 resp->tag = args->tag;
1289 resp->opcnt = 0; 1291 resp->opcnt = 0;
1290 resp->rqstp = rqstp; 1292 resp->rqstp = rqstp;
1291 resp->cstate.minorversion = args->minorversion; 1293 cstate->minorversion = args->minorversion;
1292 resp->cstate.replay_owner = NULL; 1294 cstate->replay_owner = NULL;
1293 resp->cstate.session = NULL; 1295 cstate->session = NULL;
1294 fh_init(&resp->cstate.current_fh, NFS4_FHSIZE); 1296 fh_init(current_fh, NFS4_FHSIZE);
1295 fh_init(&resp->cstate.save_fh, NFS4_FHSIZE); 1297 fh_init(save_fh, NFS4_FHSIZE);
1296 /* 1298 /*
1297 * Don't use the deferral mechanism for NFSv4; compounds make it 1299 * Don't use the deferral mechanism for NFSv4; compounds make it
1298 * too hard to avoid non-idempotency problems. 1300 * too hard to avoid non-idempotency problems.
@@ -1345,12 +1347,12 @@ nfsd4_proc_compound(struct svc_rqst *rqstp,
1345 1347
1346 opdesc = OPDESC(op); 1348 opdesc = OPDESC(op);
1347 1349
1348 if (!cstate->current_fh.fh_dentry) { 1350 if (!current_fh->fh_dentry) {
1349 if (!(opdesc->op_flags & ALLOWED_WITHOUT_FH)) { 1351 if (!(opdesc->op_flags & ALLOWED_WITHOUT_FH)) {
1350 op->status = nfserr_nofilehandle; 1352 op->status = nfserr_nofilehandle;
1351 goto encode_op; 1353 goto encode_op;
1352 } 1354 }
1353 } else if (cstate->current_fh.fh_export->ex_fslocs.migrated && 1355 } else if (current_fh->fh_export->ex_fslocs.migrated &&
1354 !(opdesc->op_flags & ALLOWED_ON_ABSENT_FS)) { 1356 !(opdesc->op_flags & ALLOWED_ON_ABSENT_FS)) {
1355 op->status = nfserr_moved; 1357 op->status = nfserr_moved;
1356 goto encode_op; 1358 goto encode_op;
@@ -1383,12 +1385,12 @@ nfsd4_proc_compound(struct svc_rqst *rqstp,
1383 clear_current_stateid(cstate); 1385 clear_current_stateid(cstate);
1384 1386
1385 if (need_wrongsec_check(rqstp)) 1387 if (need_wrongsec_check(rqstp))
1386 op->status = check_nfsd_access(cstate->current_fh.fh_export, rqstp); 1388 op->status = check_nfsd_access(current_fh->fh_export, rqstp);
1387 } 1389 }
1388 1390
1389encode_op: 1391encode_op:
1390 /* Only from SEQUENCE */ 1392 /* Only from SEQUENCE */
1391 if (resp->cstate.status == nfserr_replay_cache) { 1393 if (cstate->status == nfserr_replay_cache) {
1392 dprintk("%s NFS4.1 replay from cache\n", __func__); 1394 dprintk("%s NFS4.1 replay from cache\n", __func__);
1393 status = op->status; 1395 status = op->status;
1394 goto out; 1396 goto out;
@@ -1417,10 +1419,10 @@ encode_op:
1417 nfsd4_increment_op_stats(op->opnum); 1419 nfsd4_increment_op_stats(op->opnum);
1418 } 1420 }
1419 1421
1420 resp->cstate.status = status; 1422 cstate->status = status;
1421 fh_put(&resp->cstate.current_fh); 1423 fh_put(current_fh);
1422 fh_put(&resp->cstate.save_fh); 1424 fh_put(save_fh);
1423 BUG_ON(resp->cstate.replay_owner); 1425 BUG_ON(cstate->replay_owner);
1424out: 1426out:
1425 /* Reset deferral mechanism for RPC deferrals */ 1427 /* Reset deferral mechanism for RPC deferrals */
1426 rqstp->rq_usedeferral = 1; 1428 rqstp->rq_usedeferral = 1;