From patchwork Wed Sep 17 01:15:55 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: NeilBrown X-Patchwork-Id: 4922251 X-Patchwork-Delegate: snitzer@redhat.com Return-Path: X-Original-To: patchwork-dm-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 1DE059F2EC for ; Wed, 17 Sep 2014 01:18:37 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2A76D2015A for ; Wed, 17 Sep 2014 01:20:21 +0000 (UTC) Received: from mx6-phx2.redhat.com (mx6-phx2.redhat.com [209.132.183.39]) by mail.kernel.org (Postfix) with ESMTP id 43C4D20158 for ; Wed, 17 Sep 2014 01:20:20 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx6-phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s8H1G8kr007366; Tue, 16 Sep 2014 21:16:09 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id s8H1G6Qa028892 for ; Tue, 16 Sep 2014 21:16:06 -0400 Received: from mx1.redhat.com (ext-mx13.extmail.prod.ext.phx2.redhat.com [10.5.110.18]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s8H1G6t5009072; Tue, 16 Sep 2014 21:16:06 -0400 Received: from mx2.suse.de (cantor2.suse.de [195.135.220.15]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s8H1G3kP027937 (version=TLSv1/SSLv3 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=FAIL); Tue, 16 Sep 2014 21:16:04 -0400 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 70B55AB13; Wed, 17 Sep 2014 01:16:03 +0000 (UTC) Date: Wed, 17 Sep 2014 11:15:55 +1000 From: NeilBrown To: Alasdair G Kergon Message-ID: <20140917111555.0e8df37f@notabene.brown> In-Reply-To: <20140916234008.GE2407@agk-dp.fab.redhat.com> References: <1409127505-5246-1-git-send-email-lwang@suse.com> <20140916232104.GC2407@agk-dp.fab.redhat.com> <20140916233529.GD2407@agk-dp.fab.redhat.com> <20140916234008.GE2407@agk-dp.fab.redhat.com> MIME-Version: 1.0 X-RedHat-Spam-Score: -7.552 (BAYES_00,RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD) X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-Scanned-By: MIMEDefang 2.68 on 10.5.110.18 X-loop: dm-devel@redhat.com Cc: Liuhua Wang , dm-devel@redhat.com Subject: Re: [dm-devel] [PATCH] fix mirror device creation with lvcreate failed 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-Spam-Status: No, score=-3.3 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Wed, 17 Sep 2014 00:40:08 +0100 Alasdair G Kergon wrote: > On Wed, Sep 17, 2014 at 12:35:29AM +0100, Alasdair G Kergon wrote: > > > > - ret = read_disk_sb(rdev, rdev->sb_size); > > And if that needed changing to 4096, why does this similar instance elsewhere > one not also need changing? > > static void attempt_restore_of_faulty_devices(struct raid_set *rs) > { > ... > sync_page_io(r, 0, r->sb_size, r->sb_page, READ, 1)) { > > Alasdair > That suggests we should probably "fix" the problem in sync_page_io(). e.g. I'll queue that up and maybe tag it for -stable. Thanks, NeilBrown --- dm-devel mailing list dm-devel@redhat.com https://www.redhat.com/mailman/listinfo/dm-devel diff --git a/drivers/md/md.c b/drivers/md/md.c index 6be7146be5b3..e02de054fd9f 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -777,6 +777,9 @@ int sync_page_io(struct md_rdev *rdev, sector_t sector, int size, bio->bi_bdev = (metadata_op && rdev->meta_bdev) ? rdev->meta_bdev : rdev->bdev; + size = roundup(size, bdev_logical_block_size(bio->bi_bdev)); + if (size > PAGE_SIZE) + return -EINVAL; if (metadata_op) bio->bi_iter.bi_sector = sector + rdev->sb_start; else if (rdev->mddev->reshape_position != MaxSector &&