xfs
[Top] [All Lists]

Re: [PATCH] xfs: fix double unlock in xfs_swap_extents()

To: Felix Blyakher <felixb@xxxxxxx>
Subject: Re: [PATCH] xfs: fix double unlock in xfs_swap_extents()
From: Eric Sandeen <sandeen@xxxxxxxxxxx>
Date: Thu, 07 May 2009 21:57:09 -0500
Cc: xfs@xxxxxxxxxxx, kernel-testers@xxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx, a.beregalov@xxxxxxxxx
In-reply-to: <1241745202-7452-1-git-send-email-felixb@xxxxxxx>
References: <1241745202-7452-1-git-send-email-felixb@xxxxxxx>
User-agent: Thunderbird 2.0.0.21 (Macintosh/20090302)
Felix Blyakher wrote:
> Regreesion from commit ef8f7fc, which rearranged the code in
> xfs_swap_extents() leading to double unlock of xfs inode iolock.
> That resulted in xfs_fsr deadlocking itself on platforms, which
> don't handle double unlock of rw_semaphore nicely. It caused the
> count go negative, which represents the write holder, without
> really having one. ia64 is one of the platforms where deadlock
> was easily reproduced and the fix was tested.
> 
> Signed-off-by: Felix Blyakher <felixb@xxxxxxx>

Also-written-by: Eric Sandeen <sandeen@xxxxxxxxxxx>
Independently-arrived-at-by: Eric Sandeen <sandeen@xxxxxxxxxxx>

;)

But seriously ...

Reviewed-by: Eric Sandeen <sandeen@xxxxxxxxxxx>

> ---
>  fs/xfs/xfs_dfrag.c |    8 +++++---
>  1 files changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/fs/xfs/xfs_dfrag.c b/fs/xfs/xfs_dfrag.c
> index e6d839b..7465f9e 100644
> --- a/fs/xfs/xfs_dfrag.c
> +++ b/fs/xfs/xfs_dfrag.c
> @@ -347,13 +347,15 @@ xfs_swap_extents(
>  
>       error = xfs_trans_commit(tp, XFS_TRANS_SWAPEXT);
>  
> -out_unlock:
> -     xfs_iunlock(ip,  XFS_ILOCK_EXCL | XFS_IOLOCK_EXCL);
> -     xfs_iunlock(tip, XFS_ILOCK_EXCL | XFS_IOLOCK_EXCL);
>  out:
>       kmem_free(tempifp);
>       return error;
>  
> +out_unlock:
> +     xfs_iunlock(ip,  XFS_ILOCK_EXCL | XFS_IOLOCK_EXCL);
> +     xfs_iunlock(tip, XFS_ILOCK_EXCL | XFS_IOLOCK_EXCL);
> +     goto out;
> +
>  out_trans_cancel:
>       xfs_trans_cancel(tp, 0);
>       goto out_unlock;

<Prev in Thread] Current Thread [Next in Thread>