xfs: check xfs_buf_read_uncached returns correctly

xfs_buf_read_uncached() has two failure modes. If can either return
NULL or bp->b_error != 0 depending on the type of failure, and not
all callers check for both. Fix it so that xfs_buf_read_uncached()
always returns the error status, and the buffer is returned as a
function parameter. The buffer will only be returned on success.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Этот коммит содержится в:
Dave Chinner
2014-10-02 09:05:32 +10:00
коммит произвёл Dave Chinner
родитель 595bff75dc
Коммит ba3726742c
5 изменённых файлов: 59 добавлений и 63 удалений

Просмотреть файл

@@ -172,16 +172,11 @@ xfs_growfs_data_private(
if ((error = xfs_sb_validate_fsb_count(&mp->m_sb, nb)))
return error;
dpct = pct - mp->m_sb.sb_imax_pct;
bp = xfs_buf_read_uncached(mp->m_ddev_targp,
error = xfs_buf_read_uncached(mp->m_ddev_targp,
XFS_FSB_TO_BB(mp, nb) - XFS_FSS_TO_BB(mp, 1),
XFS_FSS_TO_BB(mp, 1), 0, NULL);
if (!bp)
return -EIO;
if (bp->b_error) {
error = bp->b_error;
xfs_buf_relse(bp);
XFS_FSS_TO_BB(mp, 1), 0, &bp, NULL);
if (error)
return error;
}
xfs_buf_relse(bp);
new = nb; /* use new as a temporary here */