[PATCH RFC 2/2] xfs: drop xa_lock around log force in xfs_buf_item push
Brian Foster
bfoster at redhat.com
Tue Jan 29 14:42:37 CST 2013
If the trylock fails and the buffer is pinned and stale, the
resulting xfs_log_force() can lead to lock recursion on the ailp
xa_lock. Call __xfs_buf_trylock() to attempt the buf lock with
xa_lock held, but to avoid the log force. We subsequently pull the
check and log force up into xfs_buf_item_push() where we can drop
and reacquire xa_lock appropriately.
Signed-off-by: Brian Foster <bfoster at redhat.com>
---
fs/xfs/xfs_buf_item.c | 10 +++++++++-
1 files changed, 9 insertions(+), 1 deletions(-)
diff --git a/fs/xfs/xfs_buf_item.c b/fs/xfs/xfs_buf_item.c
index 9c4c050..7b6e98a 100644
--- a/fs/xfs/xfs_buf_item.c
+++ b/fs/xfs/xfs_buf_item.c
@@ -469,8 +469,16 @@ xfs_buf_item_push(
if (xfs_buf_ispinned(bp))
return XFS_ITEM_PINNED;
- if (!xfs_buf_trylock(bp))
+
+ if (!__xfs_buf_trylock(bp, false)) {
+ if (atomic_read(&bp->b_pin_count) &&
+ (bp->b_flags & XBF_STALE)) {
+ spin_unlock(&lip->li_ailp->xa_lock);
+ xfs_log_force(bp->b_target->bt_mount, 0);
+ spin_lock(&lip->li_ailp->xa_lock);
+ }
return XFS_ITEM_LOCKED;
+ }
ASSERT(!(bip->bli_flags & XFS_BLI_STALE));
--
1.7.7.6
More information about the xfs
mailing list