Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5aa2781d authored by Mikulas Patocka's avatar Mikulas Patocka Committed by Alasdair G Kergon
Browse files

dm: store only first barrier error



With the following patches, more than one error can occur during
processing.  Change md->barrier_error so that only the first one is
recorded and returned to the caller.

Signed-off-by: default avatarMikulas Patocka <mpatocka@redhat.com>
Signed-off-by: default avatarAlasdair G Kergon <agk@redhat.com>
parent 2761e95f
Loading
Loading
Loading
Loading
+9 −8
Original line number Diff line number Diff line
@@ -555,6 +555,7 @@ static void dec_pending(struct dm_io *io, int error)
			 * a per-device variable for error reporting.
			 * Note that you can't touch the bio after end_io_acct
			 */
			if (!md->barrier_error)
				md->barrier_error = io_error;
			end_io_acct(io);
		} else {
@@ -867,6 +868,7 @@ static void __split_and_process_bio(struct mapped_device *md, struct bio *bio)
		if (!bio_barrier(bio))
			bio_io_error(bio);
		else
			if (!md->barrier_error)
				md->barrier_error = -EIO;
		return;
	}
@@ -1448,15 +1450,14 @@ static void dm_flush(struct mapped_device *md)

static void process_barrier(struct mapped_device *md, struct bio *bio)
{
	dm_flush(md);
	md->barrier_error = 0;

	if (bio_empty_barrier(bio)) {
		bio_endio(bio, 0);
		return;
	}
	dm_flush(md);

	if (!bio_empty_barrier(bio)) {
		__split_and_process_bio(md, bio);
		dm_flush(md);
	}

	if (md->barrier_error != DM_ENDIO_REQUEUE)
		bio_endio(bio, md->barrier_error);