From patchwork Mon Aug 15 17:13:45 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 9281633 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 59FC760467 for ; Mon, 15 Aug 2016 17:17:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 45F3228E04 for ; Mon, 15 Aug 2016 17:17:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3A0F028E13; Mon, 15 Aug 2016 17:17:23 +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 D8C6528E04 for ; Mon, 15 Aug 2016 17:17:22 +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 u7FHDnWN004827; Mon, 15 Aug 2016 13:13:50 -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 u7FHDniO027343 for ; Mon, 15 Aug 2016 13:13:49 -0400 Received: from rh2.redhat.com (vpn-55-138.rdu2.redhat.com [10.10.55.138]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u7FHDm0P015654; Mon, 15 Aug 2016 13:13:48 -0400 From: Mike Christie To: dm-devel@redhat.com, christophe.varoqui@opensvc.com, bart.vanassche@sandisk.com Date: Mon, 15 Aug 2016 12:13:45 -0500 Message-Id: <1471281226-7719-1-git-send-email-mchristi@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 X-loop: dm-devel@redhat.com Cc: Mike Christie Subject: [dm-devel] [PATCH 1/2] multipath-tools: check for initialized checker before 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 This fixes a regression added with: 015f87b16a7797a17afd514aec46e65c2a1a2f73 We can hit a race where when pathinfo is setting up a path, the path could have gone down already. In the DI_CHECKER chunk we then do not run get_state and attach a checker. Later when check_path is run path_offline could still return PATH_DOWN or PATH_REMOVED and get_state is again not run so we do not get to attach a checker. I was then running repair_path since the state was PATH_DOWN, and we then hit a segfault. This has us test if a checker is selected before running repair. Signed-off-by: Mike Christie --- libmultipath/checkers.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libmultipath/checkers.c b/libmultipath/checkers.c index 8976c89..fd999b0 100644 --- a/libmultipath/checkers.c +++ b/libmultipath/checkers.c @@ -213,7 +213,7 @@ void checker_put (struct checker * dst) void checker_repair (struct checker * c) { - if (!c) + if (!c || !checker_selected(c)) return; c->message[0] = '\0';