[PATCH 1/9] SQUASHME: pnfsd: fix lrs_present calculation

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

 



lrs_present must be set to zero iff the client holds no layout state on
the respective file.

Signed-off-by: Benny Halevy <bhalevy@xxxxxxxxxx>
---
 fs/nfsd/nfs4pnfsd.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/fs/nfsd/nfs4pnfsd.c b/fs/nfsd/nfs4pnfsd.c
index 3931e52..5c50d8a 100644
--- a/fs/nfsd/nfs4pnfsd.c
+++ b/fs/nfsd/nfs4pnfsd.c
@@ -893,7 +893,7 @@ struct super_block *
 	struct nfs4_layout *lp, *nextlp;
 
 	dprintk("%s: clp %p fp %p\n", __func__, clp, fp);
-	lrp->lrs_present = 1;
+	lrp->lrs_present = 0;
 	spin_lock(&layout_lock);
 	list_for_each_entry_safe (lp, nextlp, &fp->fi_layouts, lo_perfile) {
 		dprintk("%s: lp %p client %p,%p lo_type %x,%x iomode %d,%d\n",
@@ -901,19 +901,22 @@ struct super_block *
 			lp->lo_client, clp,
 			lp->lo_seg.layout_type, lrp->args.lr_seg.layout_type,
 			lp->lo_seg.iomode, lrp->args.lr_seg.iomode);
-		if (lp->lo_client != clp ||
-		    lp->lo_seg.layout_type != lrp->args.lr_seg.layout_type ||
+		if (lp->lo_client != clp)
+			continue;
+		if (lp->lo_seg.layout_type != lrp->args.lr_seg.layout_type ||
 		    (lp->lo_seg.iomode != lrp->args.lr_seg.iomode &&
 		     lrp->args.lr_seg.iomode != IOMODE_ANY) ||
-		     !lo_seg_overlapping(&lp->lo_seg, &lrp->args.lr_seg))
+		     !lo_seg_overlapping(&lp->lo_seg, &lrp->args.lr_seg)) {
+			lrp->lrs_present = 1;
 			continue;
+		}
 		layouts_found++;
 		trim_layout(&lp->lo_seg, &lrp->args.lr_seg);
 		if (!lp->lo_seg.length) {
-			lrp->lrs_present = 0;
 			dequeue_layout(lp);
 			destroy_layout(lp);
-		}
+		} else
+			lrp->lrs_present = 1;
 	}
 	if (ls && layouts_found && lrp->lrs_present)
 		update_layout_stateid_locked(ls, &lrp->lr_sid);
-- 
1.7.11.7

--
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