From patchwork Thu Apr 7 23:20:08 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Marzinski X-Patchwork-Id: 8777931 X-Patchwork-Delegate: christophe.varoqui@free.fr 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.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id EE0FD9F39A for ; Thu, 7 Apr 2016 23:23:26 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 528D020222 for ; Thu, 7 Apr 2016 23:23:25 +0000 (UTC) Received: from mx4-phx2.redhat.com (mx4-phx2.redhat.com [209.132.183.25]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5008A201ED for ; Thu, 7 Apr 2016 23:23:24 +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 u37NL1rF009365; Thu, 7 Apr 2016 19:21:01 -0400 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id u37NKbgS027991 for ; Thu, 7 Apr 2016 19:20:37 -0400 Received: from redhat.com (octiron.msp.redhat.com [10.15.80.209]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with SMTP id u37NKavQ027255; Thu, 7 Apr 2016 19:20:36 -0400 Received: by redhat.com (sSMTP sendmail emulation); Thu, 07 Apr 2016 18:20:36 -0500 From: "Benjamin Marzinski" To: device-mapper development Date: Thu, 7 Apr 2016 18:20:08 -0500 Message-Id: <1460071212-21018-15-git-send-email-bmarzins@redhat.com> In-Reply-To: <1460071212-21018-1-git-send-email-bmarzins@redhat.com> References: <1460071212-21018-1-git-send-email-bmarzins@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-loop: dm-devel@redhat.com Cc: Christophe Varoqui Subject: [dm-devel] [PATCH v2 14/18] multipathd: print "fail" when remove fails 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-Spam-Status: No, score=-7.9 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 When multipathd fails to remove a path or a map, it was printing "ok" instead of "fail", and exitting with a 0 return code. Now it prints "fail" and exits with a 1, like it does when other commands fail. Signed-off-by: Benjamin Marzinski --- multipathd/cli_handlers.c | 8 ++++---- multipathd/main.c | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/multipathd/cli_handlers.c b/multipathd/cli_handlers.c index 21fe00e..168b872 100644 --- a/multipathd/cli_handlers.c +++ b/multipathd/cli_handlers.c @@ -511,7 +511,7 @@ cli_del_path (void * v, char ** reply, int * len, void * data) pp = find_path_by_dev(vecs->pathvec, param); if (!pp) { condlog(0, "%s: path already removed", param); - return 0; + return 1; } return ev_remove_path(pp, vecs); } @@ -585,19 +585,19 @@ cli_del_map (void * v, char ** reply, int * len, void * data) minor = dm_get_minor(param); if (minor < 0) { condlog(2, "%s: not a device mapper table", param); - return 0; + return 1; } major = dm_get_major(param); if (major < 0) { condlog(2, "%s: not a device mapper table", param); - return 0; + return 1; } sprintf(dev_path,"dm-%d", minor); alias = dm_mapname(major, minor); if (!alias) { condlog(2, "%s: mapname not found for %d:%d", param, major, minor); - return 0; + return 1; } rc = ev_remove_map(param, alias, minor, vecs); FREE(alias); diff --git a/multipathd/main.c b/multipathd/main.c index f1fdd21..bbcfe0d 100644 --- a/multipathd/main.c +++ b/multipathd/main.c @@ -448,12 +448,12 @@ ev_remove_map (char * devname, char * alias, int minor, struct vectors * vecs) if (!mpp) { condlog(2, "%s: devmap not registered, can't remove", devname); - return 0; + return 1; } if (strcmp(mpp->alias, alias)) { condlog(2, "%s: minor number mismatch (map %d, event %d)", mpp->alias, mpp->dmi->minor, minor); - return 0; + return 1; } return flush_map(mpp, vecs, 0); }