xfs: return errors from partial I/O failures to files
Subsystems (2)
PATCH 2/4 xfs: return errors from partial I/O failures to files
From: David Jeffery <[email protected]>
There is an issue with xfs's error reporting in some cases of I/O partially failing and partially succeeding. Calls like fsync() can report success even though not all I/O was successful in partial-failure cases such as one disk of a RAID0 array being offline.
The issue can occur when there are more than one bio per xfs_ioend struct. Each call to xfs_end_bio() for a bio completing will write a value to ioend->io_error. If a successful bio completes after any failed bio, no error is reported do to it writing 0 over the error code set by any failed bio. The I/O error information is now lost and when the ioend is completed only success is reported back up the filesystem stack.
xfs_end_bio() should only set ioend->io_error in the case of BIO_UPTODATE being clear. ioend->io_error is initialized to 0 at allocation so only needs to be updated by a failed bio. Also check that ioend->io_error is 0 so that the first error reported will be the error code returned.
--- fs/xfs/xfs_aops.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/xfs/xfs_aops.c +2 -1
@@ -356,7 +356,8 @@ xfs_end_bio( {xfs_ioend_t *ioend = bio->bi_private; - ioend->io_error =test_bit (BIO_UPTODATE , &bio->bi_flags) ?0 : error; +if (!ioend->io_error && !test_bit (BIO_UPTODATE , &bio->bi_flags)) + ioend->io_error = error;/* Toss bio and pass work off to an xfsdatad thread */ bio->bi_private =NULL ;
Signature · 1 line
2.4.3
please disregard. Mistake with guilt. :(
Quoted 45 lines · billodo
From: David Jeffery <[email protected]>
There is an issue with xfs's error reporting in some cases of I/O partially failing and partially succeeding. Calls like
fsync()can report success even though not all I/O was successful in partial-failure cases such as one disk of a RAID0 array being offline.The issue can occur when there are more than one bio per
xfs_ioendstruct. Each call toxfs_end_bio()for a bio completing will write a value toioend->io_error. If a successful bio completes after any failed bio, no error is reported do to it writing 0 over the error code set by any failed bio. The I/O error information is now lost and when the ioend is completed only success is reported back up the filesystem stack.
xfs_end_bio()should only setioend->io_errorin the case ofBIO_UPTODATEbeing clear.ioend->io_erroris initialized to 0 at allocation so only needs to be updated by a failed bio. Also check thatioend->io_erroris 0 so that the first error reported will be the error code returned.Signed-off-by David Jeffery <[email protected]>Reviewed-by Dave Chinner <[email protected]>Signed-off-by Dave Chinner <[email protected]>Signed-off-by billodo <[email protected]>--- fs/xfs/xfs_aops.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)fs/xfs/xfs_aops.c +2
-1@@ -356,7 +356,8 @@ xfs_end_bio( {xfs_ioend_t *ioend = bio->bi_private; - ioend->io_error =test_bit (BIO_UPTODATE , &bio->bi_flags) ?0 : error; +if (!ioend->io_error && !test_bit (BIO_UPTODATE , &bio->bi_flags)) + ioend->io_error = error;/* Toss bio and pass work off to an xfsdatad thread */ bio->bi_private =NULL ;Signature · 1 line
2.4.3