aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs
diff options
context:
space:
mode:
authorDave Chinner <dchinner@redhat.com>2011-03-29 03:08:50 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-03-29 10:50:34 -0400
commit0444d76ae64fffc7851797fc1b6ebdbb44ac504a (patch)
treed0678f0f8c82f3c2b2c66a6b47242eef1b323142 /fs/nfs
parentcb1817b37313b4b6c7f8f93c730553dd3cb6ac57 (diff)
fs: don't use igrab() while holding i_lock
Fix the incorrect use of igrab() inside the i_lock in NFS and Ceph‥ If we are already holding the i_lock, we have a reference to the inode so we can safely use ihold() to gain an extra reference. This avoids hangs due to lock recursion on the i_lock now that the inode_lock is gone and igrab() uses the i_lock itself. Signed-off-by: Dave Chinner <dchinner@redhat.com> Cc: Al Viro <viro@zeniv.linux.org.uk> Cc: linux-fsdevel@vger.kernel.org Cc: Ryan Mallon <ryan@bluewatersys.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/nfs')
-rw-r--r--fs/nfs/nfs4state.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c
index ab1bf5bb021f..a6804f704d9d 100644
--- a/fs/nfs/nfs4state.c
+++ b/fs/nfs/nfs4state.c
@@ -590,7 +590,8 @@ nfs4_get_open_state(struct inode *inode, struct nfs4_state_owner *owner)
590 state->owner = owner; 590 state->owner = owner;
591 atomic_inc(&owner->so_count); 591 atomic_inc(&owner->so_count);
592 list_add(&state->inode_states, &nfsi->open_states); 592 list_add(&state->inode_states, &nfsi->open_states);
593 state->inode = igrab(inode); 593 ihold(inode);
594 state->inode = inode;
594 spin_unlock(&inode->i_lock); 595 spin_unlock(&inode->i_lock);
595 /* Note: The reclaim code dictates that we add stateless 596 /* Note: The reclaim code dictates that we add stateless
596 * and read-only stateids to the end of the list */ 597 * and read-only stateids to the end of the list */