aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2012-10-02 19:56:49 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2012-10-02 20:04:33 -0400
commit25a1a6211dd2fcbf0e45a07030703e2a42d7aa87 (patch)
treea5ce8e2a2deb46a9f52dc7f980a918ed25067b80 /fs
parent5a65503f3dbdb4aa1cd6cb58c479c015d093292b (diff)
NFSv4.1: Deal with wraparound when updating the layout "barrier" seqid
...and fix a bug in pnfs_set_layout_stateid. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/nfs/pnfs.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
index f1387e87513f..de827251bdac 100644
--- a/fs/nfs/pnfs.c
+++ b/fs/nfs/pnfs.c
@@ -572,7 +572,7 @@ pnfs_set_layout_stateid(struct pnfs_layout_hdr *lo, const nfs4_stateid *new,
572 if (update_barrier) { 572 if (update_barrier) {
573 u32 new_barrier = be32_to_cpu(new->seqid); 573 u32 new_barrier = be32_to_cpu(new->seqid);
574 574
575 if ((int)(new_barrier - lo->plh_barrier)) 575 if (pnfs_seqid_is_newer(new_barrier, lo->plh_barrier))
576 lo->plh_barrier = new_barrier; 576 lo->plh_barrier = new_barrier;
577 } else { 577 } else {
578 /* Because of wraparound, we want to keep the barrier 578 /* Because of wraparound, we want to keep the barrier
@@ -593,9 +593,12 @@ static bool
593pnfs_layoutgets_blocked(struct pnfs_layout_hdr *lo, nfs4_stateid *stateid, 593pnfs_layoutgets_blocked(struct pnfs_layout_hdr *lo, nfs4_stateid *stateid,
594 int lget) 594 int lget)
595{ 595{
596 if ((stateid) && 596 if (stateid != NULL) {
597 (int)(lo->plh_barrier - be32_to_cpu(stateid->seqid)) >= 0) 597 u32 seqid = be32_to_cpu(stateid->seqid);
598 return true; 598
599 if (!pnfs_seqid_is_newer(seqid, lo->plh_barrier))
600 return true;
601 }
599 return lo->plh_block_lgets || 602 return lo->plh_block_lgets ||
600 test_bit(NFS_LAYOUT_BULK_RECALL, &lo->plh_flags) || 603 test_bit(NFS_LAYOUT_BULK_RECALL, &lo->plh_flags) ||
601 (list_empty(&lo->plh_segs) && 604 (list_empty(&lo->plh_segs) &&