From patchwork Mon Apr 24 22:39:30 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Marzinski X-Patchwork-Id: 9697331 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 39B91601E9 for ; Mon, 24 Apr 2017 22:40:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2B31C25D9E for ; Mon, 24 Apr 2017 22:40:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1E79628404; Mon, 24 Apr 2017 22:40:02 +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=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 BBCEA25D9E for ; Mon, 24 Apr 2017 22:40:01 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7B2FFC052507; Mon, 24 Apr 2017 22:40:00 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 7B2FFC052507 Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=dm-devel-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 7B2FFC052507 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 588F953CF1; Mon, 24 Apr 2017 22:40:00 +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 1B6B318523D1; Mon, 24 Apr 2017 22:40:00 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v3OMdkwS006464 for ; Mon, 24 Apr 2017 18:39:46 -0400 Received: by smtp.corp.redhat.com (Postfix) id D5D53179C2; Mon, 24 Apr 2017 22:39:46 +0000 (UTC) Delivered-To: dm-devel@redhat.com Received: from redhat.com (octiron.msp.redhat.com [10.15.80.209]) by smtp.corp.redhat.com (Postfix) with SMTP id A4AA817CFB; Mon, 24 Apr 2017 22:39:45 +0000 (UTC) Received: by redhat.com (sSMTP sendmail emulation); Mon, 24 Apr 2017 17:39:45 -0500 From: "Benjamin Marzinski" To: device-mapper development Date: Mon, 24 Apr 2017 17:39:30 -0500 Message-Id: <1493073570-17167-6-git-send-email-bmarzins@redhat.com> In-Reply-To: <1493073570-17167-1-git-send-email-bmarzins@redhat.com> References: <1493073570-17167-1-git-send-email-bmarzins@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: dm-devel@redhat.com Subject: [dm-devel] [PATCH 5/5] libmultipath: force udev reloads 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.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Mon, 24 Apr 2017 22:40:01 +0000 (UTC) X-Virus-Scanned: ClamAV using ClamSMTP Now that the multipath udev rules try harder to not do lvm scans or kpartx runs unnecessarily, multipath needs to make sure that these do run when they are wanted. This patch makes sure that when a device is force reloaded, or changes size, the MPATH_UDEV_RELOAD_FLAG isn't set. This allows lvm scanning and kpartx runs to happen on these uevents. Signed-off-by: Benjamin Marzinski --- libmultipath/configure.c | 7 ++++++- libmultipath/devmapper.c | 3 ++- libmultipath/structs.h | 1 + 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/libmultipath/configure.c b/libmultipath/configure.c index b29a660..bd090d9 100644 --- a/libmultipath/configure.c +++ b/libmultipath/configure.c @@ -499,8 +499,10 @@ select_action (struct multipath * mpp, vector curmp, int force_reload) cmpp->alias, mpp->alias); strncpy(mpp->alias_old, cmpp->alias, WWID_SIZE - 1); mpp->action = ACT_RENAME; - if (force_reload) + if (force_reload) { + mpp->force_udev_reload = 1; mpp->action = ACT_FORCERENAME; + } return; } mpp->action = ACT_CREATE; @@ -538,12 +540,14 @@ select_action (struct multipath * mpp, vector curmp, int force_reload) return; } if (force_reload) { + mpp->force_udev_reload = 1; mpp->action = ACT_RELOAD; condlog(3, "%s: set ACT_RELOAD (forced by user)", mpp->alias); return; } if (cmpp->size != mpp->size) { + mpp->force_udev_reload = 1; mpp->action = ACT_RESIZE; condlog(3, "%s: set ACT_RESIZE (size change)", mpp->alias); @@ -797,6 +801,7 @@ int domap(struct multipath *mpp, char *params, int is_daemon) * DM_DEVICE_CREATE, DM_DEVICE_RENAME, or DM_DEVICE_RELOAD * succeeded */ + mpp->force_udev_reload = 0; if (mpp->action == ACT_CREATE) remember_wwid(mpp->wwid); if (!is_daemon) { diff --git a/libmultipath/devmapper.c b/libmultipath/devmapper.c index c7602cb..d73ba1a 100644 --- a/libmultipath/devmapper.c +++ b/libmultipath/devmapper.c @@ -372,7 +372,8 @@ int dm_addmap_create (struct multipath *mpp, char * params) int dm_addmap_reload(struct multipath *mpp, char *params, int flush) { int r = 0; - uint16_t udev_flags = (flush ? 0 : MPATH_UDEV_RELOAD_FLAG) | + uint16_t udev_flags = ((mpp->force_udev_reload)? + 0 : MPATH_UDEV_RELOAD_FLAG) | ((mpp->skip_kpartx == SKIP_KPARTX_ON)? MPATH_UDEV_NO_KPARTX_FLAG : 0) | ((mpp->nr_active)? 0 : MPATH_UDEV_NO_PATHS_FLAG); diff --git a/libmultipath/structs.h b/libmultipath/structs.h index 98e13e4..01e031a 100644 --- a/libmultipath/structs.h +++ b/libmultipath/structs.h @@ -272,6 +272,7 @@ struct multipath { int skip_kpartx; int max_sectors_kb; int force_readonly; + int force_udev_reload; unsigned int dev_loss; uid_t uid; gid_t gid;