[PATCH 10/16] SQUASHME pnfs-submit: reference the layout when inserted into segs list

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

 



From: Andy Adamson <andros@xxxxxxxxxx>

We take a reference on the pnfs_layout_type structure at allocation, so we
don't need to take another reference when adding it to the nfs_client cl_layouts
list.

We do need to take a referece when an lseg is inserted into the layout->segs
list to keep the pnfs_layout_type around while the layout segment is in the
list.

Signed-off-by: Andy Adamson <andros@xxxxxxxxxx>
---
 fs/nfs/pnfs.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
index d4ffd1c..1372ae1 100644
--- a/fs/nfs/pnfs.c
+++ b/fs/nfs/pnfs.c
@@ -411,6 +411,7 @@ destroy_lseg(struct kref *kref)
 		container_of(kref, struct pnfs_layout_segment, kref);
 
 	dprintk("--> %s\n", __func__);
+	/* Matched by get_layout in pnfs_insert_layout */
 	put_layout(lseg->layout);
 	PNFS_LD_IO_OPS(lseg->layout)->free_lseg(lseg);
 }
@@ -876,7 +877,6 @@ pnfs_insert_layout(struct pnfs_layout_type *lo,
 		BUG_ON(!list_empty(&lo->lo_layouts));
 		list_add_tail(&lo->lo_layouts, &clp->cl_layouts);
 		spin_unlock(&clp->cl_lock);
-		get_layout(lo);
 	}
 	list_for_each_entry (lp, &lo->segs, fi_list) {
 		if (cmp_layout(&lp->range, &lseg->range) > 0)
@@ -899,6 +899,7 @@ pnfs_insert_layout(struct pnfs_layout_type *lo,
 			__func__, lseg, lseg->range.iomode,
 			lseg->range.offset, lseg->range.length);
 	}
+	get_layout(lo);
 
 	dprintk("%s:Return\n", __func__);
 }
-- 
1.6.6

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