Commit 4daeed25aded7dd3febaeaf887f0364b5d05899b

Authored by Kinglong Mee
Committed by J. Bruce Fields
1 parent 679b033df4

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>

Showing 1 changed file with 15 additions and 13 deletions Side-by-side Diff

... ... @@ -1273,6 +1273,8 @@
1273 1273 struct nfsd4_op *op;
1274 1274 struct nfsd4_operation *opdesc;
1275 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 1278 int slack_bytes;
1277 1279 u32 plen = 0;
1278 1280 __be32 status;
... ... @@ -1288,11 +1290,11 @@
1288 1290 resp->tag = args->tag;
1289 1291 resp->opcnt = 0;
1290 1292 resp->rqstp = rqstp;
1291   - resp->cstate.minorversion = args->minorversion;
1292   - resp->cstate.replay_owner = NULL;
1293   - resp->cstate.session = NULL;
1294   - fh_init(&resp->cstate.current_fh, NFS4_FHSIZE);
1295   - fh_init(&resp->cstate.save_fh, NFS4_FHSIZE);
  1293 + cstate->minorversion = args->minorversion;
  1294 + cstate->replay_owner = NULL;
  1295 + cstate->session = NULL;
  1296 + fh_init(current_fh, NFS4_FHSIZE);
  1297 + fh_init(save_fh, NFS4_FHSIZE);
1296 1298 /*
1297 1299 * Don't use the deferral mechanism for NFSv4; compounds make it
1298 1300 * too hard to avoid non-idempotency problems.
1299 1301  
... ... @@ -1345,12 +1347,12 @@
1345 1347  
1346 1348 opdesc = OPDESC(op);
1347 1349  
1348   - if (!cstate->current_fh.fh_dentry) {
  1350 + if (!current_fh->fh_dentry) {
1349 1351 if (!(opdesc->op_flags & ALLOWED_WITHOUT_FH)) {
1350 1352 op->status = nfserr_nofilehandle;
1351 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 1356 !(opdesc->op_flags & ALLOWED_ON_ABSENT_FS)) {
1355 1357 op->status = nfserr_moved;
1356 1358 goto encode_op;
1357 1359  
... ... @@ -1383,12 +1385,12 @@
1383 1385 clear_current_stateid(cstate);
1384 1386  
1385 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  
1389 1391 encode_op:
1390 1392 /* Only from SEQUENCE */
1391   - if (resp->cstate.status == nfserr_replay_cache) {
  1393 + if (cstate->status == nfserr_replay_cache) {
1392 1394 dprintk("%s NFS4.1 replay from cache\n", __func__);
1393 1395 status = op->status;
1394 1396 goto out;
... ... @@ -1417,10 +1419,10 @@
1417 1419 nfsd4_increment_op_stats(op->opnum);
1418 1420 }
1419 1421  
1420   - resp->cstate.status = status;
1421   - fh_put(&resp->cstate.current_fh);
1422   - fh_put(&resp->cstate.save_fh);
1423   - BUG_ON(resp->cstate.replay_owner);
  1422 + cstate->status = status;
  1423 + fh_put(current_fh);
  1424 + fh_put(save_fh);
  1425 + BUG_ON(cstate->replay_owner);
1424 1426 out:
1425 1427 /* Reset deferral mechanism for RPC deferrals */
1426 1428 rqstp->rq_usedeferral = 1;