From patchwork Wed Sep 5 17:36:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinz Mauelshagen X-Patchwork-Id: 10589217 X-Patchwork-Delegate: snitzer@redhat.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3CDEB1669 for ; Wed, 5 Sep 2018 17:37:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 26521290B3 for ; Wed, 5 Sep 2018 17:37:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1ACA929353; Wed, 5 Sep 2018 17:37:03 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B1D142926D for ; Wed, 5 Sep 2018 17:37:02 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9B5163001C5D; Wed, 5 Sep 2018 17:37:01 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 620A226DC4; Wed, 5 Sep 2018 17:37:01 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 10D10181A12F; Wed, 5 Sep 2018 17:37:01 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w85HaqEm028048 for ; Wed, 5 Sep 2018 13:36:52 -0400 Received: by smtp.corp.redhat.com (Postfix) id F341063A63; Wed, 5 Sep 2018 17:36:51 +0000 (UTC) Delivered-To: dm-devel@redhat.com Received: from o.ww.redhat.com (ovpn-204-65.brq.redhat.com [10.40.204.65]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5AC10FA96D; Wed, 5 Sep 2018 17:36:51 +0000 (UTC) From: Heinz Mauelshagen To: heinzm@redhat.com, dm-devel@redhat.com Date: Wed, 5 Sep 2018 19:36:43 +0200 Message-Id: <62c2b6e2f3fd78591c15144970791416a9012a55.1536167421.git.heinzm@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-loop: dm-devel@redhat.com Subject: [dm-devel] [PATCH 3/5] dm-raid: correct explicit superblock update requests X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.47]); Wed, 05 Sep 2018 17:37:02 +0000 (UTC) X-Virus-Scanned: ClamAV using ClamSMTP Critical: Request superblock updates when particular devices are requested to be rebuild (e.g. via lvconvert --replace ...) to avoid racy "New device injected into existing raid set without 'delta_disks' or 'rebuild' parameter specified" kernel error messages. Cleanup: Remove request to write superblocks in super_load() when new, because raid_ctr() requests it already via flag RT_FLAG_UPDATE_SBS for new arrays (it's performed in preresume). Avoid explicit superblocks update in rs_start_reshape() because it's already requested before for new reshapes in rs_prepare_reshape(). Signed-off-by: Heinz Mauelshagen --- drivers/md/dm-raid.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/drivers/md/dm-raid.c b/drivers/md/dm-raid.c index 03dd915eff9e..efe035fcb23e 100644 --- a/drivers/md/dm-raid.c +++ b/drivers/md/dm-raid.c @@ -2202,9 +2202,6 @@ static int super_load(struct md_rdev *rdev, struct md_rdev *refdev) set_bit(FirstUse, &rdev->flags); sb->compat_features = cpu_to_le32(FEATURE_FLAG_SUPPORTS_V190); - /* Force writing of superblocks to disk */ - set_bit(MD_SB_CHANGE_DEVS, &rdev->mddev->sb_flags); - /* Any superblock is better than none, choose that if given */ return refdev ? 0 : 1; } @@ -3126,6 +3123,11 @@ static int raid_ctr(struct dm_target *ti, unsigned int argc, char **argv) set_bit(RT_FLAG_UPDATE_SBS, &rs->runtime_flags); rs_set_new(rs); } else if (rs_is_recovering(rs)) { + /* Rebuild particular devices */ + if (test_bit(__CTR_FLAG_REBUILD, &rs->ctr_flags)) { + set_bit(RT_FLAG_UPDATE_SBS, &rs->runtime_flags); + rs_setup_recovery(rs, MaxSector); + } /* A recovering raid set may be resized */ ; /* skip setup rs */ } else if (rs_is_reshaping(rs)) { @@ -3234,7 +3236,6 @@ static int raid_ctr(struct dm_target *ti, unsigned int argc, char **argv) } r = md_start(&rs->md); - if (r) { ti->error = "Failed to start raid array"; mddev_unlock(&rs->md); @@ -3846,7 +3847,7 @@ static int __load_dirty_region_bitmap(struct raid_set *rs) return r; } -/* Enforce updating all superblocks */ +/* Enforce updating new superblocks */ static void rs_update_sbs(struct raid_set *rs) { struct mddev *mddev = &rs->md; @@ -3901,13 +3902,6 @@ static int rs_start_reshape(struct raid_set *rs) } } - /* - * Now reshape got set up, update superblocks to - * reflect the fact so that a table reload will - * access proper superblock content in the ctr. - */ - rs_update_sbs(rs); - return 0; }