aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/pnfs.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/nfs/pnfs.c')
-rw-r--r--fs/nfs/pnfs.c25
1 files changed, 14 insertions, 11 deletions
diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
index 861dd97b569e..bd9769296e4e 100644
--- a/fs/nfs/pnfs.c
+++ b/fs/nfs/pnfs.c
@@ -583,17 +583,19 @@ pnfs_set_layout_stateid(struct pnfs_layout_hdr *lo, const nfs4_stateid *new,
583 } 583 }
584} 584}
585 585
586/* lget is set to 1 if called from inside send_layoutget call chain */
587static bool 586static bool
588pnfs_layoutgets_blocked(struct pnfs_layout_hdr *lo, nfs4_stateid *stateid, 587pnfs_layout_stateid_blocked(const struct pnfs_layout_hdr *lo,
589 int lget) 588 const nfs4_stateid *stateid)
590{ 589{
591 if (stateid != NULL) { 590 u32 seqid = be32_to_cpu(stateid->seqid);
592 u32 seqid = be32_to_cpu(stateid->seqid);
593 591
594 if (!pnfs_seqid_is_newer(seqid, lo->plh_barrier)) 592 return !pnfs_seqid_is_newer(seqid, lo->plh_barrier);
595 return true; 593}
596 } 594
595/* lget is set to 1 if called from inside send_layoutget call chain */
596static bool
597pnfs_layoutgets_blocked(const struct pnfs_layout_hdr *lo, int lget)
598{
597 return lo->plh_block_lgets || 599 return lo->plh_block_lgets ||
598 test_bit(NFS_LAYOUT_BULK_RECALL, &lo->plh_flags) || 600 test_bit(NFS_LAYOUT_BULK_RECALL, &lo->plh_flags) ||
599 (list_empty(&lo->plh_segs) && 601 (list_empty(&lo->plh_segs) &&
@@ -608,7 +610,7 @@ pnfs_choose_layoutget_stateid(nfs4_stateid *dst, struct pnfs_layout_hdr *lo,
608 610
609 dprintk("--> %s\n", __func__); 611 dprintk("--> %s\n", __func__);
610 spin_lock(&lo->plh_inode->i_lock); 612 spin_lock(&lo->plh_inode->i_lock);
611 if (pnfs_layoutgets_blocked(lo, NULL, 1)) { 613 if (pnfs_layoutgets_blocked(lo, 1)) {
612 status = -EAGAIN; 614 status = -EAGAIN;
613 } else if (list_empty(&lo->plh_segs)) { 615 } else if (list_empty(&lo->plh_segs)) {
614 int seq; 616 int seq;
@@ -1111,7 +1113,7 @@ pnfs_update_layout(struct inode *ino,
1111 if (lseg) 1113 if (lseg)
1112 goto out_unlock; 1114 goto out_unlock;
1113 1115
1114 if (pnfs_layoutgets_blocked(lo, NULL, 0)) 1116 if (pnfs_layoutgets_blocked(lo, 0))
1115 goto out_unlock; 1117 goto out_unlock;
1116 atomic_inc(&lo->plh_outstanding); 1118 atomic_inc(&lo->plh_outstanding);
1117 1119
@@ -1184,7 +1186,8 @@ pnfs_layout_process(struct nfs4_layoutget *lgp)
1184 goto out_forget_reply; 1186 goto out_forget_reply;
1185 } 1187 }
1186 1188
1187 if (pnfs_layoutgets_blocked(lo, &res->stateid, 1)) { 1189 if (pnfs_layoutgets_blocked(lo, 1) ||
1190 pnfs_layout_stateid_blocked(lo, &res->stateid)) {
1188 dprintk("%s forget reply due to state\n", __func__); 1191 dprintk("%s forget reply due to state\n", __func__);
1189 goto out_forget_reply; 1192 goto out_forget_reply;
1190 } 1193 }