diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2012-09-20 17:23:11 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2012-09-28 16:03:14 -0400 |
commit | 6622c3ea059b2fed49924b74db41d1e0f065fbd3 (patch) | |
tree | d8b362ec56159a57f7402e8d4f70d704f06a612b /fs/nfs | |
parent | 01d39ce82b565961abaf1930f54ccf7b32c96b15 (diff) |
NFSv4.1: Free the pnfs_layout_hdr outside the inode->i_lock
None of the existing pNFS layout drivers seem to require the inode
to be locked while they free the layout header.
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs')
-rw-r--r-- | fs/nfs/pnfs.c | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c index 7ac5be36f13..08663146f5f 100644 --- a/fs/nfs/pnfs.c +++ b/fs/nfs/pnfs.c | |||
@@ -213,7 +213,7 @@ pnfs_free_layout_hdr(struct pnfs_layout_hdr *lo) | |||
213 | } | 213 | } |
214 | 214 | ||
215 | static void | 215 | static void |
216 | destroy_layout_hdr(struct pnfs_layout_hdr *lo) | 216 | pnfs_detach_layout_hdr(struct pnfs_layout_hdr *lo) |
217 | { | 217 | { |
218 | struct nfs_inode *nfsi = NFS_I(lo->plh_inode); | 218 | struct nfs_inode *nfsi = NFS_I(lo->plh_inode); |
219 | dprintk("%s: freeing layout cache %p\n", __func__, lo); | 219 | dprintk("%s: freeing layout cache %p\n", __func__, lo); |
@@ -222,14 +222,6 @@ destroy_layout_hdr(struct pnfs_layout_hdr *lo) | |||
222 | /* Reset MDS Threshold I/O counters */ | 222 | /* Reset MDS Threshold I/O counters */ |
223 | nfsi->write_io = 0; | 223 | nfsi->write_io = 0; |
224 | nfsi->read_io = 0; | 224 | nfsi->read_io = 0; |
225 | pnfs_free_layout_hdr(lo); | ||
226 | } | ||
227 | |||
228 | static void | ||
229 | pnfs_put_layout_hdr_locked(struct pnfs_layout_hdr *lo) | ||
230 | { | ||
231 | if (atomic_dec_and_test(&lo->plh_refcount)) | ||
232 | destroy_layout_hdr(lo); | ||
233 | } | 225 | } |
234 | 226 | ||
235 | void | 227 | void |
@@ -238,8 +230,9 @@ pnfs_put_layout_hdr(struct pnfs_layout_hdr *lo) | |||
238 | struct inode *inode = lo->plh_inode; | 230 | struct inode *inode = lo->plh_inode; |
239 | 231 | ||
240 | if (atomic_dec_and_lock(&lo->plh_refcount, &inode->i_lock)) { | 232 | if (atomic_dec_and_lock(&lo->plh_refcount, &inode->i_lock)) { |
241 | destroy_layout_hdr(lo); | 233 | pnfs_detach_layout_hdr(lo); |
242 | spin_unlock(&inode->i_lock); | 234 | spin_unlock(&inode->i_lock); |
235 | pnfs_free_layout_hdr(lo); | ||
243 | } | 236 | } |
244 | } | 237 | } |
245 | 238 | ||
@@ -792,8 +785,12 @@ void pnfs_roc_release(struct inode *ino) | |||
792 | spin_lock(&ino->i_lock); | 785 | spin_lock(&ino->i_lock); |
793 | lo = NFS_I(ino)->layout; | 786 | lo = NFS_I(ino)->layout; |
794 | lo->plh_block_lgets--; | 787 | lo->plh_block_lgets--; |
795 | pnfs_put_layout_hdr_locked(lo); | 788 | if (atomic_dec_and_test(&lo->plh_refcount)) { |
796 | spin_unlock(&ino->i_lock); | 789 | pnfs_detach_layout_hdr(lo); |
790 | spin_unlock(&ino->i_lock); | ||
791 | pnfs_free_layout_hdr(lo); | ||
792 | } else | ||
793 | spin_unlock(&ino->i_lock); | ||
797 | } | 794 | } |
798 | 795 | ||
799 | void pnfs_roc_set_barrier(struct inode *ino, u32 barrier) | 796 | void pnfs_roc_set_barrier(struct inode *ino, u32 barrier) |