diff options
author | Christoph Hellwig <hch@infradead.org> | 2009-03-03 14:48:35 -0500 |
---|---|---|
committer | Felix Blyakher <felixb@sgi.com> | 2009-03-04 08:31:48 -0500 |
commit | ed93ec3907f063268ced18728d0653f6199d100c (patch) | |
tree | e9e15deaec2c4609c2097da4064beef4c6341f3e /fs/xfs/xfs_iget.c | |
parent | e8fa6b483feebd23ded5eb01afd7a6e82b6078c6 (diff) |
xfs: prevent lockdep false positive in xfs_iget_cache_miss
The inode can't be locked by anyone else as we just created it a few
lines above and it's not been added to any lookup data structure yet.
So use a trylock that must succeed to get around the lockdep warnings.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reported-by: Alexander Beregalov <a.beregalov@gmail.com>
Reviewed-by: Eric Sandeen <sandeen@sandeen.net>
Reviewed-by: Felix Blyakher <felixb@sgi.com>
Signed-off-by: Felix Blyakher <felixb@sgi.com>
Diffstat (limited to 'fs/xfs/xfs_iget.c')
-rw-r--r-- | fs/xfs/xfs_iget.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/fs/xfs/xfs_iget.c b/fs/xfs/xfs_iget.c index e2fb6210d4c5..478e587087fe 100644 --- a/fs/xfs/xfs_iget.c +++ b/fs/xfs/xfs_iget.c | |||
@@ -246,9 +246,6 @@ xfs_iget_cache_miss( | |||
246 | goto out_destroy; | 246 | goto out_destroy; |
247 | } | 247 | } |
248 | 248 | ||
249 | if (lock_flags) | ||
250 | xfs_ilock(ip, lock_flags); | ||
251 | |||
252 | /* | 249 | /* |
253 | * Preload the radix tree so we can insert safely under the | 250 | * Preload the radix tree so we can insert safely under the |
254 | * write spinlock. Note that we cannot sleep inside the preload | 251 | * write spinlock. Note that we cannot sleep inside the preload |
@@ -256,7 +253,16 @@ xfs_iget_cache_miss( | |||
256 | */ | 253 | */ |
257 | if (radix_tree_preload(GFP_KERNEL)) { | 254 | if (radix_tree_preload(GFP_KERNEL)) { |
258 | error = EAGAIN; | 255 | error = EAGAIN; |
259 | goto out_unlock; | 256 | goto out_destroy; |
257 | } | ||
258 | |||
259 | /* | ||
260 | * Because the inode hasn't been added to the radix-tree yet it can't | ||
261 | * be found by another thread, so we can do the non-sleeping lock here. | ||
262 | */ | ||
263 | if (lock_flags) { | ||
264 | if (!xfs_ilock_nowait(ip, lock_flags)) | ||
265 | BUG(); | ||
260 | } | 266 | } |
261 | 267 | ||
262 | mask = ~(((XFS_INODE_CLUSTER_SIZE(mp) >> mp->m_sb.sb_inodelog)) - 1); | 268 | mask = ~(((XFS_INODE_CLUSTER_SIZE(mp) >> mp->m_sb.sb_inodelog)) - 1); |
@@ -284,7 +290,6 @@ xfs_iget_cache_miss( | |||
284 | out_preload_end: | 290 | out_preload_end: |
285 | write_unlock(&pag->pag_ici_lock); | 291 | write_unlock(&pag->pag_ici_lock); |
286 | radix_tree_preload_end(); | 292 | radix_tree_preload_end(); |
287 | out_unlock: | ||
288 | if (lock_flags) | 293 | if (lock_flags) |
289 | xfs_iunlock(ip, lock_flags); | 294 | xfs_iunlock(ip, lock_flags); |
290 | out_destroy: | 295 | out_destroy: |