aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2014-08-21 12:09:20 -0400
committerTrond Myklebust <trond.myklebust@primarydata.com>2014-09-10 15:47:01 -0400
commit362f74745c15fb9acad577ab8e1342ee5313a2a5 (patch)
tree309e11b87198db5e8f0698be50749967dcfbca83
parent1013df61150e56f775ccacdaaeee66042f1e6eb6 (diff)
pnfs: don't check sequence on new stateids in layoutget
When layoutget returns an entirely new layout stateid it should not check the generation counter as the new stateid will start with a new counter entirely unrelated to old one. The current behavior causes constant layoutget failures against a block server which allocates a new stateid after an recall that removed all outstanding layouts. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
-rw-r--r--fs/nfs/pnfs.c36
1 files changed, 19 insertions, 17 deletions
diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
index 0e0364ca877d..ff7fabe33529 100644
--- a/fs/nfs/pnfs.c
+++ b/fs/nfs/pnfs.c
@@ -682,17 +682,6 @@ static bool pnfs_seqid_is_newer(u32 s1, u32 s2)
682 return (s32)(s1 - s2) > 0; 682 return (s32)(s1 - s2) > 0;
683} 683}
684 684
685static void
686pnfs_verify_layout_stateid(struct pnfs_layout_hdr *lo,
687 const nfs4_stateid *new,
688 struct list_head *free_me_list)
689{
690 if (nfs4_stateid_match_other(&lo->plh_stateid, new))
691 return;
692 /* Layout is new! Kill existing layout segments */
693 pnfs_mark_matching_lsegs_invalid(lo, free_me_list, NULL);
694}
695
696/* update lo->plh_stateid with new if is more recent */ 685/* update lo->plh_stateid with new if is more recent */
697void 686void
698pnfs_set_layout_stateid(struct pnfs_layout_hdr *lo, const nfs4_stateid *new, 687pnfs_set_layout_stateid(struct pnfs_layout_hdr *lo, const nfs4_stateid *new,
@@ -1367,16 +1356,29 @@ pnfs_layout_process(struct nfs4_layoutget *lgp)
1367 goto out_forget_reply; 1356 goto out_forget_reply;
1368 } 1357 }
1369 1358
1370 if (pnfs_layoutgets_blocked(lo, 1) || 1359 if (pnfs_layoutgets_blocked(lo, 1)) {
1371 pnfs_layout_stateid_blocked(lo, &res->stateid)) {
1372 dprintk("%s forget reply due to state\n", __func__); 1360 dprintk("%s forget reply due to state\n", __func__);
1373 goto out_forget_reply; 1361 goto out_forget_reply;
1374 } 1362 }
1375 1363
1376 /* Check that the new stateid matches the old stateid */ 1364 if (nfs4_stateid_match_other(&lo->plh_stateid, &res->stateid)) {
1377 pnfs_verify_layout_stateid(lo, &res->stateid, &free_me); 1365 /* existing state ID, make sure the sequence number matches. */
1378 /* Done processing layoutget. Set the layout stateid */ 1366 if (pnfs_layout_stateid_blocked(lo, &res->stateid)) {
1379 pnfs_set_layout_stateid(lo, &res->stateid, false); 1367 dprintk("%s forget reply due to sequence\n", __func__);
1368 goto out_forget_reply;
1369 }
1370 pnfs_set_layout_stateid(lo, &res->stateid, false);
1371 } else {
1372 /*
1373 * We got an entirely new state ID. Mark all segments for the
1374 * inode invalid, and don't bother validating the stateid
1375 * sequence number.
1376 */
1377 pnfs_mark_matching_lsegs_invalid(lo, &free_me, NULL);
1378
1379 nfs4_stateid_copy(&lo->plh_stateid, &res->stateid);
1380 lo->plh_barrier = be32_to_cpu(res->stateid.seqid);
1381 }
1380 1382
1381 pnfs_get_lseg(lseg); 1383 pnfs_get_lseg(lseg);
1382 pnfs_layout_insert_lseg(lo, lseg); 1384 pnfs_layout_insert_lseg(lo, lseg);