From patchwork Tue Jul 9 07:40:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Wilck X-Patchwork-Id: 11036579 X-Patchwork-Delegate: christophe.varoqui@free.fr 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 F1D4B1395 for ; Tue, 9 Jul 2019 07:42:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DC6F9286C6 for ; Tue, 9 Jul 2019 07:42:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CF934286D5; Tue, 9 Jul 2019 07:42:34 +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,UNPARSEABLE_RELAY 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 6530C286C6 for ; Tue, 9 Jul 2019 07:42:34 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A3DC430C132C; Tue, 9 Jul 2019 07:42:19 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B8E745C2F3; Tue, 9 Jul 2019 07:42:12 +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 1315941F53; Tue, 9 Jul 2019 07:42:01 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x697fvJn031139 for ; Tue, 9 Jul 2019 03:41:58 -0400 Received: by smtp.corp.redhat.com (Postfix) id 489DC53E20; Tue, 9 Jul 2019 07:41:57 +0000 (UTC) Delivered-To: dm-devel@redhat.com Received: from mx1.redhat.com (ext-mx06.extmail.prod.ext.phx2.redhat.com [10.5.110.30]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B988418A56; Tue, 9 Jul 2019 07:41:54 +0000 (UTC) Received: from m9a0001g.houston.softwaregrp.com (m9a0001g.houston.softwaregrp.com [15.124.64.66]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8EAF9A3B6E; Tue, 9 Jul 2019 07:41:39 +0000 (UTC) Received: FROM m9a0001g.houston.softwaregrp.com (15.121.0.191) BY m9a0001g.houston.softwaregrp.com WITH ESMTP; Tue, 9 Jul 2019 07:41:43 +0000 Received: from M4W0334.microfocus.com (2002:f78:1192::f78:1192) by M9W0068.microfocus.com (2002:f79:bf::f79:bf) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1591.10; Tue, 9 Jul 2019 07:40:02 +0000 Received: from NAM01-BY2-obe.outbound.protection.outlook.com (15.124.8.11) by M4W0334.microfocus.com (15.120.17.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1591.10 via Frontend Transport; Tue, 9 Jul 2019 07:40:02 +0000 Received: from CH2PR18MB3349.namprd18.prod.outlook.com (52.132.246.91) by CH2PR18MB3319.namprd18.prod.outlook.com (52.132.246.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2052.18; Tue, 9 Jul 2019 07:40:01 +0000 Received: from CH2PR18MB3349.namprd18.prod.outlook.com ([fe80::8818:7a86:93d7:561a]) by CH2PR18MB3349.namprd18.prod.outlook.com ([fe80::8818:7a86:93d7:561a%6]) with mapi id 15.20.2052.020; Tue, 9 Jul 2019 07:40:01 +0000 From: Martin Wilck To: Christophe Varoqui , Benjamin Marzinski Thread-Topic: [PATCH 1/4] libmultipath: make vector_foreach_slot_backwards work as expected Thread-Index: AQHVNimDUxYQLNpEdEa0CRBeYYtu6w== Date: Tue, 9 Jul 2019 07:40:01 +0000 Message-ID: <20190709073909.32112-2-martin.wilck@suse.com> References: <20190709073909.32112-1-martin.wilck@suse.com> In-Reply-To: <20190709073909.32112-1-martin.wilck@suse.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: AM6P192CA0014.EURP192.PROD.OUTLOOK.COM (2603:10a6:209:83::27) To CH2PR18MB3349.namprd18.prod.outlook.com (2603:10b6:610:2c::27) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Martin.Wilck@suse.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [94.218.227.174] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 79d86345-1d44-420c-0350-08d70440a630 x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(711020)(4605104)(1401327)(2017052603328)(7193020); SRVR:CH2PR18MB3319; x-ms-traffictypediagnostic: CH2PR18MB3319: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:6790; x-forefront-prvs: 0093C80C01 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(979002)(4636009)(376002)(346002)(366004)(136003)(396003)(39860400002)(189003)(199004)(386003)(14444005)(52116002)(6506007)(6512007)(107886003)(110136005)(81166006)(81156014)(478600001)(54906003)(8936002)(26005)(2616005)(256004)(6436002)(4326008)(72206003)(6486002)(316002)(76176011)(102836004)(5660300002)(36756003)(44832011)(4744005)(66556008)(66476007)(73956011)(1076003)(66446008)(7736002)(305945005)(6116002)(3846002)(486006)(68736007)(14454004)(86362001)(66066001)(99286004)(66946007)(64756008)(71190400001)(71200400001)(476003)(53936002)(186003)(11346002)(2906002)(8676002)(50226002)(25786009)(446003)(969003)(989001)(999001)(1009001)(1019001); DIR:OUT; SFP:1102; SCL:1; SRVR:CH2PR18MB3319; H:CH2PR18MB3349.namprd18.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: suse.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: 9cBslYuHZW4efMQfSRK2JDBgnrfjlK+r/3M4eyjL6T5Q5LCcR223cgtrjjmNfOADAT5+hd7Vbt0xncGgTlu8rkluwsyvkOR8L6nRmHepUB6bx4O6XFg3hlqwIh00W5vJtvyFX6l8e7Uo2a+575Evw666TWOP0OtbySeGcBbr405FR5lm3teTp6v4Vy39MAI+mhGVcqZ3gVQzTuOBUUMtNqQOL8ZEEnhDERb+i6cuUNDpx9Gam+T9HGI+4fRexQWedAeoEM1k5OzTBlMle/CT3NCVlu0oVr10xh7k0D1sv2N0GaxYyXPHKpxsREIyeQR/iGYQjoGph/pZcw+PoQzgJ7IPS47e70sDa+QxBKcWb5tuRf1SfPqzANOY9HVghhdGPVPhotOTOHvef1CdsKTgLON+8tRbYbhqHZ+oZgNP3zw= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 79d86345-1d44-420c-0350-08d70440a630 X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Jul 2019 07:40:01.2994 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 856b813c-16e5-49a5-85ec-6f081e13b527 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: Martin.Wilck@suse.com X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR18MB3319 X-OriginatorOrg: suse.com X-Greylist: Sender passed SPF test, ACL 243 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Tue, 09 Jul 2019 07:41:45 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Tue, 09 Jul 2019 07:41:45 +0000 (UTC) for IP:'15.124.64.66' DOMAIN:'m9a0001g.houston.softwaregrp.com' HELO:'m9a0001g.houston.softwaregrp.com' FROM:'Martin.Wilck@suse.com' RCPT:'' X-RedHat-Spam-Score: 0.001 (SPF_HELO_NONE, SPF_PASS, UNPARSEABLE_RELAY) 15.124.64.66 m9a0001g.houston.softwaregrp.com 15.124.64.66 m9a0001g.houston.softwaregrp.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.30 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id x697fvJn031139 X-loop: dm-devel@redhat.com Cc: "dm-devel@redhat.com" , Martin Wilck Subject: [dm-devel] [PATCH 1/4] libmultipath: make vector_foreach_slot_backwards work as expected 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-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.45]); Tue, 09 Jul 2019 07:42:33 +0000 (UTC) X-Virus-Scanned: ClamAV using ClamSMTP From: Benjamin Marzinski All of the code that uses vector_foreach_slot_backwards() treats "i" as the index of the entry "p", but the way it was coded, that wasn't the case. "i" was the number of the entry counting from 1, not 0. Signed-off-by: Benjamin Marzinski Reviewed-by: Martin Wilck --- libmultipath/vector.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libmultipath/vector.h b/libmultipath/vector.h index 41d2b896..344dffd5 100644 --- a/libmultipath/vector.h +++ b/libmultipath/vector.h @@ -40,7 +40,7 @@ typedef struct _vector *vector; #define vector_foreach_slot_after(v,p,i) \ for (; (v) && i < VECTOR_SIZE(v) && ((p) = (v)->slot[i]); i++) #define vector_foreach_slot_backwards(v,p,i) \ - for (i = VECTOR_SIZE(v); i > 0 && ((p) = (v)->slot[i-1]); i--) + for (i = VECTOR_SIZE(v) - 1; (int)i >= 0 && ((p) = (v)->slot[i]); i--) #define identity(x) (x) /* From patchwork Tue Jul 9 07:40:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Wilck X-Patchwork-Id: 11036581 X-Patchwork-Delegate: christophe.varoqui@free.fr 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 D20DE138D for ; Tue, 9 Jul 2019 07:42:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C2718286C1 for ; Tue, 9 Jul 2019 07:42:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B6B14286CF; Tue, 9 Jul 2019 07:42:35 +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,UNPARSEABLE_RELAY 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 615A3286C1 for ; Tue, 9 Jul 2019 07:42:34 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id F18A87FDCC; Tue, 9 Jul 2019 07:42:22 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8B07F7DDE4; Tue, 9 Jul 2019 07:42:16 +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 B15F241F40; Tue, 9 Jul 2019 07:42:04 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x697g13u031237 for ; Tue, 9 Jul 2019 03:42:02 -0400 Received: by smtp.corp.redhat.com (Postfix) id DBFE81840A; Tue, 9 Jul 2019 07:42:01 +0000 (UTC) Delivered-To: dm-devel@redhat.com Received: from mx1.redhat.com (ext-mx06.extmail.prod.ext.phx2.redhat.com [10.5.110.30]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7FBAE183D1; Tue, 9 Jul 2019 07:41:59 +0000 (UTC) Received: from m9a0003g.houston.softwaregrp.com (m9a0003g.houston.softwaregrp.com [15.124.64.68]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4AB36A3B5D; Tue, 9 Jul 2019 07:41:50 +0000 (UTC) Received: FROM m9a0003g.houston.softwaregrp.com (15.121.0.191) BY m9a0003g.houston.softwaregrp.com WITH ESMTP; Tue, 9 Jul 2019 07:41:50 +0000 Received: from M4W0335.microfocus.com (2002:f78:1193::f78:1193) by M9W0068.microfocus.com (2002:f79:bf::f79:bf) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1591.10; Tue, 9 Jul 2019 07:40:03 +0000 Received: from NAM01-BY2-obe.outbound.protection.outlook.com (15.124.8.14) by M4W0335.microfocus.com (15.120.17.147) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1591.10 via Frontend Transport; Tue, 9 Jul 2019 07:40:03 +0000 Received: from CH2PR18MB3349.namprd18.prod.outlook.com (52.132.246.91) by CH2PR18MB3319.namprd18.prod.outlook.com (52.132.246.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2052.18; Tue, 9 Jul 2019 07:40:02 +0000 Received: from CH2PR18MB3349.namprd18.prod.outlook.com ([fe80::8818:7a86:93d7:561a]) by CH2PR18MB3349.namprd18.prod.outlook.com ([fe80::8818:7a86:93d7:561a%6]) with mapi id 15.20.2052.020; Tue, 9 Jul 2019 07:40:02 +0000 From: Martin Wilck To: Christophe Varoqui , Benjamin Marzinski Thread-Topic: [PATCH 2/4] kpartx: recognize DASD on loop devices again Thread-Index: AQHVNimEVSLHgKBLPkyYh5HfJ+6UTA== Date: Tue, 9 Jul 2019 07:40:02 +0000 Message-ID: <20190709073909.32112-3-martin.wilck@suse.com> References: <20190709073909.32112-1-martin.wilck@suse.com> In-Reply-To: <20190709073909.32112-1-martin.wilck@suse.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: AM6P192CA0014.EURP192.PROD.OUTLOOK.COM (2603:10a6:209:83::27) To CH2PR18MB3349.namprd18.prod.outlook.com (2603:10b6:610:2c::27) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Martin.Wilck@suse.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [94.218.227.174] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 0695c101-83b8-404d-eadd-08d70440a714 x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(711020)(4605104)(1401327)(2017052603328)(7193020); SRVR:CH2PR18MB3319; x-ms-traffictypediagnostic: CH2PR18MB3319: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:2733; x-forefront-prvs: 0093C80C01 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(4636009)(376002)(346002)(366004)(136003)(396003)(39860400002)(189003)(199004)(386003)(52116002)(6506007)(6512007)(107886003)(110136005)(81166006)(81156014)(478600001)(54906003)(8936002)(26005)(2616005)(256004)(6436002)(4326008)(72206003)(6486002)(316002)(76176011)(102836004)(5660300002)(36756003)(44832011)(66556008)(66476007)(73956011)(1076003)(66446008)(7736002)(305945005)(6116002)(3846002)(486006)(68736007)(14454004)(86362001)(66066001)(99286004)(66946007)(64756008)(71190400001)(71200400001)(476003)(53936002)(186003)(11346002)(2906002)(8676002)(50226002)(25786009)(446003); DIR:OUT; SFP:1102; SCL:1; SRVR:CH2PR18MB3319; H:CH2PR18MB3349.namprd18.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: suse.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: iE55XHqjI6hW8so7WechzvJItKYFzePpaw7933fCYOmZaRBqQIrWT7m1yUtpvn5c1cEdY35VykcFifRsaHasXl7e8SqtMtT3p8uFtNQk/BtrRE4TwLq1aGGayURoIwSGV1Z7SpQth3JWEOXnFKqZocAfp8m+CeXqkAzuNUf/VnDvJuYxNAbVxayvpEPSn/v+KCrWxZRbUc46Vt8s9sqHLNVLzOK4+onUIxDPwn9Ju/RK3oYxohIAKkPtZO41IV0nMr3Ajv4MWgE+EGjOVwqnOMV520+nGglX73pRwZswXsdJT8c/bqk3MxR5AnA6GhQwo9XEEeimHqk40RJxWjiQGFW0euuNZKb1tnnBbJlLEBdjb9oqPunHlGMjC4A4QZ7D+hGqBEHzPykH7OWvSSpAmrml/NTLij7hwYhznTiFjSc= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 0695c101-83b8-404d-eadd-08d70440a714 X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Jul 2019 07:40:02.5297 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 856b813c-16e5-49a5-85ec-6f081e13b527 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: Martin.Wilck@suse.com X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR18MB3319 X-OriginatorOrg: suse.com X-Greylist: Sender passed SPF test, ACL 243 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Tue, 09 Jul 2019 07:41:51 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Tue, 09 Jul 2019 07:41:51 +0000 (UTC) for IP:'15.124.64.68' DOMAIN:'m9a0003g.houston.softwaregrp.com' HELO:'m9a0003g.houston.softwaregrp.com' FROM:'Martin.Wilck@suse.com' RCPT:'' X-RedHat-Spam-Score: 0.001 (RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, UNPARSEABLE_RELAY) 15.124.64.68 m9a0003g.houston.softwaregrp.com 15.124.64.68 m9a0003g.houston.softwaregrp.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.30 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id x697g13u031237 X-loop: dm-devel@redhat.com Cc: "dm-devel@redhat.com" , Martin Wilck Subject: [dm-devel] [PATCH 2/4] kpartx: recognize DASD on loop devices again 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-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Tue, 09 Jul 2019 07:42:28 +0000 (UTC) X-Virus-Scanned: ClamAV using ClamSMTP From: Martin Wilck Since 4d57b868, DASD partition tables are only recognized on DASD hardware. This turns out to break certain software that works e.g. with DASD partition tables on loop devices. The problem that 4d57b868 attempted to fix was that "unlabeled disk" format has no signature at all and is detected on any volume, including empty ones. With this patch, DASD partition table formats other than "unlabeled disk" are detected on non-DASD devices again. Fixes: 4d57b868 "kpartx: only recognize dasd part table on DASD" Reviewed-by: Benjamin Marzinski Signed-off-by: Martin Wilck --- kpartx/dasd.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/kpartx/dasd.c b/kpartx/dasd.c index d95d8ca0..4e7e4743 100644 --- a/kpartx/dasd.c +++ b/kpartx/dasd.c @@ -133,9 +133,6 @@ read_dasd_pt(int fd, struct slice all, struct slice *sp, int ns) /* Couldn't open the device */ return -1; } - } else if ((unsigned int)major(sbuf.st_rdev) != 94) { - /* Not a DASD */ - return -1; } else { fd_dasd = dup(fd); if (fd_dasd < 0) @@ -279,6 +276,10 @@ read_dasd_pt(int fd, struct slice all, struct slice *sp, int ns) size = disksize; if (fmt_size < size) size = fmt_size; + } else if ((unsigned int)major(sbuf.st_rdev) != 94) { + /* Not a DASD */ + retval = -1; + goto out; } else size = disksize; From patchwork Tue Jul 9 07:40:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Wilck X-Patchwork-Id: 11036591 X-Patchwork-Delegate: christophe.varoqui@free.fr 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 0FD041395 for ; Tue, 9 Jul 2019 07:44:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F1BFA286CF for ; Tue, 9 Jul 2019 07:44:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E55F2286D5; Tue, 9 Jul 2019 07:44:34 +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,UNPARSEABLE_RELAY 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 4E814286CF for ; Tue, 9 Jul 2019 07:44:34 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DF56E30820EA; Tue, 9 Jul 2019 07:44:24 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A0A677DDE4; Tue, 9 Jul 2019 07:44:22 +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 4F19741F63; Tue, 9 Jul 2019 07:44:22 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.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 x697gFvX031495 for ; Tue, 9 Jul 2019 03:42:15 -0400 Received: by smtp.corp.redhat.com (Postfix) id 7B98383FA6; Tue, 9 Jul 2019 07:42:15 +0000 (UTC) Delivered-To: dm-devel@redhat.com Received: from mx1.redhat.com (ext-mx05.extmail.prod.ext.phx2.redhat.com [10.5.110.29]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3C599196EE; Tue, 9 Jul 2019 07:42:13 +0000 (UTC) Received: from m9a0001g.houston.softwaregrp.com (m9a0001g.houston.softwaregrp.com [15.124.64.66]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D33112E97C8; Tue, 9 Jul 2019 07:42:01 +0000 (UTC) Received: FROM m9a0001g.houston.softwaregrp.com (15.121.0.191) BY m9a0001g.houston.softwaregrp.com WITH ESMTP; Tue, 9 Jul 2019 07:42:00 +0000 Received: from M4W0334.microfocus.com (2002:f78:1192::f78:1192) by M9W0068.microfocus.com (2002:f79:bf::f79:bf) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1591.10; Tue, 9 Jul 2019 07:40:05 +0000 Received: from NAM01-BY2-obe.outbound.protection.outlook.com (15.124.8.11) by M4W0334.microfocus.com (15.120.17.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1591.10 via Frontend Transport; Tue, 9 Jul 2019 07:40:05 +0000 Received: from CH2PR18MB3349.namprd18.prod.outlook.com (52.132.246.91) by CH2PR18MB3319.namprd18.prod.outlook.com (52.132.246.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2052.18; Tue, 9 Jul 2019 07:40:04 +0000 Received: from CH2PR18MB3349.namprd18.prod.outlook.com ([fe80::8818:7a86:93d7:561a]) by CH2PR18MB3349.namprd18.prod.outlook.com ([fe80::8818:7a86:93d7:561a%6]) with mapi id 15.20.2052.020; Tue, 9 Jul 2019 07:40:04 +0000 From: Martin Wilck To: Christophe Varoqui , Benjamin Marzinski Thread-Topic: [PATCH 3/4] multipath-tools (coverity): assert availability of CLOCK_MONOTONIC Thread-Index: AQHVNimF3GuzXkxtG0+gh7r5Jhm0wQ== Date: Tue, 9 Jul 2019 07:40:03 +0000 Message-ID: <20190709073909.32112-4-martin.wilck@suse.com> References: <20190709073909.32112-1-martin.wilck@suse.com> In-Reply-To: <20190709073909.32112-1-martin.wilck@suse.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: AM6P192CA0014.EURP192.PROD.OUTLOOK.COM (2603:10a6:209:83::27) To CH2PR18MB3349.namprd18.prod.outlook.com (2603:10b6:610:2c::27) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Martin.Wilck@suse.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [94.218.227.174] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 825213c4-72f5-44d7-e96f-08d70440a7e6 x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(711020)(4605104)(1401327)(2017052603328)(7193020); SRVR:CH2PR18MB3319; x-ms-traffictypediagnostic: CH2PR18MB3319: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:3173; x-forefront-prvs: 0093C80C01 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(4636009)(376002)(346002)(366004)(136003)(396003)(39860400002)(189003)(199004)(386003)(14444005)(52116002)(6506007)(6512007)(107886003)(110136005)(81166006)(81156014)(478600001)(54906003)(8936002)(26005)(2616005)(256004)(6436002)(4326008)(72206003)(6486002)(316002)(76176011)(102836004)(5660300002)(36756003)(44832011)(66556008)(66476007)(73956011)(1076003)(66446008)(7736002)(305945005)(6116002)(3846002)(486006)(68736007)(14454004)(86362001)(66066001)(99286004)(66946007)(64756008)(71190400001)(71200400001)(476003)(53936002)(186003)(11346002)(2906002)(8676002)(50226002)(25786009)(446003); DIR:OUT; SFP:1102; SCL:1; SRVR:CH2PR18MB3319; H:CH2PR18MB3349.namprd18.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: suse.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: 299uXb+4JHHyI0j5EmQp+g7XoodcnmMATWuOOolHG3nCo0R5FOBG8Y4Qd9uOmAuxptK+g6aDxTQLnm/PGngCdU9e4j2y9PlYWfrbkOaz4BmvpnDBX+lct472S0BCVfRSdCHReZD0t4RSKHvoMLSrDVxqCjLHm8Lh2X45c4o7Yi7XZUdBGw5drCp7bS7n2Cj/DIUM5Ig0QXLToRx2lWmK83HCRMdXu3TtLmpVotFNq3l0wHyJR4OOjKT9X8eYdwsBIYW8Q7UaK0C3kXoyFT6NtCqYjn64t5Vq9lW9sMPt2RggkJ4kWehX/3quSQcpHCzHd9Crxi9Ah7AwxUxOoBEtWfqUml8tbXX6qM2Wb0gjmmT2vJtL8VfIzBepHh8uu3gN4EA3VNQOWcOTMFegzQY720oayjMZ1hvnb99aQdKTXT8= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 825213c4-72f5-44d7-e96f-08d70440a7e6 X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Jul 2019 07:40:03.9139 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 856b813c-16e5-49a5-85ec-6f081e13b527 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: Martin.Wilck@suse.com X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR18MB3319 X-OriginatorOrg: suse.com X-Greylist: Sender passed SPF test, ACL 243 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Tue, 09 Jul 2019 07:42:02 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Tue, 09 Jul 2019 07:42:02 +0000 (UTC) for IP:'15.124.64.66' DOMAIN:'m9a0001g.houston.softwaregrp.com' HELO:'m9a0001g.houston.softwaregrp.com' FROM:'Martin.Wilck@suse.com' RCPT:'' X-RedHat-Spam-Score: 0.001 (RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, UNPARSEABLE_RELAY) 15.124.64.66 m9a0001g.houston.softwaregrp.com 15.124.64.66 m9a0001g.houston.softwaregrp.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.29 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id x697gFvX031495 X-loop: dm-devel@redhat.com Cc: "dm-devel@redhat.com" , Martin Wilck Subject: [dm-devel] [PATCH 3/4] multipath-tools (coverity): assert availability of CLOCK_MONOTONIC 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-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.47]); Tue, 09 Jul 2019 07:44:33 +0000 (UTC) X-Virus-Scanned: ClamAV using ClamSMTP From: Martin Wilck clock_gettime() fails only if either an invalid pointer is passed, or if the requested clock ID is not available. While availability of CLOCK_REALTIME is guaranteed, CLOCK_MONOTONIC is not, at least not by POSIX (Linux seems to have it, always). Provide a wrapper that can be called without error checking, and which aborts in the highly unlikely case that the monotonic clock can't be obtained. That saves us from checking the error code of clock_gettime() at every invocation (handling this sort of error "correctly" is almost impossible anyway), and should still satisfy coverity. Not doing this for libdmmp here, as it has it's own error checking and doesn't use headers from libmultipath. ---- v2: Fix mistake that with -DNDEBUG, clock_gettime wouldn't be called at all (Bart van Assche). Signed-off-by: Martin Wilck --- libmultipath/checkers/tur.c | 6 +++--- libmultipath/time-util.c | 9 +++++++++ libmultipath/time-util.h | 1 + multipathd/main.c | 34 +++++++++++++--------------------- multipathd/uxlsnr.c | 8 +++----- 5 files changed, 29 insertions(+), 29 deletions(-) diff --git a/libmultipath/checkers/tur.c b/libmultipath/checkers/tur.c index 6b08dbbb..e886fcf8 100644 --- a/libmultipath/checkers/tur.c +++ b/libmultipath/checkers/tur.c @@ -290,7 +290,7 @@ static void *tur_thread(void *ctx) static void tur_timeout(struct timespec *tsp) { - clock_gettime(CLOCK_MONOTONIC, tsp); + get_monotonic_time(tsp); tsp->tv_nsec += 1000 * 1000; /* 1 millisecond */ normalize_timespec(tsp); } @@ -300,7 +300,7 @@ static void tur_set_async_timeout(struct checker *c) struct tur_checker_context *ct = c->context; struct timespec now; - clock_gettime(CLOCK_MONOTONIC, &now); + get_monotonic_time(&now); ct->time = now.tv_sec + c->timeout; } @@ -309,7 +309,7 @@ static int tur_check_async_timeout(struct checker *c) struct tur_checker_context *ct = c->context; struct timespec now; - clock_gettime(CLOCK_MONOTONIC, &now); + get_monotonic_time(&now); return (now.tv_sec > ct->time); } diff --git a/libmultipath/time-util.c b/libmultipath/time-util.c index 6d79c0e5..a3739a2d 100644 --- a/libmultipath/time-util.c +++ b/libmultipath/time-util.c @@ -3,6 +3,15 @@ #include #include "time-util.h" +void get_monotonic_time(struct timespec *res) +{ + struct timespec ts; + int rv = clock_gettime(CLOCK_MONOTONIC, &ts); + + assert(rv == 0); + *res = ts; +} + /* Initialize @cond as a condition variable that uses the monotonic clock */ void pthread_cond_init_mono(pthread_cond_t *cond) { diff --git a/libmultipath/time-util.h b/libmultipath/time-util.h index b76d2aa4..b23d328a 100644 --- a/libmultipath/time-util.h +++ b/libmultipath/time-util.h @@ -5,6 +5,7 @@ struct timespec; +void get_monotonic_time(struct timespec *res); void pthread_cond_init_mono(pthread_cond_t *cond); void normalize_timespec(struct timespec *ts); void timespecsub(const struct timespec *a, const struct timespec *b, diff --git a/multipathd/main.c b/multipathd/main.c index 7a5cd115..2e4973d7 100644 --- a/multipathd/main.c +++ b/multipathd/main.c @@ -283,11 +283,10 @@ int set_config_state(enum daemon_status state) else if (running_state != DAEMON_IDLE) { struct timespec ts; - if (clock_gettime(CLOCK_MONOTONIC, &ts) == 0) { - ts.tv_sec += 1; - rc = pthread_cond_timedwait(&config_cond, - &config_lock, &ts); - } + get_monotonic_time(&ts); + ts.tv_sec += 1; + rc = pthread_cond_timedwait(&config_cond, + &config_lock, &ts); } if (!rc && (running_state != DAEMON_SHUTDOWN)) { running_state = state; @@ -1888,15 +1887,12 @@ static int check_path_reinstate_state(struct path * pp) { } if (pp->disable_reinstate) { - /* If we don't know how much time has passed, automatically - * reinstate the path, just to be safe. Also, if there are - * no other usable paths, reinstate the path - */ - if (clock_gettime(CLOCK_MONOTONIC, &curr_time) != 0 || - pp->mpp->nr_active == 0) { + /* If there are no other usable paths, reinstate the path */ + if (pp->mpp->nr_active == 0) { condlog(2, "%s : reinstating path early", pp->dev); goto reinstate_path; } + get_monotonic_time(&curr_time); if ((curr_time.tv_sec - pp->dis_reinstate_time ) > pp->mpp->san_path_err_recovery_time) { condlog(2,"%s : reinstate the path after err recovery time", pp->dev); goto reinstate_path; @@ -1932,8 +1928,7 @@ static int check_path_reinstate_state(struct path * pp) { * delay the path, so there's no point in checking if we should */ - if (clock_gettime(CLOCK_MONOTONIC, &curr_time) != 0) - return 0; + get_monotonic_time(&curr_time); /* when path failures has exceeded the san_path_err_threshold * place the path in delayed state till san_path_err_recovery_time * so that the cutomer can rectify the issue within this time. After @@ -2315,17 +2310,14 @@ checkerloop (void *ap) condlog(2, "path checkers start up"); /* Tweak start time for initial path check */ - if (clock_gettime(CLOCK_MONOTONIC, &last_time) != 0) - last_time.tv_sec = 0; - else - last_time.tv_sec -= 1; + get_monotonic_time(&last_time); + last_time.tv_sec -= 1; while (1) { struct timespec diff_time, start_time, end_time; int num_paths = 0, ticks = 0, strict_timing, rc = 0; - if (clock_gettime(CLOCK_MONOTONIC, &start_time) != 0) - start_time.tv_sec = 0; + get_monotonic_time(&start_time); if (start_time.tv_sec && last_time.tv_sec) { timespecsub(&start_time, &last_time, &diff_time); condlog(4, "tick (%lu.%06lu secs)", @@ -2384,8 +2376,8 @@ checkerloop (void *ap) } diff_time.tv_nsec = 0; - if (start_time.tv_sec && - clock_gettime(CLOCK_MONOTONIC, &end_time) == 0) { + if (start_time.tv_sec) { + get_monotonic_time(&end_time); timespecsub(&end_time, &start_time, &diff_time); if (num_paths) { unsigned int max_checkint; diff --git a/multipathd/uxlsnr.c b/multipathd/uxlsnr.c index 04cbb7c7..bc71679e 100644 --- a/multipathd/uxlsnr.c +++ b/multipathd/uxlsnr.c @@ -130,10 +130,10 @@ void check_timeout(struct timespec start_time, char *inbuf, { struct timespec diff_time, end_time; - if (start_time.tv_sec && - clock_gettime(CLOCK_MONOTONIC, &end_time) == 0) { + if (start_time.tv_sec) { unsigned long msecs; + get_monotonic_time(&end_time); timespecsub(&end_time, &start_time, &diff_time); msecs = diff_time.tv_sec * 1000 + diff_time.tv_nsec / (1000 * 1000); @@ -280,9 +280,7 @@ void * uxsock_listen(uxsock_trigger_fn uxsock_trigger, long ux_sock, i, polls[i].fd); continue; } - if (clock_gettime(CLOCK_MONOTONIC, &start_time) - != 0) - start_time.tv_sec = 0; + get_monotonic_time(&start_time); if (recv_packet_from_client(c->fd, &inbuf, uxsock_timeout) != 0) { From patchwork Tue Jul 9 07:40:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Wilck X-Patchwork-Id: 11036583 X-Patchwork-Delegate: christophe.varoqui@free.fr 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 0C16F138D for ; Tue, 9 Jul 2019 07:42:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F04C4286C1 for ; Tue, 9 Jul 2019 07:42:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E4C9E286CF; Tue, 9 Jul 2019 07:42:37 +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,UNPARSEABLE_RELAY 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 815EE286C1 for ; Tue, 9 Jul 2019 07:42:37 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id CBA4A3082201; Tue, 9 Jul 2019 07:42:19 +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 B7ECF5C5FC; Tue, 9 Jul 2019 07:42:12 +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 3EFD718184A5; Tue, 9 Jul 2019 07:41:46 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x697fctZ030789 for ; Tue, 9 Jul 2019 03:41:38 -0400 Received: by smtp.corp.redhat.com (Postfix) id 9A2241001B02; Tue, 9 Jul 2019 07:41:38 +0000 (UTC) Delivered-To: dm-devel@redhat.com Received: from mx1.redhat.com (ext-mx07.extmail.prod.ext.phx2.redhat.com [10.5.110.31]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5D8411001281; Tue, 9 Jul 2019 07:41:35 +0000 (UTC) Received: from m4a0040g.houston.softwaregrp.com (m4a0040g.houston.softwaregrp.com [15.124.2.86]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E8A83C0586C4; Tue, 9 Jul 2019 07:40:58 +0000 (UTC) Received: FROM m4a0040g.houston.softwaregrp.com (15.120.17.146) BY m4a0040g.houston.softwaregrp.com WITH ESMTP; Tue, 9 Jul 2019 07:40:54 +0000 Received: from M4W0335.microfocus.com (2002:f78:1193::f78:1193) by M4W0334.microfocus.com (2002:f78:1192::f78:1192) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1591.10; Tue, 9 Jul 2019 07:40:06 +0000 Received: from NAM01-BY2-obe.outbound.protection.outlook.com (15.124.8.11) by M4W0335.microfocus.com (15.120.17.147) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1591.10 via Frontend Transport; Tue, 9 Jul 2019 07:40:06 +0000 Received: from CH2PR18MB3349.namprd18.prod.outlook.com (52.132.246.91) by CH2PR18MB3319.namprd18.prod.outlook.com (52.132.246.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2052.18; Tue, 9 Jul 2019 07:40:05 +0000 Received: from CH2PR18MB3349.namprd18.prod.outlook.com ([fe80::8818:7a86:93d7:561a]) by CH2PR18MB3349.namprd18.prod.outlook.com ([fe80::8818:7a86:93d7:561a%6]) with mapi id 15.20.2052.020; Tue, 9 Jul 2019 07:40:05 +0000 From: Martin Wilck To: Christophe Varoqui , Benjamin Marzinski Thread-Topic: [PATCH 4/4] libmultipath: trigger uevents for partitions, too Thread-Index: AQHVNimGkr+11WhtHUKMLNds+BG+ow== Date: Tue, 9 Jul 2019 07:40:05 +0000 Message-ID: <20190709073909.32112-5-martin.wilck@suse.com> References: <20190709073909.32112-1-martin.wilck@suse.com> In-Reply-To: <20190709073909.32112-1-martin.wilck@suse.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: AM6P192CA0014.EURP192.PROD.OUTLOOK.COM (2603:10a6:209:83::27) To CH2PR18MB3349.namprd18.prod.outlook.com (2603:10b6:610:2c::27) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Martin.Wilck@suse.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [94.218.227.174] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: de6b46ee-f88e-4ada-674c-08d70440a8a3 x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(711020)(4605104)(1401327)(2017052603328)(7193020); SRVR:CH2PR18MB3319; x-ms-traffictypediagnostic: CH2PR18MB3319: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:1013; x-forefront-prvs: 0093C80C01 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(4636009)(376002)(346002)(366004)(136003)(396003)(39860400002)(189003)(199004)(386003)(14444005)(52116002)(6506007)(6512007)(107886003)(110136005)(81166006)(81156014)(478600001)(54906003)(8936002)(26005)(2616005)(256004)(6436002)(4326008)(72206003)(6486002)(316002)(76176011)(102836004)(5660300002)(36756003)(44832011)(66556008)(66476007)(73956011)(1076003)(66446008)(7736002)(305945005)(6116002)(3846002)(486006)(68736007)(14454004)(86362001)(66066001)(99286004)(66946007)(64756008)(71190400001)(71200400001)(476003)(53936002)(186003)(11346002)(2906002)(8676002)(50226002)(25786009)(446003); DIR:OUT; SFP:1102; SCL:1; SRVR:CH2PR18MB3319; H:CH2PR18MB3349.namprd18.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: suse.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: IboujvqO014OIbKRDmGHZd6S4nRqmdT/e6sx9aF68NRRz/3Sg+bPJOyOsKvM+Thwy5yyruxxhOznczQfeIrcSKmboSDkkpffw9pZqDGwsUTXsye0fsnamULbaXzDQ6qre3vZWsNg3pW/iS0mum3C4dZZIIXtY2ei9BHIQ3GKzsMgXcMSdVtz4eKBgkaG0IDDTJcUvizrytmnep0QYV4Qb8XpsdJxmlBnIUax4U4XXWyRUabZBJ0MeN/77rhRqU4ciKAw2OnNtIsg0rwIVOvXkwuaT4FrIZ7c1KoY17liBj+uXAObgD+iz3x7aSnjpvS4G10dAuE49k6+lUdj+rGkZdC54LdSj6bbkufkCCauOnQhCZk+vIQRV1RP4FqwsTk//w1lk81MDfzX1W8EI8iI2xO8PWkuZDS8A6UfukZCX7g= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: de6b46ee-f88e-4ada-674c-08d70440a8a3 X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Jul 2019 07:40:05.1242 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 856b813c-16e5-49a5-85ec-6f081e13b527 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: Martin.Wilck@suse.com X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR18MB3319 X-OriginatorOrg: suse.com X-Greylist: Sender passed SPF test, ACL 243 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Tue, 09 Jul 2019 07:41:23 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Tue, 09 Jul 2019 07:41:23 +0000 (UTC) for IP:'15.124.2.86' DOMAIN:'m4a0040g.houston.softwaregrp.com' HELO:'m4a0040g.houston.softwaregrp.com' FROM:'Martin.Wilck@suse.com' RCPT:'' X-RedHat-Spam-Score: 0.001 (RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, UNPARSEABLE_RELAY) 15.124.2.86 m4a0040g.houston.softwaregrp.com 15.124.2.86 m4a0040g.houston.softwaregrp.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.31 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id x697fctZ030789 X-loop: dm-devel@redhat.com Cc: "dm-devel@redhat.com" , Martin Wilck Subject: [dm-devel] [PATCH 4/4] libmultipath: trigger uevents for partitions, too 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-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.47]); Tue, 09 Jul 2019 07:42:35 +0000 (UTC) X-Virus-Scanned: ClamAV using ClamSMTP From: Martin Wilck We have added code to re-trigger uevents in various cases where the status of a device changes from multipath to non-multipath, or vice-versa. When multipathd triggers uevents for paths of a map because the status of the map has changed, it needs to trigger events for the partitions of the path devices, too. The kernel doesn't do this automatically. Fixes: c5023200 libmultipath: indicate wwid failure in dm_addmap_create() Fixes: e5d3c3a0 libmultipath: trigger change uevent on new device creation Signed-off-by: Martin Wilck --- libmultipath/configure.c | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/libmultipath/configure.c b/libmultipath/configure.c index b09ef529..4cdf1363 100644 --- a/libmultipath/configure.c +++ b/libmultipath/configure.c @@ -519,6 +519,42 @@ trigger_udev_change(const struct multipath *mpp) udev_device_unref(udd); } +static void trigger_partitions_udev_change(struct udev_device *dev, + const char *action, int len) +{ + struct udev_enumerate *part_enum; + struct udev_list_entry *item; + + part_enum = udev_enumerate_new(udev); + if (!part_enum) + return; + + if (udev_enumerate_add_match_parent(part_enum, dev) < 0 || + udev_enumerate_add_match_subsystem(part_enum, "block") < 0 || + udev_enumerate_scan_devices(part_enum) < 0) + goto unref; + + udev_list_entry_foreach(item, + udev_enumerate_get_list_entry(part_enum)) { + const char *syspath; + struct udev_device *part; + + syspath = udev_list_entry_get_name(item); + part = udev_device_new_from_syspath(udev, syspath); + if (!part) + continue; + + if (!strcmp("partition", udev_device_get_devtype(part))) { + condlog(4, "%s: triggering %s event for %s", __func__, + action, syspath); + sysfs_attr_set_value(part, "uevent", action, len); + } + udev_device_unref(part); + } +unref: + udev_enumerate_unref(part_enum); +} + void trigger_paths_udev_change(struct multipath *mpp, bool is_mpath) { @@ -569,6 +605,8 @@ trigger_paths_udev_change(struct multipath *mpp, bool is_mpath) action, pp->dev, is_mpath ? "" : "no "); sysfs_attr_set_value(pp->udev, "uevent", action, strlen(action)); + trigger_partitions_udev_change(pp->udev, action, + strlen(action)); } }