aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2012-09-20 17:02:32 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2012-09-28 16:03:13 -0400
commit01d39ce82b565961abaf1930f54ccf7b32c96b15 (patch)
tree452fcdbcfe1673c5c0d0b2e0a137bc56775a172c
parent57036a377600ec0900b13f29814aa19072ad3e52 (diff)
NFSv4.1: Remove redundant reference to the pnfs_layout_hdr
Each layout segment already holds a reference to the pnfs_layout_hdr, so there is no need to hold an extra reference that is released once the last layout segment is freed. Ensure that pnfs_find_alloc_layout() always returns a reference to the pnfs_layout_hdr, which will be matched by the final call to pnfs_put_layout_hdr() in pnfs_update_layout(). Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
-rw-r--r--fs/nfs/pnfs.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
index 33273b3a330f..7ac5be36f132 100644
--- a/fs/nfs/pnfs.c
+++ b/fs/nfs/pnfs.c
@@ -331,11 +331,8 @@ pnfs_layout_remove_lseg(struct pnfs_layout_hdr *lo,
331 331
332 WARN_ON(test_bit(NFS_LSEG_VALID, &lseg->pls_flags)); 332 WARN_ON(test_bit(NFS_LSEG_VALID, &lseg->pls_flags));
333 list_del_init(&lseg->pls_list); 333 list_del_init(&lseg->pls_list);
334 if (list_empty(&lo->plh_segs)) { 334 if (list_empty(&lo->plh_segs))
335 set_bit(NFS_LAYOUT_DESTROYED, &lo->plh_flags); 335 set_bit(NFS_LAYOUT_DESTROYED, &lo->plh_flags);
336 /* Matched by initial refcount set in alloc_init_layout_hdr */
337 pnfs_put_layout_hdr_locked(lo);
338 }
339 rpc_wake_up(&NFS_SERVER(inode)->roc_rpcwaitq); 336 rpc_wake_up(&NFS_SERVER(inode)->roc_rpcwaitq);
340} 337}
341 338
@@ -468,8 +465,7 @@ pnfs_mark_matching_lsegs_invalid(struct pnfs_layout_hdr *lo,
468 dprintk("%s:Begin lo %p\n", __func__, lo); 465 dprintk("%s:Begin lo %p\n", __func__, lo);
469 466
470 if (list_empty(&lo->plh_segs)) { 467 if (list_empty(&lo->plh_segs)) {
471 if (!test_and_set_bit(NFS_LAYOUT_DESTROYED, &lo->plh_flags)) 468 set_bit(NFS_LAYOUT_DESTROYED, &lo->plh_flags);
472 pnfs_put_layout_hdr_locked(lo);
473 return 0; 469 return 0;
474 } 470 }
475 list_for_each_entry_safe(lseg, next, &lo->plh_segs, pls_list) 471 list_for_each_entry_safe(lseg, next, &lo->plh_segs, pls_list)
@@ -929,8 +925,8 @@ pnfs_find_alloc_layout(struct inode *ino,
929 if (nfsi->layout) { 925 if (nfsi->layout) {
930 if (test_bit(NFS_LAYOUT_DESTROYED, &nfsi->layout->plh_flags)) 926 if (test_bit(NFS_LAYOUT_DESTROYED, &nfsi->layout->plh_flags))
931 return NULL; 927 return NULL;
932 else 928 pnfs_get_layout_hdr(nfsi->layout);
933 return nfsi->layout; 929 return nfsi->layout;
934 } 930 }
935 spin_unlock(&ino->i_lock); 931 spin_unlock(&ino->i_lock);
936 new = alloc_init_layout_hdr(ino, ctx, gfp_flags); 932 new = alloc_init_layout_hdr(ino, ctx, gfp_flags);
@@ -1129,7 +1125,6 @@ pnfs_update_layout(struct inode *ino,
1129 goto out_unlock; 1125 goto out_unlock;
1130 atomic_inc(&lo->plh_outstanding); 1126 atomic_inc(&lo->plh_outstanding);
1131 1127
1132 pnfs_get_layout_hdr(lo);
1133 if (list_empty(&lo->plh_segs)) 1128 if (list_empty(&lo->plh_segs))
1134 first = true; 1129 first = true;
1135 1130