Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

xfs: uncached buffer reads need to return an error

With verification being done as an IO completion callback, different
errors can be returned from a read. Uncached reads only return a
buffer or NULL on failure, which means the verification error cannot
be returned to the caller.

Split the error handling for these reads into two - a failure to get
a buffer will still return NULL, but a read error will return a
referenced buffer with b_error set rather than NULL. The caller is
responsible for checking the error state of the buffer returned.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Phil White <pwhite@sgi.com>
Signed-off-by: Ben Myers <bpm@sgi.com>

authored by

Dave Chinner and committed by
Ben Myers
eab4e633 c3f8fc73

+21 -8
+2 -7
fs/xfs/xfs_buf.c
··· 715 715 int flags, 716 716 xfs_buf_iodone_t verify) 717 717 { 718 - xfs_buf_t *bp; 719 - int error; 718 + struct xfs_buf *bp; 720 719 721 720 bp = xfs_buf_get_uncached(target, numblks, flags); 722 721 if (!bp) ··· 729 730 bp->b_iodone = verify; 730 731 731 732 xfsbdstrat(target->bt_mount, bp); 732 - error = xfs_buf_iowait(bp); 733 - if (error) { 734 - xfs_buf_relse(bp); 735 - return NULL; 736 - } 733 + xfs_buf_iowait(bp); 737 734 return bp; 738 735 } 739 736
+5
fs/xfs/xfs_fsops.c
··· 171 171 XFS_FSS_TO_BB(mp, 1), 0, NULL); 172 172 if (!bp) 173 173 return EIO; 174 + if (bp->b_error) { 175 + int error = bp->b_error; 176 + xfs_buf_relse(bp); 177 + return error; 178 + } 174 179 xfs_buf_relse(bp); 175 180 176 181 new = nb; /* use new as a temporary here */
+6
fs/xfs/xfs_mount.c
··· 658 658 xfs_warn(mp, "SB buffer read failed"); 659 659 return EIO; 660 660 } 661 + if (bp->b_error) { 662 + error = bp->b_error; 663 + if (loud) 664 + xfs_warn(mp, "SB validate failed"); 665 + goto release_buf; 666 + } 661 667 662 668 /* 663 669 * Initialize the mount structure from the superblock.
+8 -1
fs/xfs/xfs_rtalloc.c
··· 1876 1876 XFS_FSB_TO_BB(mp, 1), 0, NULL); 1877 1877 if (!bp) 1878 1878 return EIO; 1879 + if (bp->b_error) { 1880 + error = bp->b_error; 1881 + xfs_buf_relse(bp); 1882 + return error; 1883 + } 1879 1884 xfs_buf_relse(bp); 1880 1885 1881 1886 /* ··· 2226 2221 bp = xfs_buf_read_uncached(mp->m_rtdev_targp, 2227 2222 d - XFS_FSB_TO_BB(mp, 1), 2228 2223 XFS_FSB_TO_BB(mp, 1), 0, NULL); 2229 - if (!bp) { 2224 + if (!bp || bp->b_error) { 2230 2225 xfs_warn(mp, "realtime device size check failed"); 2226 + if (bp) 2227 + xfs_buf_relse(bp); 2231 2228 return EIO; 2232 2229 } 2233 2230 xfs_buf_relse(bp);