From 615c39fbd6554f668cb1a5ddf0742233f87db053 Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Tue, 3 Mar 2009 14:48:35 -0500 Subject: [PATCH] --- yaml --- r: 132207 b: refs/heads/master c: 7d46be4a25fdfb503c20bad60a618adebfe2ac5c h: refs/heads/master i: 132205: f9848eaa9eead657581520f17da5190591629a12 132203: bd3cb8bcad842d31d4e1750497ba1ceed36dfd0b 132199: 0a73edc4d66e20527dc521b45269e6f5c7cc4b59 132191: 676c7bff629d53e7d0535eec8df18c07364ca480 v: v3 --- [refs] | 2 +- trunk/fs/xfs/xfs_iget.c | 15 ++++++++++----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/[refs] b/[refs] index 35145230ddf8..fd5e55c4d61d 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: ff392c497b43ddedbab5627b53928a654cc5486e +refs/heads/master: 7d46be4a25fdfb503c20bad60a618adebfe2ac5c diff --git a/trunk/fs/xfs/xfs_iget.c b/trunk/fs/xfs/xfs_iget.c index e2fb6210d4c5..478e587087fe 100644 --- a/trunk/fs/xfs/xfs_iget.c +++ b/trunk/fs/xfs/xfs_iget.c @@ -246,9 +246,6 @@ xfs_iget_cache_miss( goto out_destroy; } - if (lock_flags) - xfs_ilock(ip, lock_flags); - /* * Preload the radix tree so we can insert safely under the * write spinlock. Note that we cannot sleep inside the preload @@ -256,7 +253,16 @@ xfs_iget_cache_miss( */ if (radix_tree_preload(GFP_KERNEL)) { error = EAGAIN; - goto out_unlock; + goto out_destroy; + } + + /* + * Because the inode hasn't been added to the radix-tree yet it can't + * be found by another thread, so we can do the non-sleeping lock here. + */ + if (lock_flags) { + if (!xfs_ilock_nowait(ip, lock_flags)) + BUG(); } mask = ~(((XFS_INODE_CLUSTER_SIZE(mp) >> mp->m_sb.sb_inodelog)) - 1); @@ -284,7 +290,6 @@ xfs_iget_cache_miss( out_preload_end: write_unlock(&pag->pag_ici_lock); radix_tree_preload_end(); -out_unlock: if (lock_flags) xfs_iunlock(ip, lock_flags); out_destroy: