From patchwork Mon Mar 16 12:36:33 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hannes Reinecke X-Patchwork-Id: 6017861 X-Patchwork-Delegate: christophe.varoqui@free.fr Return-Path: X-Original-To: patchwork-dm-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 9200BBF90F for ; Mon, 16 Mar 2015 12:41:20 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id AACED204D1 for ; Mon, 16 Mar 2015 12:41:19 +0000 (UTC) Received: from mx3-phx2.redhat.com (mx3-phx2.redhat.com [209.132.183.24]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 82884200F4 for ; Mon, 16 Mar 2015 12:41:17 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx3-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id t2GCcIGO027964; Mon, 16 Mar 2015 08:38:19 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id t2GCbHgw028851 for ; Mon, 16 Mar 2015 08:37:17 -0400 Received: from mx1.redhat.com (ext-mx15.extmail.prod.ext.phx2.redhat.com [10.5.110.20]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t2GCbHq5020304; Mon, 16 Mar 2015 08:37:17 -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 t2GCbFZe011634 (version=TLSv1/SSLv3 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=FAIL); Mon, 16 Mar 2015 08:37:16 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id E5A1EADE6; Mon, 16 Mar 2015 12:37:09 +0000 (UTC) From: Hannes Reinecke To: Christophe Varoqui Date: Mon, 16 Mar 2015 13:36:33 +0100 Message-Id: <1426509425-15978-47-git-send-email-hare@suse.de> In-Reply-To: <1426509425-15978-1-git-send-email-hare@suse.de> References: <1426509425-15978-1-git-send-email-hare@suse.de> X-RedHat-Spam-Score: -7.309 (BAYES_00, DCC_REPUT_00_12, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, URIBL_BLOCKED) 195.135.220.15 cantor2.suse.de 195.135.220.15 cantor2.suse.de X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-Scanned-By: MIMEDefang 2.68 on 10.5.110.20 X-loop: dm-devel@redhat.com Cc: dm-devel@redhat.com Subject: [dm-devel] [PATCH 46/78] Implement 'uxsock_timeout' keyword 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=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_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 On larger systems the default CLI receive timeout of 1 second might be too small, and the CLI commands might fail before they can be processed. For these cases I've implemented a new keywork 'uxsock_timeout' which can be increased to avoid these issues. Signed-off-by: Hannes Reinecke --- libmultipath/config.c | 1 + libmultipath/config.h | 1 + libmultipath/configure.c | 2 +- libmultipath/dict.c | 30 ++++++++++++++++++++++++++++++ multipath/multipath.conf.5 | 9 +++++++++ multipathd/main.c | 8 ++++++-- 6 files changed, 48 insertions(+), 3 deletions(-) diff --git a/libmultipath/config.c b/libmultipath/config.c index 1007f32..c788cf6 100644 --- a/libmultipath/config.c +++ b/libmultipath/config.c @@ -617,6 +617,7 @@ load_config (char * file, struct udev *udev) conf->partition_delim = NULL; conf->processed_main_config = 0; conf->find_multipaths = DEFAULT_FIND_MULTIPATHS; + conf->uxsock_timeout = DEFAULT_UXSOCK_TIMEOUT; conf->uid_attribute = set_default(DEFAULT_UID_ATTRIBUTE); /* diff --git a/libmultipath/config.h b/libmultipath/config.h index eff127e..0149ad3 100644 --- a/libmultipath/config.h +++ b/libmultipath/config.h @@ -135,6 +135,7 @@ struct config { int processed_main_config; int delay_watch_checks; int delay_wait_checks; + int uxsock_timeout; unsigned int version[3]; char * dev; diff --git a/libmultipath/configure.c b/libmultipath/configure.c index 720d074..2c10c22 100644 --- a/libmultipath/configure.c +++ b/libmultipath/configure.c @@ -714,7 +714,7 @@ int check_daemon(void) if (send_packet(fd, "show daemon", 12) != 0) goto out; - if (recv_packet(fd, &reply, &len, DEFAULT_UXSOCK_TIMEOUT) != 0) + if (recv_packet(fd, &reply, &len, conf->uxsock_timeout) != 0) goto out; if (strstr(reply, "shutdown")) diff --git a/libmultipath/dict.c b/libmultipath/dict.c index 35a1cf2..5c2da43 100644 --- a/libmultipath/dict.c +++ b/libmultipath/dict.c @@ -1034,6 +1034,26 @@ declare_hw_snprint(delay_wait_checks, print_delay_checks) declare_mp_handler(delay_wait_checks, set_delay_checks) declare_mp_snprint(delay_wait_checks, print_delay_checks) +static int +def_uxsock_timeout_handler(vector strvec) +{ + unsigned int uxsock_timeout; + char *buff; + + buff = set_value(strvec); + if (!buff) + return 1; + + if (sscanf(buff, "%u", &uxsock_timeout) == 1 && + uxsock_timeout > DEFAULT_UXSOCK_TIMEOUT) + conf->uxsock_timeout = uxsock_timeout; + else + conf->uxsock_timeout = DEFAULT_UXSOCK_TIMEOUT; + + free(buff); + return 0; +} + /* * blacklist block handlers */ @@ -1115,6 +1135,15 @@ declare_ble_handler(blist_property) declare_ble_handler(elist_property) static int +snprint_def_uxsock_timeout(char * buff, int len, void * data) +{ + if (conf->uxsock_timeout == DEFAULT_UXSOCK_TIMEOUT) + return 0; + + return snprintf(buff, len, "%u", conf->uxsock_timeout); +} + +static int snprint_ble_simple (char * buff, int len, void * data) { struct blentry * ble = (struct blentry *)data; @@ -1335,6 +1364,7 @@ init_keywords(void) install_keyword("delay_watch_checks", &def_delay_watch_checks_handler, &snprint_def_delay_watch_checks); install_keyword("delay_wait_checks", &def_delay_wait_checks_handler, &snprint_def_delay_wait_checks); install_keyword("find_multipaths", &def_find_multipaths_handler, &snprint_def_find_multipaths); + install_keyword("uxsock_timeout", &def_uxsock_timeout_handler, &snprint_def_uxsock_timeout); __deprecated install_keyword("default_selector", &def_selector_handler, NULL); __deprecated install_keyword("default_path_grouping_policy", &def_pgpolicy_handler, NULL); __deprecated install_keyword("default_uid_attribute", &def_uid_attribute_handler, NULL); diff --git a/multipath/multipath.conf.5 b/multipath/multipath.conf.5 index d60dc2e..7e17f62 100644 --- a/multipath/multipath.conf.5 +++ b/multipath/multipath.conf.5 @@ -480,6 +480,15 @@ used until it has passed .I delay_wait_checks checks. Default is .I no +.TP +.B uxsock_timeout +CLI receive timeout in milliseconds. For larger systems CLI commands +might timeout before the multipathd lock is released and the CLI command +can be processed. This will result in errors like +'timeout receiving packet' to be returned from CLI commands. +In these cases it is recommended to increase the CLI timeout to avoid +those issues. The default is +.I 1000 . .SH "blacklist section" The diff --git a/multipathd/main.c b/multipathd/main.c index 9db2e55..e197d59 100644 --- a/multipathd/main.c +++ b/multipathd/main.c @@ -2023,7 +2023,9 @@ main (int argc, char *argv[]) logsink = -1; break; case 'k': - uxclnt(optarg, DEFAULT_UXSOCK_TIMEOUT); + if (load_config(DEFAULT_CONFIGFILE, udev_new())) + exit(1); + uxclnt(optarg, conf->uxsock_timeout); exit(0); case 'B': conf->bindings_read_only = 1; @@ -2037,6 +2039,8 @@ main (int argc, char *argv[]) char * s = cmd; char * c = s; + if (load_config(DEFAULT_CONFIGFILE, udev_new())) + exit(1); while (optind < argc) { if (strchr(argv[optind], ' ')) c += snprintf(c, s + CMDSIZE - c, "\"%s\" ", argv[optind]); @@ -2045,7 +2049,7 @@ main (int argc, char *argv[]) optind++; } c += snprintf(c, s + CMDSIZE - c, "\n"); - uxclnt(s, DEFAULT_UXSOCK_TIMEOUT); + uxclnt(s, conf->uxsock_timeout); exit(0); }