diff options
| author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2012-10-02 19:38:41 -0400 |
|---|---|---|
| committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2012-10-02 19:38:41 -0400 |
| commit | 038d6493763d900797dfeb555502d3b0d8103fba (patch) | |
| tree | 231a9641f80937a90a5616dc6a3143563b507076 /fs/nfs | |
| parent | 251ec410c495cb93c7ae2cb4beda29205d9bd35f (diff) | |
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')
| -rw-r--r-- | fs/nfs/pnfs.c | 8 |
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, | |||
| 558 | 558 | ||
| 559 | oldseq = be32_to_cpu(lo->plh_stateid.seqid); | 559 | oldseq = be32_to_cpu(lo->plh_stateid.seqid); |
| 560 | newseq = be32_to_cpu(new->seqid); | 560 | newseq = be32_to_cpu(new->seqid); |
| 561 | if ((int)(newseq - oldseq) > 0) { | 561 | if (list_empty(&lo->plh_segs) || (int)(newseq - oldseq) > 0) { |
| 562 | nfs4_stateid_copy(&lo->plh_stateid, new); | 562 | nfs4_stateid_copy(&lo->plh_stateid, new); |
| 563 | if (update_barrier) { | 563 | if (update_barrier) { |
| 564 | u32 new_barrier = be32_to_cpu(new->seqid); | 564 | u32 new_barrier = be32_to_cpu(new->seqid); |
| @@ -1181,6 +1181,10 @@ pnfs_layout_process(struct nfs4_layoutget *lgp) | |||
| 1181 | dprintk("%s forget reply due to state\n", __func__); | 1181 | dprintk("%s forget reply due to state\n", __func__); |
| 1182 | goto out_forget_reply; | 1182 | goto out_forget_reply; |
| 1183 | } | 1183 | } |
| 1184 | |||
| 1185 | /* Done processing layoutget. Set the layout stateid */ | ||
| 1186 | pnfs_set_layout_stateid(lo, &res->stateid, false); | ||
| 1187 | |||
| 1184 | init_lseg(lo, lseg); | 1188 | init_lseg(lo, lseg); |
| 1185 | lseg->pls_range = res->range; | 1189 | lseg->pls_range = res->range; |
| 1186 | pnfs_get_lseg(lseg); | 1190 | pnfs_get_lseg(lseg); |
| @@ -1191,8 +1195,6 @@ pnfs_layout_process(struct nfs4_layoutget *lgp) | |||
| 1191 | set_bit(NFS_LAYOUT_ROC, &lo->plh_flags); | 1195 | set_bit(NFS_LAYOUT_ROC, &lo->plh_flags); |
| 1192 | } | 1196 | } |
| 1193 | 1197 | ||
| 1194 | /* Done processing layoutget. Set the layout stateid */ | ||
| 1195 | pnfs_set_layout_stateid(lo, &res->stateid, false); | ||
| 1196 | spin_unlock(&ino->i_lock); | 1198 | spin_unlock(&ino->i_lock); |
| 1197 | return lseg; | 1199 | return lseg; |
| 1198 | out: | 1200 | out: |
