summaryrefslogtreecommitdiffstats
path: root/fs/nfs/pnfs.c
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2012-10-03 01:38:41 +0200
committerTrond Myklebust <Trond.Myklebust@netapp.com>2012-10-03 01:38:41 +0200
commit038d6493763d900797dfeb555502d3b0d8103fba (patch)
tree231a9641f80937a90a5616dc6a3143563b507076 /fs/nfs/pnfs.c
parentNFSv4.1: Fix another refcount issue in pnfs_find_alloc_layout (diff)
downloadlinux-038d6493763d900797dfeb555502d3b0d8103fba.tar.xz
linux-038d6493763d900797dfeb555502d3b0d8103fba.zip
NFSv4.1: Always set the layout stateid if this is the first layoutget
If the list of layout segments is empty, we must unconditionally set the layout stateid. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/pnfs.c')
-rw-r--r--fs/nfs/pnfs.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
index fe9968a62cad..c8c1d0cc197a 100644
--- a/fs/nfs/pnfs.c
+++ b/fs/nfs/pnfs.c
@@ -558,7 +558,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 ((int)(newseq - oldseq) > 0) {
+ if (list_empty(&lo->plh_segs) || (int)(newseq - oldseq) > 0) {
nfs4_stateid_copy(&lo->plh_stateid, new);
if (update_barrier) {
u32 new_barrier = be32_to_cpu(new->seqid);
@@ -1181,6 +1181,10 @@ pnfs_layout_process(struct nfs4_layoutget *lgp)
dprintk("%s forget reply due to state\n", __func__);
goto out_forget_reply;
}
+
+ /* Done processing layoutget. Set the layout stateid */
+ pnfs_set_layout_stateid(lo, &res->stateid, false);
+
init_lseg(lo, lseg);
lseg->pls_range = res->range;
pnfs_get_lseg(lseg);
@@ -1191,8 +1195,6 @@ pnfs_layout_process(struct nfs4_layoutget *lgp)
set_bit(NFS_LAYOUT_ROC, &lo->plh_flags);
}
- /* Done processing layoutget. Set the layout stateid */
- pnfs_set_layout_stateid(lo, &res->stateid, false);
spin_unlock(&ino->i_lock);
return lseg;
out: