Skip to content

Commit

Permalink
nfs4.1: prevent race that allowed use of freed layout in _pnfs_return…
Browse files Browse the repository at this point in the history
…_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>
  • Loading branch information
Fred Isaman authored and Trond Myklebust committed Jun 15, 2011
1 parent 1ed3a85 commit ea0ded7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions fs/nfs/pnfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -640,10 +640,10 @@ _pnfs_return_layout(struct inode *ino)
return status;
}
stateid = nfsi->layout->plh_stateid;
mark_matching_lsegs_invalid(lo, &tmp_list, NULL);
lo->plh_block_lgets++;
/* Reference matched in nfs4_layoutreturn_release */
get_layout_hdr(lo);
mark_matching_lsegs_invalid(lo, &tmp_list, NULL);
lo->plh_block_lgets++;
spin_unlock(&ino->i_lock);
pnfs_free_lseg_list(&tmp_list);

Expand Down

0 comments on commit ea0ded7

Please sign in to comment.