From patchwork Tue Oct 11 15:04:34 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinz Mauelshagen X-Patchwork-Id: 9371273 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.web.codeaurora.org (Postfix) with ESMTP id 98F15607FD for ; Tue, 11 Oct 2016 15:07:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8994129CBD for ; Tue, 11 Oct 2016 15:07:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7E47829CC4; Tue, 11 Oct 2016 15:07:05 +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=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from mx4-phx2.redhat.com (mx4-phx2.redhat.com [209.132.183.25]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6D3DE29CBD for ; Tue, 11 Oct 2016 15:07:03 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx4-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id u9BF4cK1027393; Tue, 11 Oct 2016 11:04:38 -0400 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id u9BF4bK5022442 for ; Tue, 11 Oct 2016 11:04:37 -0400 Received: from o.ww.redhat.com (ovpn-204-18.brq.redhat.com [10.40.204.18]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u9BF4YMo016386 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 11 Oct 2016 11:04:36 -0400 To: Andy Whitcroft , Alasdair Kergon , Mike Snitzer References: <20161011142835.11620-1-apw@canonical.com> From: Heinz Mauelshagen Message-ID: <1c517f14-1234-7844-fc6a-cd1b9698fb8b@redhat.com> Date: Tue, 11 Oct 2016 17:04:34 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 MIME-Version: 1.0 In-Reply-To: <20161011142835.11620-1-apw@canonical.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-loop: dm-devel@redhat.com Cc: linux-raid@vger.kernel.org, dm-devel@redhat.com, Shaohua Li , linux-kernel@vger.kernel.org Subject: Re: [dm-devel] [PATCH 1/1] dm raid: fix compat_features validation 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: , Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com X-Virus-Scanned: ClamAV using ClamSMTP Andy, good catch. We should rather check for V190 support only in case any compat feature flags are actually set. I.e.: rs->ti->error = "Unable to assemble array: Unknown flag(s) in compatible feature flags"; return -EINVAL; } On 10/11/2016 04:28 PM, Andy Whitcroft wrote: > In commit ecbfb9f118bce4 ("dm raid: add raid level takeover support") a new > compatible feature flag was added. Validation for these compat_features > was added but this only passes for new raid mappings with this feature > flag. This causes previously created raid mappings to be failed at import. > > Check compat_features for any valid combinations. > > Fixes: ecbfb9f118bce4 ("dm raid: add raid level takeover support") > BugLink: http://bugs.launchpad.net/bugs/1631298 > Signed-off-by: Andy Whitcroft > --- > drivers/md/dm-raid.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > It very much looks like these are intended to be optional extended feature > flags. That we should be accepting any valid flag and rejecting any bit > not in that set. We should however not be ensuring that specific bits > are actually set. Certainly as things stand raid sets built on previous > kernel versions cannot be assembled. > > diff --git a/drivers/md/dm-raid.c b/drivers/md/dm-raid.c > index 8abde6b..6ddea60 100644 > --- a/drivers/md/dm-raid.c > +++ b/drivers/md/dm-raid.c > @@ -2258,7 +2258,7 @@ static int super_validate(struct raid_set *rs, struct md_rdev *rdev) > if (!mddev->events && super_init_validation(rs, rdev)) > return -EINVAL; > > - if (le32_to_cpu(sb->compat_features) != FEATURE_FLAG_SUPPORTS_V190) { > + if (le32_to_cpu(sb->compat_features) & ~(FEATURE_FLAG_SUPPORTS_V190)) { > rs->ti->error = "Unable to assemble array: Unknown flag(s) in compatible feature flags"; > return -EINVAL; > } --- dm-devel mailing list dm-devel@redhat.com https://www.redhat.com/mailman/listinfo/dm-devel diff --git a/drivers/md/dm-raid.c b/drivers/md/dm-raid.c index 8abde6b..2a39700 100644 --- a/drivers/md/dm-raid.c +++ b/drivers/md/dm-raid.c @@ -2258,7 +2258,8 @@ static int super_validate(struct raid_set *rs, struct md_rdev *rdev) if (!mddev->events && super_init_validation(rs, rdev)) return -EINVAL; - if (le32_to_cpu(sb->compat_features) != FEATURE_FLAG_SUPPORTS_V190) { + if (le32_to_cpu(sb->compat_features) && + le32_to_cpu(sb->compat_features) != FEATURE_FLAG_SUPPORTS_V190) {