Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 333212
b: refs/heads/master
c: 5a65503
h: refs/heads/master
v: v3
  • Loading branch information
Trond Myklebust authored and Trond Myklebust committed Oct 2, 2012
1 parent 50ff7d6 commit efe5fdb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 038d6493763d900797dfeb555502d3b0d8103fba
refs/heads/master: 5a65503f3dbdb4aa1cd6cb58c479c015d093292b
11 changes: 10 additions & 1 deletion trunk/fs/nfs/pnfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -549,6 +549,15 @@ pnfs_destroy_all_layouts(struct nfs_client *clp)
}
}

/*
* Compare 2 layout stateid sequence ids, to see which is newer,
* taking into account wraparound issues.
*/
static bool pnfs_seqid_is_newer(u32 s1, u32 s2)
{
return (s32)s1 - (s32)s2 > 0;
}

/* update lo->plh_stateid with new if is more recent */
void
pnfs_set_layout_stateid(struct pnfs_layout_hdr *lo, const nfs4_stateid *new,
Expand All @@ -558,7 +567,7 @@ pnfs_set_layout_stateid(struct pnfs_layout_hdr *lo, const nfs4_stateid *new,

oldseq = be32_to_cpu(lo->plh_stateid.seqid);
newseq = be32_to_cpu(new->seqid);
if (list_empty(&lo->plh_segs) || (int)(newseq - oldseq) > 0) {
if (list_empty(&lo->plh_segs) || pnfs_seqid_is_newer(newseq, oldseq)) {
nfs4_stateid_copy(&lo->plh_stateid, new);
if (update_barrier) {
u32 new_barrier = be32_to_cpu(new->seqid);
Expand Down

0 comments on commit efe5fdb

Please sign in to comment.