aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs
diff options
context:
space:
mode:
authorFred Isaman <iisaman@netapp.com>2011-06-15 12:31:02 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2011-06-15 12:39:23 -0400
commitea0ded748bdea78f9e2fefb571f7d6ce9edb4f89 (patch)
treece4589aecc27e8936529ce1cbc4d8a129a1f43b2 /fs/nfs
parent1ed3a8539af7b36aa5c977f304e80f7fc8d27bfc (diff)
nfs4.1: prevent race that allowed use of freed layout in _pnfs_return_layout
mark_matching_lsegs_invalid could put the last ref to the layout, so the get_layout_hdr needs to be called first. Signed-off-by: Fred Isaman <iisaman@netapp.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs')
-rw-r--r--fs/nfs/pnfs.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
index 8f9582281252..730d4dbbaf68 100644
--- a/fs/nfs/pnfs.c
+++ b/fs/nfs/pnfs.c
@@ -640,10 +640,10 @@ _pnfs_return_layout(struct inode *ino)
640 return status; 640 return status;
641 } 641 }
642 stateid = nfsi->layout->plh_stateid; 642 stateid = nfsi->layout->plh_stateid;
643 mark_matching_lsegs_invalid(lo, &tmp_list, NULL);
644 lo->plh_block_lgets++;
645 /* Reference matched in nfs4_layoutreturn_release */ 643 /* Reference matched in nfs4_layoutreturn_release */
646 get_layout_hdr(lo); 644 get_layout_hdr(lo);
645 mark_matching_lsegs_invalid(lo, &tmp_list, NULL);
646 lo->plh_block_lgets++;
647 spin_unlock(&ino->i_lock); 647 spin_unlock(&ino->i_lock);
648 pnfs_free_lseg_list(&tmp_list); 648 pnfs_free_lseg_list(&tmp_list);
649 649