[PATCH 06/16] SQUASHME pnfs-submit; fix pnfs_update_layout reference counting

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

 



From: Andy Adamson <andros@xxxxxxxxxx>

Only take a reference on the layout if layoutget is to be called.

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

diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
index 92b7772..7219d2b 100644
--- a/fs/nfs/pnfs.c
+++ b/fs/nfs/pnfs.c
@@ -362,6 +362,7 @@ pnfs_layout_release(struct pnfs_layout_type *lo,
 	spin_lock(&nfsi->vfs_inode.i_lock);
 	if (range)
 		pnfs_free_layout(lo, range);
+	/* Matched in _pnfs_update_layout for layoutget */
 	put_layout(lo);
 	spin_unlock(&nfsi->vfs_inode.i_lock);
 	wake_up_all(&nfsi->lo_waitq);
@@ -1063,7 +1064,7 @@ _pnfs_update_layout(struct inode *ino,
 			put_lseg_locked(lseg);
 		/* someone is cleaning the layout */
 		lseg = NULL;
-		goto out_put;
+		goto out_unlock;
 	}
 
 	if (lseg) {
@@ -1074,7 +1075,7 @@ _pnfs_update_layout(struct inode *ino,
 			arg.offset,
 			arg.iomode);
 
-		goto out_put;
+		goto out_unlock;
 	}
 
 	/* if get layout already failed once goto out */
@@ -1086,10 +1087,11 @@ _pnfs_update_layout(struct inode *ino,
 				  &nfsi->layout->pnfs_layout_state);
 			nfsi->pnfs_layout_suspend = 0;
 		} else
-			goto out_put;
+			goto out_unlock;
 	}
 
-	/* Lose lock, but not reference, match this with pnfs_layout_release */
+	/* Reference the layout for layoutget matched in pnfs_layout_release */
+	get_layout(lo);
 	spin_unlock(&ino->i_lock);
 
 	send_layoutget(ino, ctx, &arg, lsegpp, lo);
@@ -1097,10 +1099,9 @@ out:
 	dprintk("%s end, state 0x%lx lseg %p\n", __func__,
 		nfsi->layout->pnfs_layout_state, lseg);
 	return;
-out_put:
+out_unlock:
 	if (lsegpp)
 		*lsegpp = lseg;
-	put_layout(lo);
 	spin_unlock(&ino->i_lock);
 	goto out;
 }
-- 
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