From patchwork Wed Jun 23 16:28:10 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: 107667 Received: from mx02.colomx.prod.int.phx2.redhat.com (mx4-phx2.redhat.com [209.132.183.25]) by demeter.kernel.org (8.14.4/8.14.3) with ESMTP id o5NGvS1J023705 for ; Wed, 23 Jun 2010 16:58:03 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 o5NGt72C027004; Wed, 23 Jun 2010 12:55:08 -0400 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o5NGt6gV004454 for ; Wed, 23 Jun 2010 12:55:06 -0400 Received: from mx1.redhat.com (ext-mx02.extmail.prod.ext.phx2.redhat.com [10.5.110.6]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o5NGt1Kr019316 for ; Wed, 23 Jun 2010 12:55:01 -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 o5NGsp4D001964 for ; Wed, 23 Jun 2010 12:54:51 -0400 Received: (qmail 7503 invoked by uid 9475); 23 Jun 2010 16:28:10 -0000 Date: 23 Jun 2010 16:28:10 -0000 Message-ID: <20100623162810.7501.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.12 X-Scanned-By: MIMEDefang 2.67 on 10.5.110.6 X-loop: dm-devel@redhat.com Subject: [dm-devel] multipath-tools libmultipath/configure.c libmu ... 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]); Wed, 23 Jun 2010 16:58:04 +0000 (UTC) --- multipath-tools/libmultipath/configure.c 2010/04/24 05:28:06 1.2.2.8 +++ multipath-tools/libmultipath/configure.c 2010/06/23 16:28:07 1.2.2.9 @@ -177,8 +177,8 @@ return; } if (cmpp->size != mpp->size) { - mpp->action = ACT_RELOAD; - condlog(3, "%s: set ACT_RELOAD (size change)", + mpp->action = ACT_RESIZE; + condlog(3, "%s: set ACT_RESIZE (size change)", mpp->alias); return; } @@ -463,6 +463,7 @@ strerror(errno)); return -1; } + close(fd); if (lock.l_type == F_UNLCK) return 0; return 1; --- multipath-tools/libmultipath/discovery.c 2010/01/27 22:33:29 1.32.2.13 +++ multipath-tools/libmultipath/discovery.c 2010/06/23 16:28:07 1.32.2.14 @@ -162,6 +162,19 @@ return r; } +int +check_sysfs_dir(char *sysfs_path, char * dev) +{ + char dev_dir[SYSFS_PATH_SIZE]; + struct stat stats; + + if (sysfs_path && safe_sprintf(dev_dir, "%s/block/%s", sysfs_path, dev)) + return 1; + if (stat(dev_dir, &stats) != 0) + return 1; + return 0; +} + /* * the daemon can race udev upon path add, * not multipath(8), ran by udev @@ -171,11 +184,11 @@ #define WAIT_LOOP_PER_SECOND 5 static int -wait_for_file (char * filename) +wait_for_file (char * filename, char * sysfs_path, char * dev) { int loop; struct stat stats; - + loop = WAIT_MAX_SECONDS * WAIT_LOOP_PER_SECOND; while (--loop) { @@ -185,13 +198,16 @@ if (errno != ENOENT) return 1; + if (sysfs_path && check_sysfs_dir(sysfs_path, dev) != 0) + return 1; + usleep(1000 * 1000 / WAIT_LOOP_PER_SECOND); } return 1; } #else static int -wait_for_file (char * filename) +wait_for_file (char * filename, char * sysfs_path, char * dev) { return 0; } @@ -207,7 +223,7 @@ if (safe_sprintf(attr_path, fmt, sysfs_path, dev)) \ return 1; \ \ - if (dowait && wait_for_file(attr_path)) \ + if (dowait && wait_for_file(attr_path, sysfs_path, dev)) \ return 1; \ \ if (!(attr = sysfs_open_attribute(attr_path))) \ @@ -320,7 +336,7 @@ return -1; } - if (wait_for_file(devpath)) { + if (wait_for_file(devpath, NULL, NULL)) { condlog(3, "failed to open %s", devpath); return -1; } @@ -857,6 +873,8 @@ get_prio(pp); #ifndef DAEMON + if (checker_selected(&pp->checker)) + checker_put(&pp->checker); close(pp->fd); pp->fd = -1; #endif --- multipath-tools/libmultipath/discovery.h 2010/01/27 16:46:48 1.14.2.3 +++ multipath-tools/libmultipath/discovery.h 2010/06/23 16:28:07 1.14.2.4 @@ -24,6 +24,7 @@ #define SCSI_COMMAND_TERMINATED 0x22 #define SG_ERR_DRIVER_SENSE 0x08 +int check_sysfs_dir(char *sysfs_path, char * dev); int device_ok_to_add(char *devname); int sysfs_get_vendor (char * sysfs_path, char * dev, char * buff, int len); int sysfs_get_model (char * sysfs_path, char * dev, char * buff, int len); --- multipath-tools/libmultipath/structs_vec.c 2009/03/26 03:28:09 1.1.2.4 +++ multipath-tools/libmultipath/structs_vec.c 2010/06/23 16:28:07 1.1.2.5 @@ -378,8 +378,7 @@ * see if path is in sysfs */ if (!(*pp->dev) || - sysfs_get_dev(sysfs_path, pp->dev, pp->dev_t, - BLK_DEV_SIZE)) { + check_sysfs_dir(sysfs_path, pp->dev)) { if (!(*pp->dev)) condlog(3, "%s: removing path %s with no devname", --- multipath-tools/multipathd/main.c 2010/01/27 17:21:48 1.69.2.26 +++ multipath-tools/multipathd/main.c 2010/06/23 16:28:08 1.69.2.27 @@ -411,8 +411,8 @@ if (adopt_paths(vecs->pathvec, mpp)) return 1; /* leave path added to pathvec */ - verify_paths(mpp, vecs, NULL); mpp->hwe = pp->hwe; + verify_paths(mpp, vecs, NULL); mpp->flush_on_last_del = FLUSH_UNDEF; mpp->action = ACT_RELOAD; }