diff options
author | Christoph Hellwig <hch@infradead.org> | 2009-03-03 14:48:35 -0500 |
---|---|---|
committer | Felix Blyakher <felixb@sgi.com> | 2009-03-06 18:34:59 -0500 |
commit | 7d46be4a25fdfb503c20bad60a618adebfe2ac5c (patch) | |
tree | f2c5eda4725789eef643b931867b1fd6ad6bde70 /fs/xfs | |
parent | ff392c497b43ddedbab5627b53928a654cc5486e (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')
-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: |