From patchwork Sat Oct 29 02:55:19 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Marzinski X-Patchwork-Id: 9403043 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 D0E0560588 for ; Sat, 29 Oct 2016 02:58:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BFD3A2A6A6 for ; Sat, 29 Oct 2016 02:58:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B0FF02A6B5; Sat, 29 Oct 2016 02:58:13 +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=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from mx6-phx2.redhat.com (mx6-phx2.redhat.com [209.132.183.39]) (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 369322A6A6 for ; Sat, 29 Oct 2016 02:58:12 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx6-phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u9T2tYxU056975; Fri, 28 Oct 2016 22:55:35 -0400 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id u9T2tXaM026550 for ; Fri, 28 Oct 2016 22:55:33 -0400 Received: from redhat.com (octiron.msp.redhat.com [10.15.80.209]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with SMTP id u9T2tWsT007766; Fri, 28 Oct 2016 22:55:32 -0400 Received: by redhat.com (sSMTP sendmail emulation); Fri, 28 Oct 2016 21:55:32 -0500 From: "Benjamin Marzinski" To: device-mapper development Date: Fri, 28 Oct 2016 21:55:19 -0500 Message-Id: <1477709726-5442-4-git-send-email-bmarzins@redhat.com> In-Reply-To: <1477709726-5442-1-git-send-email-bmarzins@redhat.com> References: <1477709726-5442-1-git-send-email-bmarzins@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 X-loop: dm-devel@redhat.com Subject: [dm-devel] [PATCH 03/10] do not allow in-use path to change wwid 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-Virus-Scanned: ClamAV using ClamSMTP When a path is part of a multipath device, it must not change it's wwid. If it can, when multipathd is reconfigured, you can end up with two multipath devices owning the same path, eventually leading to a crash. Signed-off-by: Benjamin Marzinski --- libmultipath/dmparser.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/libmultipath/dmparser.c b/libmultipath/dmparser.c index 9e79ecd..87e8398 100644 --- a/libmultipath/dmparser.c +++ b/libmultipath/dmparser.c @@ -380,6 +380,14 @@ disassemble_map (vector pathvec, char * params, struct multipath * mpp, strncpy(pp->wwid, mpp->wwid, WWID_SIZE - 1); + /* + * Do not allow in-use patch to change wwid + */ + else if (strcmp(pp->wwid, mpp->wwid) != 0) { + condlog(0, "%s: path wwid appears to have changed. Using map wwid.\n", pp->dev_t); + strncpy(pp->wwid, mpp->wwid, WWID_SIZE); + } + pgp->id ^= (long)pp; pp->pgindex = i + 1;