From patchwork Wed Sep 8 21:40:30 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: bmarzins@sourceware.org X-Patchwork-Id: 164591 Received: from mx02.colomx.prod.int.phx2.redhat.com (mx4-phx2.redhat.com [209.132.183.25]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id o88LhKMN001344 for ; Wed, 8 Sep 2010 21:43:55 GMT Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx02.colomx.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o88LelBP009054; Wed, 8 Sep 2010 17:40:48 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o88LejoM022245 for ; Wed, 8 Sep 2010 17:40:45 -0400 Received: from mx1.redhat.com (ext-mx09.extmail.prod.ext.phx2.redhat.com [10.5.110.13]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o88LeePf011886 for ; Wed, 8 Sep 2010 17:40:40 -0400 Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by mx1.redhat.com (8.13.8/8.13.8) with SMTP id o88LeVL5016653 for ; Wed, 8 Sep 2010 17:40:31 -0400 Received: (qmail 2516 invoked by uid 9475); 8 Sep 2010 21:40:30 -0000 Date: 8 Sep 2010 21:40:30 -0000 Message-ID: <20100908214030.2514.qmail@sourceware.org> From: bmarzins@sourceware.org To: dm-cvs@sourceware.org, dm-devel@redhat.com X-RedHat-Spam-Score: -2.31 (RCVD_IN_DNSWL_MED,T_RP_MATCHES_RCVD) X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-Scanned-By: MIMEDefang 2.67 on 10.5.110.13 X-loop: dm-devel@redhat.com Subject: [dm-devel] multipath-tools libmultipath/config.h libmulti ... 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-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Wed, 08 Sep 2010 21:43:56 +0000 (UTC) --- multipath-tools/libmultipath/config.h 2010/09/03 20:59:14 1.18.2.12 +++ multipath-tools/libmultipath/config.h 2010/09/08 21:40:29 1.18.2.13 @@ -80,6 +80,7 @@ int checker_timeout; int allow_queueing; int pg_prio_calc; + int log_checker_err; uid_t uid; gid_t gid; mode_t mode; --- multipath-tools/libmultipath/dict.c 2010/09/03 20:59:14 1.17.2.14 +++ multipath-tools/libmultipath/dict.c 2010/09/08 21:40:30 1.17.2.15 @@ -435,7 +435,24 @@ return 0; } +static int +def_log_checker_err_handler(vector strvec) +{ + char * buff; + + buff = set_value(strvec); + + if (!buff) + return 1; + if (strlen(buff) == 4 && !strcmp(buff, "once")) + conf->log_checker_err = LOG_CHKR_ERR_ONCE; + else if (strlen(buff) == 6 && !strcmp(buff, "always")) + conf->log_checker_err = LOG_CHKR_ERR_ALWAYS; + + free(buff); + return 0; +} static int bindings_file_handler(vector strvec) { @@ -2004,6 +2021,14 @@ } static int +snprint_def_log_checker_err (char *buff, int len, void *data) +{ + if (conf->log_checker_err == LOG_CHKR_ERR_ONCE) + return snprintf(buff, len, "once"); + return snprintf(buff, len, "always"); +} + +static int snprint_def_bindings_file (char * buff, int len, void * data) { if (conf->bindings_file == NULL) @@ -2066,6 +2091,7 @@ install_keyword("pg_timeout", &def_pg_timeout_handler, &snprint_def_pg_timeout); install_keyword("user_friendly_names", &names_handler, &snprint_def_user_friendly_names); install_keyword("pg_prio_calc", &def_pg_prio_calc_handler, &snprint_def_pg_prio_calc); + install_keyword("log_checker_err", &def_log_checker_err_handler, &snprint_def_log_checker_err); install_keyword("bindings_file", &bindings_file_handler, &snprint_def_bindings_file); install_keyword("mode", &def_mode_handler, &snprint_def_mode); install_keyword("uid", &def_uid_handler, &snprint_def_uid); --- multipath-tools/libmultipath/structs.h 2010/09/03 20:59:14 1.18.2.7 +++ multipath-tools/libmultipath/structs.h 2010/09/08 21:40:30 1.18.2.8 @@ -89,6 +89,11 @@ PG_PRIO_CALC_AVG, }; +enum log_checker_err_states { + LOG_CHKR_ERR_ALWAYS, + LOG_CHKR_ERR_ONCE, +}; + struct scsi_idlun { int dev_id; int host_unique_id; --- multipath-tools/multipathd/main.c 2010/09/01 18:29:18 1.69.2.29 +++ multipath-tools/multipathd/main.c 2010/09/08 21:40:30 1.69.2.30 @@ -74,7 +74,10 @@ #define CALLOUT_DIR "/var/cache/multipathd" #define LOG_MSG(a,b) \ - if (strlen(b)) condlog(a, "%s: %s", pp->dev, b); +do { \ + if (strlen(b)) \ + condlog(a, "%s: %s", pp->dev, b); \ +} while(0) pthread_cond_t exit_cond = PTHREAD_COND_INITIALIZER; pthread_mutex_t exit_mutex = PTHREAD_MUTEX_INITIALIZER; @@ -1111,8 +1114,12 @@ condlog(4, "%s: delay next check %is", pp->dev_t, pp->tick); } - else if (newstate == PATH_DOWN) - LOG_MSG(2, checker_message(&pp->checker)); + else if (newstate == PATH_DOWN) { + if (conf->log_checker_err == LOG_CHKR_ERR_ONCE) + LOG_MSG(3, checker_message(&pp->checker)); + else + LOG_MSG(2, checker_message(&pp->checker)); + } pp->state = newstate;