From patchwork Thu Feb 5 02:47:59 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mikulas Patocka X-Patchwork-Id: 5578 Received: from hormel.redhat.com (hormel1.redhat.com [209.132.177.33]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n152m2lT015599 for ; Thu, 5 Feb 2009 02:48:03 GMT Received: from listman.util.phx.redhat.com (listman.util.phx.redhat.com [10.8.4.110]) by hormel.redhat.com (Postfix) with ESMTP id F252E61AB83; Wed, 4 Feb 2009 21:48:01 -0500 (EST) Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by listman.util.phx.redhat.com (8.13.1/8.13.1) with ESMTP id n152lxSp032029 for ; Wed, 4 Feb 2009 21:47:59 -0500 Received: from hs20-bc2-1.build.redhat.com (hs20-bc2-1.build.redhat.com [10.10.28.34]) by int-mx1.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n152m1b4026591; Wed, 4 Feb 2009 21:48:01 -0500 Received: from hs20-bc2-1.build.redhat.com (localhost.localdomain [127.0.0.1]) by hs20-bc2-1.build.redhat.com (8.13.1/8.13.1) with ESMTP id n152m0sw015059; Wed, 4 Feb 2009 21:48:00 -0500 Received: from localhost (mpatocka@localhost) by hs20-bc2-1.build.redhat.com (8.13.1/8.13.1/Submit) with ESMTP id n152m0du015053; Wed, 4 Feb 2009 21:48:00 -0500 X-Authentication-Warning: hs20-bc2-1.build.redhat.com: mpatocka owned process doing -bs Date: Wed, 4 Feb 2009 21:47:59 -0500 (EST) From: Mikulas Patocka X-X-Sender: mpatocka@hs20-bc2-1.build.redhat.com To: dm-devel@redhat.com Message-ID: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.58 on 172.16.52.254 X-loop: dm-devel@redhat.com Cc: Alasdair G Kergon Subject: [dm-devel] [PATCH 1/2]: save/restore bio vector X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.5 Precedence: junk Reply-To: device-mapper development List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com Hi This patch should fix bug 472796 in upstream kernel. --- Bio layer modifies the vector list when the request partially succeeds. Device mapper saves and restores various fields in the bio, but it doesn't save the vector. So, when the block driver modifies the vector on partially succeeded request, dm-raid1 and dm-multipath will attempt to resubmit a bio that has mismatching bi_size and the size of vector. That will cause BUG() in the block layer. To make requests resubmittable in dm-raid1 and dm-multipath, we must save and restore the bio vector as well. Signed-off-by: Mikulas Patocka --- drivers/md/dm-bio-record.h | 3 +++ 1 file changed, 3 insertions(+) -- dm-devel mailing list dm-devel@redhat.com https://www.redhat.com/mailman/listinfo/dm-devel Index: linux-2.6.29-rc3-devel/drivers/md/dm-bio-record.h =================================================================== --- linux-2.6.29-rc3-devel.orig/drivers/md/dm-bio-record.h 2009-02-05 03:10:49.000000000 +0100 +++ linux-2.6.29-rc3-devel/drivers/md/dm-bio-record.h 2009-02-05 03:12:52.000000000 +0100 @@ -22,6 +22,7 @@ struct dm_bio_details { unsigned int bi_size; unsigned short bi_idx; unsigned long bi_flags; + struct bio_vec bi_io_vec[BIO_MAX_PAGES]; }; static inline void dm_bio_record(struct dm_bio_details *bd, struct bio *bio) @@ -31,6 +32,7 @@ static inline void dm_bio_record(struct bd->bi_size = bio->bi_size; bd->bi_idx = bio->bi_idx; bd->bi_flags = bio->bi_flags; + memcpy(bd->bi_io_vec, bio->bi_io_vec, bio->bi_vcnt * sizeof(struct bio_vec)); } static inline void dm_bio_restore(struct dm_bio_details *bd, struct bio *bio) @@ -40,6 +42,7 @@ static inline void dm_bio_restore(struct bio->bi_size = bd->bi_size; bio->bi_idx = bd->bi_idx; bio->bi_flags = bd->bi_flags; + memcpy(bio->bi_io_vec, bd->bi_io_vec, bio->bi_vcnt * sizeof(struct bio_vec)); } #endif