xfs
[Top] [All Lists]

Re: [PATCH 1/3] xfs: lock rt summary inode on allocation

To: xfs@xxxxxxxxxxx
Subject: Re: [PATCH 1/3] xfs: lock rt summary inode on allocation
From: Eric Sandeen <sandeen@xxxxxxxxxxx>
Date: Mon, 1 Feb 2016 19:26:50 -0600
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <1454373550-3102-2-git-send-email-david@xxxxxxxxxxxxx>
References: <1454373550-3102-1-git-send-email-david@xxxxxxxxxxxxx> <1454373550-3102-2-git-send-email-david@xxxxxxxxxxxxx>
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:38.0) Gecko/20100101 Thunderbird/38.5.1

On 2/1/16 6:39 PM, Dave Chinner wrote:
> From: Dave Chinner <dchinner@xxxxxxxxxx>
> 
> RT allocation can fail on a debug kernel with:
> 
> XFS: Assertion failed: xfs_isilocked(ip, XFS_ILOCK_SHARED|XFS_ILOCK_EXCL), 
> file: fs/xfs/libxfs/xfs_bmap.c, line: 4039
> 
> When modifying the summary inode during allocation. This occurs
> because the summary inode is never locked, and xfs_bmapi_*
> operations expect it to be locked. The summary inode is effectively
> protected byt he lock on the bitmap inode, so this really is only a
> debug kernel issue.
> 
> Signed-off-by: Dave Chinner <dchinner@xxxxxxxxxx>

Oh, it was easy after all...

Reviewed-by: Eric Sandeen <sandeen@xxxxxxxxxx>

> ---
>  fs/xfs/xfs_bmap_util.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/xfs/xfs_bmap_util.c b/fs/xfs/xfs_bmap_util.c
> index 7087756..fd7f51c 100644
> --- a/fs/xfs/xfs_bmap_util.c
> +++ b/fs/xfs/xfs_bmap_util.c
> @@ -202,10 +202,12 @@ xfs_bmap_rtalloc(
>               ralen = MAXEXTLEN / mp->m_sb.sb_rextsize;
>  
>       /*
> -      * Lock out other modifications to the RT bitmap inode.
> +      * Lock out modifications to both the RT bitmap and summary inodes
>        */
>       xfs_ilock(mp->m_rbmip, XFS_ILOCK_EXCL);
>       xfs_trans_ijoin(ap->tp, mp->m_rbmip, XFS_ILOCK_EXCL);
> +     xfs_ilock(mp->m_rsumip, XFS_ILOCK_EXCL);
> +     xfs_trans_ijoin(ap->tp, mp->m_rsumip, XFS_ILOCK_EXCL);
>  
>       /*
>        * If it's an allocation to an empty file at offset 0,
> 

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