From patchwork Mon Sep 20 23:21:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Marzinski X-Patchwork-Id: 12506583 X-Patchwork-Delegate: christophe.varoqui@free.fr Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 61928C433EF for ; Mon, 20 Sep 2021 23:21:58 +0000 (UTC) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0ED0D61211 for ; Mon, 20 Sep 2021 23:21:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 0ED0D61211 Authentication-Results: mail.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1632180117; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=g3mxnOc9Pa3C+0E3uQxQa0ZTCltT8nbn9uIujuSEWss=; b=Jv0vmMpCsEoZkZssZMAyU2Mzgw+zhpr3cbnEY4wx204VJU4AVnadyB2+g+fRZoEvBnBrOZ qsangtLPrLAQMCIITvQh70Lav9QS8hyTI1R8+FlRE5+EdME9kHEujsXxNX1qHFpyhQorBI 4pAq+ghh0iUgctiY0SmnifnJlOY+U+w= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-496-KWhZIJfGPUunLfNIqxrR-A-1; Mon, 20 Sep 2021 19:21:55 -0400 X-MC-Unique: KWhZIJfGPUunLfNIqxrR-A-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 3B74F1006AA6; Mon, 20 Sep 2021 23:21:50 +0000 (UTC) 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 1D1B97621C; Mon, 20 Sep 2021 23:21:50 +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 DB86B1806D03; Mon, 20 Sep 2021 23:21:49 +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 18KNLTd7025921 for ; Mon, 20 Sep 2021 19:21:29 -0400 Received: by smtp.corp.redhat.com (Postfix) id 5CDF217B5B; Mon, 20 Sep 2021 23:21:29 +0000 (UTC) Received: from octiron.msp.redhat.com (unknown [10.15.80.209]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D64C85DF26; Mon, 20 Sep 2021 23:21:22 +0000 (UTC) Received: from octiron.msp.redhat.com (localhost.localdomain [127.0.0.1]) by octiron.msp.redhat.com (8.14.9/8.14.9) with ESMTP id 18KNLLAW009348; Mon, 20 Sep 2021 18:21:21 -0500 Received: (from bmarzins@localhost) by octiron.msp.redhat.com (8.14.9/8.14.9/Submit) id 18KNLLMI009347; Mon, 20 Sep 2021 18:21:21 -0500 From: Benjamin Marzinski To: Christophe Varoqui Date: Mon, 20 Sep 2021 18:21:16 -0500 Message-Id: <1632180076-9294-5-git-send-email-bmarzins@redhat.com> In-Reply-To: <1632180076-9294-1-git-send-email-bmarzins@redhat.com> References: <1632180076-9294-1-git-send-email-bmarzins@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: dm-devel@redhat.com Cc: device-mapper development , Martin Wilck Subject: [dm-devel] [PATCH 4/4] multipathd: add "reconfigure all" command. 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.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=dm-devel-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com With this commit, multipathd no longer defaults to full reconfigures for the "reconfigure" command and the HUP signal. The default is a weak reconfigure. A new command, "reconfigure all", has been added to do a full reconfigure. Signed-off-by: Benjamin Marzinski Reviewed-by: Martin Wilck --- multipath/main.c | 2 +- multipathd/cli.c | 1 + multipathd/cli.h | 2 ++ multipathd/cli_handlers.c | 10 ++++++++++ multipathd/main.c | 2 +- 5 files changed, 15 insertions(+), 2 deletions(-) diff --git a/multipath/main.c b/multipath/main.c index 65ece830..7b9797ec 100644 --- a/multipath/main.c +++ b/multipath/main.c @@ -759,7 +759,7 @@ int delegate_to_multipathd(enum mpath_cmds cmd, return NOT_DELEGATED; if (cmd == CMD_CREATE && conf->force_reload == FORCE_RELOAD_YES) { - p += snprintf(p, n, "reconfigure"); + p += snprintf(p, n, "reconfigure all"); } else if (cmd == CMD_FLUSH_ONE && dev && dev_type == DEV_DEVMAP) { p += snprintf(p, n, "del map %s", dev); diff --git a/multipathd/cli.c b/multipathd/cli.c index 414f6608..d9308bdf 100644 --- a/multipathd/cli.c +++ b/multipathd/cli.c @@ -212,6 +212,7 @@ load_keys (void) r += add_key(keys, "local", LOCAL, 0); r += add_key(keys, "setmarginal", SETMARGINAL, 0); r += add_key(keys, "unsetmarginal", UNSETMARGINAL, 0); + r += add_key(keys, "all", ALL, 0); if (r) { diff --git a/multipathd/cli.h b/multipathd/cli.h index fcb6af00..bba705e8 100644 --- a/multipathd/cli.h +++ b/multipathd/cli.h @@ -47,6 +47,7 @@ enum { __LOCAL, /* 40 */ __SETMARGINAL, __UNSETMARGINAL, + __ALL, }; #define LIST (1ULL << __LIST) @@ -93,6 +94,7 @@ enum { #define LOCAL (1ULL << __LOCAL) #define SETMARGINAL (1ULL << __SETMARGINAL) #define UNSETMARGINAL (1ULL << __UNSETMARGINAL) +#define ALL (1ULL << __ALL) #define INITIAL_REPLY_LEN 1200 diff --git a/multipathd/cli_handlers.c b/multipathd/cli_handlers.c index b12a4e7e..58b9916c 100644 --- a/multipathd/cli_handlers.c +++ b/multipathd/cli_handlers.c @@ -1012,6 +1012,15 @@ cli_reconfigure(void * v, struct strbuf *reply, void * data) { condlog(2, "reconfigure (operator)"); + schedule_reconfigure(false); + return 0; +} + +int +cli_reconfigure_all(void * v, struct strbuf *reply, void * data) +{ + condlog(2, "reconfigure all (operator)"); + schedule_reconfigure(true); return 0; } @@ -1497,6 +1506,7 @@ void init_handler_callbacks(void) set_handler_callback(DEL+MAPS, cli_del_maps); set_handler_callback(SWITCH+MAP+GROUP, cli_switch_group); set_unlocked_handler_callback(RECONFIGURE, cli_reconfigure); + set_unlocked_handler_callback(RECONFIGURE+ALL, cli_reconfigure_all); set_handler_callback(SUSPEND+MAP, cli_suspend); set_handler_callback(RESUME+MAP, cli_resume); set_handler_callback(RESIZE+MAP, cli_resize); diff --git a/multipathd/main.c b/multipathd/main.c index 5c831e8d..cc4a4a5d 100644 --- a/multipathd/main.c +++ b/multipathd/main.c @@ -2817,7 +2817,7 @@ handle_signals(bool nonfatal) return; if (reconfig_sig) { condlog(2, "reconfigure (signal)"); - schedule_reconfigure(true); + schedule_reconfigure(false); } if (log_reset_sig) { condlog(2, "reset log (signal)");