From: David Jeffery <djeffery@redhat.com>
To: xfs@oss.sgi.com
Subject: [PATCH] xfs: return errors from partial I/O failures to files
Date: Wed, 26 Aug 2015 15:06:36 -0400 [thread overview]
Message-ID: <20150826190636.GA16540@rage.redhat.com> (raw)
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.
The issue can occur when there are multiple 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 any failed bio structs. This ensures an error can be reported
to the application.
Signed-off-by: David Jeffery <djeffery@redhat.com>
---
diff --git a/fs/xfs/xfs_aops.c b/fs/xfs/xfs_aops.c
index 3859f5e..b82b128 100644
--- a/fs/xfs/xfs_aops.c
+++ b/fs/xfs/xfs_aops.c
@@ -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 (!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;
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
next reply other threads:[~2015-08-26 19:06 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-26 19:06 David Jeffery [this message]
2015-08-26 22:19 ` [PATCH] xfs: return errors from partial I/O failures to files Dave Chinner
2015-08-27 6:09 ` Eryu Guan
2015-08-27 13:41 ` David Jeffery
2015-08-28 0:20 ` Dave Chinner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150826190636.GA16540@rage.redhat.com \
--to=djeffery@redhat.com \
--cc=xfs@oss.sgi.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.