From patchwork Sat Apr 24 05:28:13 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: 94829 Received: from mx01.colomx.prod.int.phx2.redhat.com (mx3-phx2.redhat.com [209.132.183.24]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o3O5UpMG024482 for ; Sat, 24 Apr 2010 05:31:27 GMT Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx01.colomx.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o3O5SVAj015397; Sat, 24 Apr 2010 01:28:32 -0400 Received: from int-mx05.intmail.prod.int.phx2.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.18]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o3O5SUnq023186 for ; Sat, 24 Apr 2010 01:28:30 -0400 Received: from mx1.redhat.com (ext-mx07.extmail.prod.ext.phx2.redhat.com [10.5.110.11]) by int-mx05.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o3O5SP4X010025 for ; Sat, 24 Apr 2010 01:28:25 -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 o3O5SDIw026992 for ; Sat, 24 Apr 2010 01:28:14 -0400 Received: (qmail 1044 invoked by uid 9475); 24 Apr 2010 05:28:13 -0000 Date: 24 Apr 2010 05:28:13 -0000 Message-ID: <20100424052813.1042.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.18 X-Scanned-By: MIMEDefang 2.67 on 10.5.110.11 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 (demeter.kernel.org [140.211.167.41]); Sat, 24 Apr 2010 05:31:27 +0000 (UTC) --- multipath-tools/libmultipath/config.h 2010/04/08 19:31:49 1.18.2.10 +++ multipath-tools/libmultipath/config.h 2010/04/24 05:28:06 1.18.2.11 @@ -78,7 +78,7 @@ int flush_on_last_del; int queue_without_daemon; int checker_timeout; - int override_queueing; + int allow_queueing; uid_t uid; gid_t gid; mode_t mode; --- multipath-tools/libmultipath/configure.c 2010/04/08 19:31:49 1.2.2.7 +++ multipath-tools/libmultipath/configure.c 2010/04/24 05:28:06 1.2.2.8 @@ -13,6 +13,7 @@ #include #include #include +#include #include @@ -438,6 +439,35 @@ return 1; /* dead */ } +int +pidfile_check(const char *file) +{ + int fd; + struct flock lock; + + fd = open(file, O_RDONLY); + if (fd < 0) { + if (errno == ENOENT) + return 0; + condlog(0, "Cannot open pidfile, %s : %s", file, + strerror(errno)); + return -1; + } + lock.l_type = F_WRLCK; + lock.l_start = 0; + lock.l_whence = SEEK_SET; + lock.l_len = 0; + + if (fcntl(fd, F_GETLK, &lock) < 0) { + condlog(0, "Cannot check lock on pidfile, %s : %s", file, + strerror(errno)); + return -1; + } + if (lock.l_type == F_UNLCK) + return 0; + return 1; +} + extern int coalesce_paths (struct vectors * vecs, vector newmp, char * refwwid) { @@ -536,15 +566,17 @@ } if (r == DOMAP_DRY) continue; - - if (conf->override_queueing) +#ifndef DAEMON + if (!conf->allow_queueing && !pidfile_check(DEFAULT_PIDFILE)) dm_queue_if_no_path(mpp->alias, 0); - else if (mpp->no_path_retry != NO_PATH_RETRY_UNDEF) { - if (mpp->no_path_retry == NO_PATH_RETRY_FAIL) - dm_queue_if_no_path(mpp->alias, 0); - else - dm_queue_if_no_path(mpp->alias, 1); - } + else +#endif + if (mpp->no_path_retry != NO_PATH_RETRY_UNDEF) { + if (mpp->no_path_retry == NO_PATH_RETRY_FAIL) + dm_queue_if_no_path(mpp->alias, 0); + else + dm_queue_if_no_path(mpp->alias, 1); + } if (mpp->pg_timeout != PGTIMEOUT_UNDEF) { if (mpp->pg_timeout == -PGTIMEOUT_NONE) dm_set_pg_timeout(mpp->alias, 0); --- multipath-tools/multipath/main.c 2010/04/16 22:08:03 1.44.2.9 +++ multipath-tools/multipath/main.c 2010/04/24 05:28:06 1.44.2.10 @@ -1,7 +1,7 @@ /* * Soft: multipath device mapper target autoconfig * - * Version: $Id: main.c,v 1.44.2.9 2010/04/16 22:08:03 bmarzins Exp $ + * Version: $Id: main.c,v 1.44.2.10 2010/04/24 05:28:06 bmarzins Exp $ * * Author: Christophe Varoqui * @@ -72,7 +72,7 @@ usage (char * progname) { fprintf (stderr, VERSION_STRING); - fprintf (stderr, "Usage: %s\t[-v level] [-d] [-h|-l|-ll|-f|-F|-r]\n", + fprintf (stderr, "Usage: %s\t[-v level] [-d] [-h|-l|-ll|-f|-F|-r|-q]\n", progname); fprintf (stderr, "\t\t\t[-p failover|multibus|group_by_serial|group_by_prio]\n" \ @@ -84,7 +84,7 @@ "\t 2\t\t\tdefault verbosity\n" \ "\t 3\t\t\tprint debug information\n" \ "\t-h\t\tprint this usage text\n" \ - "\t-q\t\tforce all maps to turn off queue_if_no_path\n"\ + "\t-q\t\tallow queue_if_no_path when multipathd is nor running\n"\ "\t-b file\t\tbindings file location\n" \ "\t-d\t\tdry run, do not create or update devmaps\n" \ "\t-l\t\tshow multipath topology (sysfs and DM info)\n" \ @@ -337,7 +337,7 @@ conf->verbosity = atoi(optarg); break; case 'q': - conf->override_queueing = 1; + conf->allow_queueing = 1; break; case 'b': if (conf->bindings_file)