[Top] [All Lists]

Re: [PATCH 4/6] xfs: xfs_trans_read_buf() should return an error on fail

To: Dave Chinner <david@xxxxxxxxxxxxx>
Subject: Re: [PATCH 4/6] xfs: xfs_trans_read_buf() should return an error on failure
From: Christoph Hellwig <hch@xxxxxxxxxxxxx>
Date: Wed, 23 Mar 2011 07:53:21 -0400
Cc: xfs@xxxxxxxxxxx, aelder@xxxxxxx
In-reply-to: <1300860870-15471-5-git-send-email-david@xxxxxxxxxxxxx>
References: <1300860870-15471-1-git-send-email-david@xxxxxxxxxxxxx> <1300860870-15471-5-git-send-email-david@xxxxxxxxxxxxx>
User-agent: Mutt/1.5.21 (2010-09-15)
On Wed, Mar 23, 2011 at 05:14:28PM +1100, Dave Chinner wrote:
> From: Dave Chinner <dchinner@xxxxxxxxxx>
> When inside a transaction and we fail to read a buffer,
> xfs_trans_read_buf returns a null buffer pointer and no error.
> xfs_do_da_buf() checks the error return, but not the buffer, and as
> a result this read failure condition causes a panic when it attempts
> to dereference the non-existant buffer.
> Make xfs_trans_read_buf() return the same error for this situation
> regardless of whether it is in a transaction or not. This means
> every caller does not need to check both the error return and the
> buffer before proceeding to use the buffer.

Most callers seem to fine because they always pass 0 as flags,
or handle a NULL bp return.

The exception is xfs_imap_to_bp, which can get a trylock flag via
xfs_itobp and xfs_iflush, which needs a fix for this.

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