From patchwork Fri Oct 6 20:32:47 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ritika Srivastava X-Patchwork-Id: 9990361 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.web.codeaurora.org (Postfix) with ESMTP id DA80160244 for ; Fri, 6 Oct 2017 21:20:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CB51F28DA5 for ; Fri, 6 Oct 2017 21:20:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C017B28DC0; Fri, 6 Oct 2017 21:20:49 +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, 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 4074F28DA5 for ; Fri, 6 Oct 2017 21:20:49 +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 B9025356CD; Fri, 6 Oct 2017 21:20:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com B9025356CD Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; dmarc=fail (p=none dis=none) header.from=oracle.com Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=dm-devel-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com B9025356CD 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 237F16031E; Fri, 6 Oct 2017 21:20:46 +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 AC9A218355C5; Fri, 6 Oct 2017 21:20:41 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v96KeJIg019741 for ; Fri, 6 Oct 2017 16:40:19 -0400 Received: by smtp.corp.redhat.com (Postfix) id 5DA0C60F9C; Fri, 6 Oct 2017 20:40:19 +0000 (UTC) Delivered-To: dm-devel@redhat.com Received: from mx1.redhat.com (ext-mx03.extmail.prod.ext.phx2.redhat.com [10.5.110.27]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 56E8160C82 for ; Fri, 6 Oct 2017 20:40:16 +0000 (UTC) Received: from userp1040.oracle.com (userp1040.oracle.com [156.151.31.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D5FD4780D2 for ; Fri, 6 Oct 2017 20:40:14 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com D5FD4780D2 Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=pass (p=none dis=none) header.from=oracle.com Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=ritika.srivastava@oracle.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com D5FD4780D2 Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id v96KeD3L031283 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Fri, 6 Oct 2017 20:40:14 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id v96KeD5t013387 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Fri, 6 Oct 2017 20:40:13 GMT Received: from abhmp0016.oracle.com (abhmp0016.oracle.com [141.146.116.22]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id v96KeDmM000640 for ; Fri, 6 Oct 2017 20:40:13 GMT Received: from localhost.localdomain.localdomain (/10.211.44.96) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 06 Oct 2017 13:40:13 -0700 From: Ritika Srivastava To: dm-devel@redhat.com Date: Fri, 6 Oct 2017 13:32:47 -0700 Message-Id: <1507321967-12942-1-git-send-email-ritika.srivastava@oracle.com> X-Source-IP: aserv0022.oracle.com [141.146.126.234] X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 205 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Fri, 06 Oct 2017 20:40:15 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Fri, 06 Oct 2017 20:40:15 +0000 (UTC) for IP:'156.151.31.81' DOMAIN:'userp1040.oracle.com' HELO:'userp1040.oracle.com' FROM:'ritika.srivastava@oracle.com' RCPT:'' X-RedHat-Spam-Score: -105.101 (RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H2, RP_MATCHES_RCVD, SPF_PASS, UNPARSEABLE_RELAY, USER_IN_WHITELIST) 156.151.31.81 userp1040.oracle.com 156.151.31.81 userp1040.oracle.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.27 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: dm-devel@redhat.com Cc: martin.petersen@oracle.com Subject: [dm-devel] [PATCH 1/1] multipath-tools: Skip CHANGE uevent for non-mpath devices 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.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.30]); Fri, 06 Oct 2017 21:20:48 +0000 (UTC) X-Virus-Scanned: ClamAV using ClamSMTP On removal of lv device snapshot using lvremove, CHANGE uevent and REMOVE uevent is generated for the dm device. When multipath tries to process the CHANGE uevent, it is not able to find the dm/map name and returns 1 due to which the following error is printed "uevent trigger error" This scenario is not actually an error and is misleading. To fix it, the proposal is to only process the change uevent in multipath for a multipath device. Signed-off-by: Ritika Srivastava --- libmultipath/uevent.c | 16 ++++++++++++++++ libmultipath/uevent.h | 1 + multipathd/main.c | 8 +++++++- 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/libmultipath/uevent.c b/libmultipath/uevent.c index 0cbcc59..2afc2a9 100644 --- a/libmultipath/uevent.c +++ b/libmultipath/uevent.c @@ -922,3 +922,19 @@ char *uevent_get_dm_name(struct uevent *uev) } return p; } + +char *uevent_get_dm_uuid(struct uevent *uev) +{ + char *p = NULL; + int i; + + for (i = 0; uev->envp[i] != NULL; i++) { + if (!strncmp(uev->envp[i], "DM_UUID", 6) && + strlen(uev->envp[i]) > 7) { + p = MALLOC(strlen(uev->envp[i] + 8) + 1); + strcpy(p, uev->envp[i] + 8); + break; + } + } + return p; +} diff --git a/libmultipath/uevent.h b/libmultipath/uevent.h index 61a4207..1a7b549 100644 --- a/libmultipath/uevent.h +++ b/libmultipath/uevent.h @@ -37,5 +37,6 @@ int uevent_get_major(struct uevent *uev); int uevent_get_minor(struct uevent *uev); int uevent_get_disk_ro(struct uevent *uev); char *uevent_get_dm_name(struct uevent *uev); +char *uevent_get_dm_uuid(struct uevent *uev); #endif /* _UEVENT_H */ diff --git a/multipathd/main.c b/multipathd/main.c index 8049da2..457d95d 100644 --- a/multipathd/main.c +++ b/multipathd/main.c @@ -1129,6 +1129,7 @@ uev_trigger (struct uevent * uev, void * trigger_data) int r = 0; struct vectors * vecs; struct uevent *merge_uev, *tmp; + char *dm_uuid; vecs = (struct vectors *)trigger_data; @@ -1149,7 +1150,12 @@ uev_trigger (struct uevent * uev, void * trigger_data) */ if (!strncmp(uev->kernel, "dm-", 3)) { if (!strncmp(uev->action, "change", 6)) { - r = uev_add_map(uev, vecs); + dm_uuid = uevent_get_dm_uuid(uev); + if (dm_uuid) { + if (!strncmp(dm_uuid, "mpath-", 6)) + r = uev_add_map(uev, vecs); + FREE(dm_uuid); + } goto out; } if (!strncmp(uev->action, "remove", 6)) {