xfs
[Top] [All Lists]

Re: [PATCH] xfs: only trace buffer items if they exist

To: Dave Chinner <david@xxxxxxxxxxxxx>
Subject: Re: [PATCH] xfs: only trace buffer items if they exist
From: Brian Foster <bfoster@xxxxxxxxxx>
Date: Mon, 9 Feb 2015 13:25:38 -0500
Cc: xfs@xxxxxxxxxxx, y@xxxxxxxxxxxxxxxxxxxxxxx
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <1423198008-30748-1-git-send-email-david@xxxxxxxxxxxxx>
References: <1423198008-30748-1-git-send-email-david@xxxxxxxxxxxxx>
User-agent: Mutt/1.5.23 (2014-03-12)
On Fri, Feb 06, 2015 at 03:46:48PM +1100, Dave Chinner wrote:
> From: Dave Chinner <dchinner@xxxxxxxxxx>
> 
> The commit 2d3d0c5 ("xfs: lobotomise xfs_trans_read_buf_map()") left
> a landmine in the tracing code: trace_xfs_trans_buf_read() is now
> call on all buffers that are read through this interface rather than
> just buffers in transactions. For buffers outside transaction
> context, bp->b_fspriv is null, and so the buf log item tracing
> functions cannot be called. This causes a NULL pointer dereference
> in the trace_xfs_trans_buf_read() function when tracing is turned
> on.
> 
> Signed-off-by: Dave Chinner <dchinner@xxxxxxxxxx>
> ---

Ah, I hit this a week or so ago and completely forgot to dig into it.
Thanks!

Reviewed-by: Brian Foster <bfoster@xxxxxxxxxx>

>  fs/xfs/xfs_trans_buf.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/xfs/xfs_trans_buf.c b/fs/xfs/xfs_trans_buf.c
> index 0a4d4ab..7579841 100644
> --- a/fs/xfs/xfs_trans_buf.c
> +++ b/fs/xfs/xfs_trans_buf.c
> @@ -327,9 +327,10 @@ xfs_trans_read_buf_map(
>               return -EIO;
>       }
>  
> -     if (tp)
> +     if (tp) {
>               _xfs_trans_bjoin(tp, bp, 1);
> -     trace_xfs_trans_read_buf(bp->b_fspriv);
> +             trace_xfs_trans_read_buf(bp->b_fspriv);
> +     }
>       *bpp = bp;
>       return 0;
>  
> -- 
> 2.0.0
> 
> _______________________________________________
> xfs mailing list
> xfs@xxxxxxxxxxx
> http://oss.sgi.com/mailman/listinfo/xfs

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