From patchwork Thu Mar 4 17:59:21 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lars Ellenberg X-Patchwork-Id: 83666 X-Patchwork-Delegate: snitzer@redhat.com Received: from mx01.colomx.prod.int.phx2.redhat.com (mx3-phx2.redhat.com [209.132.183.24]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o24I2uWp000810 for ; Thu, 4 Mar 2010 18:03:32 GMT Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx01.colomx.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o24HxjIE003806; Thu, 4 Mar 2010 12:59:47 -0500 Received: from int-mx04.intmail.prod.int.phx2.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.17]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o24HxiAX029662 for ; Thu, 4 Mar 2010 12:59:44 -0500 Received: from mx1.redhat.com (ext-mx09.extmail.prod.ext.phx2.redhat.com [10.5.110.13]) by int-mx04.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o24Hxcd8015607; Thu, 4 Mar 2010 12:59:38 -0500 Received: from mail09.linbit.com (mail09.linbit.com [212.69.161.110]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o24HxM0j028105; Thu, 4 Mar 2010 12:59:23 -0500 Received: from soda.linbit (unknown [10.9.9.55]) by mail09.linbit.com (LINBIT Mail Daemon) with ESMTP id CFF7010003CA; Thu, 4 Mar 2010 18:59:21 +0100 (CET) Date: Thu, 4 Mar 2010 18:59:21 +0100 From: Lars Ellenberg To: Jens Axboe Message-ID: <20100304175921.GD3670@soda.linbit> References: <1267292113-12900-1-git-send-email-dmonakhov@openvz.org> <20100228184634.GI5768@kernel.dk> <874okyf4iw.fsf@openvz.org> <170fa0d21003031020x5b71b492vd733cf0d7c9b83d4@mail.gmail.com> <87wrxtkzwu.fsf@openvz.org> <20100303191613.GB18480@redhat.com> <87lje9kx9i.fsf@openvz.org> <20100303200734.GW5768@kernel.dk> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20100303200734.GW5768@kernel.dk> User-Agent: Mutt/1.5.20 (2009-06-14) X-RedHat-Spam-Score: -0.357 (AWL) X-Scanned-By: MIMEDefang 2.67 on 10.5.11.17 X-Scanned-By: MIMEDefang 2.67 on 10.5.110.13 X-loop: dm-devel@redhat.com Cc: dm-devel@redhat.com, Dmitry Monakhov , linux-kernel@vger.kernel.org, Mike Snitzer Subject: Re: [dm-devel] [PATCH 1/2] blkdev: fix merge_bvec_fn return value checks X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.12 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 X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Thu, 04 Mar 2010 18:03:33 +0000 (UTC) diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c index 4b22feb..bc34901 100644 --- a/drivers/md/dm-table.c +++ b/drivers/md/dm-table.c @@ -519,10 +519,22 @@ int dm_set_device_limits(struct dm_target *ti, struct dm_dev *dev, * smaller I/O, just to be safe. */ - if (q->merge_bvec_fn && !ti->type->merge) + if (q->merge_bvec_fn && !ti->type->merge) { limits->max_sectors = min_not_zero(limits->max_sectors, (unsigned int) (PAGE_SIZE >> 9)); + + /* Restricting max_sectors is not enough. + * If someone uses bio_add_page to add 8 disjunct 512 byte + * partial pages to a bio, it would succeed, + * but could still cross a border of whatever restrictions + * are below us (raid0 stripe boundary). An attempted + * bio_split would not succeed, because bi_vcnt is 8. + * E.g. the xen io layer is known to trigger this. + */ + limits->max_segments = 1; + } + return 0; } EXPORT_SYMBOL_GPL(dm_set_device_limits);