diff mbox

[1/4] block: don't unecessarily clobber bi_error for chained bios

Message ID 1457714093-21926-2-git-send-email-hch@lst.de (mailing list archive)
State Accepted, archived
Delegated to: Jens Axboe
Headers show

Commit Message

Christoph Hellwig March 11, 2016, 4:34 p.m. UTC
Only overwrite the parents bi_error if it was zero.  That way a successful
bio completion doesn't reset the error pointer.

Reported-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 block/bio.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

Comments

Johannes Thumshirn March 14, 2016, 8:25 a.m. UTC | #1
On Fri, Mar 11, 2016 at 05:34:50PM +0100, Christoph Hellwig wrote:
> Only overwrite the parents bi_error if it was zero.  That way a successful
> bio completion doesn't reset the error pointer.
> 
> Reported-by: Brian Foster <bfoster@redhat.com>
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Sagi Grimberg March 14, 2016, 2:52 p.m. UTC | #2
Looks good,

Reviewed-by: Sagi Grimberg <sagig@mellanox.com>
--
To unsubscribe from this list: send the line "unsubscribe linux-block" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/block/bio.c b/block/bio.c
index dbabd48..282ca2e 100644
--- a/block/bio.c
+++ b/block/bio.c
@@ -300,7 +300,8 @@  static void bio_chain_endio(struct bio *bio)
 {
 	struct bio *parent = bio->bi_private;
 
-	parent->bi_error = bio->bi_error;
+	if (!parent->bi_error)
+		parent->bi_error = bio->bi_error;
 	bio_endio(parent);
 	bio_put(bio);
 }
@@ -1753,7 +1754,9 @@  void bio_endio(struct bio *bio)
 		 */
 		if (bio->bi_end_io == bio_chain_endio) {
 			struct bio *parent = bio->bi_private;
-			parent->bi_error = bio->bi_error;
+
+			if (!parent->bi_error)
+				parent->bi_error = bio->bi_error;
 			bio_put(bio);
 			bio = parent;
 		} else {