[PATCH 4/5] NFSv4.1: Deal with wraparound when updating the layout "barrier" seqid

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



...and fix a bug in pnfs_set_layout_stateid.

Signed-off-by: Trond Myklebust <Trond.Myklebust@xxxxxxxxxx>
---
 fs/nfs/pnfs.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
index f1387e8..de82725 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) &&
-- 
1.7.11.4

--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux