summaryrefslogtreecommitdiff
path: root/fs/nfs
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2012-10-02 16:56:49 -0700
committerTrond Myklebust <Trond.Myklebust@netapp.com>2012-10-02 17:04:33 -0700
commit25a1a6211dd2fcbf0e45a07030703e2a42d7aa87 (patch)
treea5ce8e2a2deb46a9f52dc7f980a918ed25067b80 /fs/nfs
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/nfs')
-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,
if (update_barrier) {
u32 new_barrier = be32_to_cpu(new->seqid);
- if ((int)(new_barrier - lo->plh_barrier))
+ if (pnfs_seqid_is_newer(new_barrier, lo->plh_barrier))
lo->plh_barrier = new_barrier;
} else {
/* Because of wraparound, we want to keep the barrier
@@ -593,9 +593,12 @@ static bool
pnfs_layoutgets_blocked(struct pnfs_layout_hdr *lo, nfs4_stateid *stateid,
int lget)
{
- if ((stateid) &&
- (int)(lo->plh_barrier - be32_to_cpu(stateid->seqid)) >= 0)
- return true;
+ if (stateid != NULL) {
+ u32 seqid = be32_to_cpu(stateid->seqid);
+
+ if (!pnfs_seqid_is_newer(seqid, lo->plh_barrier))
+ return true;
+ }
return lo->plh_block_lgets ||
test_bit(NFS_LAYOUT_BULK_RECALL, &lo->plh_flags) ||
(list_empty(&lo->plh_segs) &&