From patchwork Tue Jul 16 07:12:59 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hannes Reinecke X-Patchwork-Id: 2827926 Return-Path: X-Original-To: patchwork-dm-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 2F7069F9CA for ; Tue, 16 Jul 2013 07:16:47 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 04D2420186 for ; Tue, 16 Jul 2013 07:16:46 +0000 (UTC) Received: from mx4-phx2.redhat.com (mx4-phx2.redhat.com [209.132.183.25]) by mail.kernel.org (Postfix) with ESMTP id 9894C20189 for ; Tue, 16 Jul 2013 07:16:44 +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 r6G7Ds8J021483; Tue, 16 Jul 2013 03:13:54 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.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 r6G7DRiM027765 for ; Tue, 16 Jul 2013 03:13:27 -0400 Received: from mx1.redhat.com (ext-mx13.extmail.prod.ext.phx2.redhat.com [10.5.110.18]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r6G7DRNO004624 for ; Tue, 16 Jul 2013 03:13:27 -0400 Received: from mx2.suse.de (cantor2.suse.de [195.135.220.15]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r6G7DQHY007267 for ; Tue, 16 Jul 2013 03:13:26 -0400 Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 4F9FFA5528; Tue, 16 Jul 2013 09:13:24 +0200 (CEST) From: Hannes Reinecke To: Christophe Varoqui Date: Tue, 16 Jul 2013 09:12:59 +0200 Message-Id: <1373958801-103613-9-git-send-email-hare@suse.de> In-Reply-To: <1373958801-103613-1-git-send-email-hare@suse.de> References: <1373958801-103613-1-git-send-email-hare@suse.de> X-RedHat-Spam-Score: -7.29 (BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, URIBL_BLOCKED) X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-Scanned-By: MIMEDefang 2.68 on 10.5.110.18 X-loop: dm-devel@redhat.com Cc: dm-devel@redhat.com Subject: [dm-devel] [PATCH 08/30] kpartx: create correct symlinks for PATH_FAILED events X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk Reply-To: device-mapper development 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-Spam-Status: No, score=-7.3 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The kernel is sending out PATH_FAILED/PATH_REINSTATED events, upon each of which we need to regenerate the existing symlinks. However, for an all-paths-down scenario we cannot read from the disk, so we cannot execute blkid or kpartx. For these cases we need to import the existing data from the udev database. Signed-off-by: Hannes Reinecke --- kpartx/kpartx.rules | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/kpartx/kpartx.rules b/kpartx/kpartx.rules index b96ec89..5c0d0ff 100644 --- a/kpartx/kpartx.rules +++ b/kpartx/kpartx.rules @@ -8,11 +8,16 @@ KERNEL!="dm-*", GOTO="kpartx_end" ACTION=="remove", GOTO="kpartx_end" ENV{DM_TABLE_STATE}!="LIVE", GOTO="kpartx_end" -ENV{DM_ACTION}=="PATH_FAILED|PATH_REINSTATED", GOTO="kpartx_end" ENV{DM_DEPS}=="0", GOTO="kpartx_end" ENV{DM_UUID}=="?*", IMPORT{program}=="kpartx_id %M %m $env{DM_UUID}" +ENV{DM_ACTION}=="PATH_FAILED", ENV{DM_NR_VALID_PATHS}=="0", \ + GOTO="blkid_end" +ENV{DM_UUID}=="mpath-*", IMPORT{program}="/sbin/blkid -o udev -p $tempnode" +ENV{DM_PART}=="?*", IMPORT{program}="/sbin/blkid -o udev -p $tempnode" +LABEL="blkid_end" + OPTIONS="link_priority=50" # Create persistent links for multipath tables @@ -31,7 +36,18 @@ ENV{DM_MPATH}=="?*", ENV{DM_PART}=="?*", \ ENV{DM_WWN}=="?*", ENV{DM_PART}=="?*", \ SYMLINK+="disk/by-id/wwn-$env{DM_WWN}-part$env{DM_PART}" +# Create persistent by-label/by-uuid links +ENV{ID_FS_USAGE}=="?*", IMPORT{db}="ID_FS_USAGE" +ENV{ID_FS_UUID_ENC}=="?*", IMPORT{db}="ID_FS_UUID_ENC" +ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{ID_FS_UUID_ENC}=="?*", \ + SYMLINK+="disk/by-uuid/$env{ID_FS_UUID_ENC}" +ENV{ID_FS_LABEL_ENC}=="?*", IMPORT{db}="ID_FS_LABEL_ENC" +ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_ENC}=="?*", \ + SYMLINK+="disk/by-label/$env{ID_FS_LABEL_ENC}" + # Create dm tables for partitions +ENV{DM_ACTION}=="PATH_FAILED", ENV{DM_NR_VALID_PATHS}=="0", \ + GOTO="kpartx_end" ENV{DM_STATE}!="SUSPENDED", ENV{DM_UUID}=="mpath-*", \ RUN+="/sbin/kpartx -u -p -part /dev/$name"