[Glibc-bsd-commits] r3180 - trunk/zfsutils/debian/patches

Aurelien Jarno aurel32 at alioth.debian.org
Wed Sep 1 23:38:39 UTC 2010


Author: aurel32
Date: 2010-09-01 23:38:39 +0000 (Wed, 01 Sep 2010)
New Revision: 3180

Added:
   trunk/zfsutils/debian/patches/10_zpool_import.diff
Removed:
   trunk/zfsutils/debian/patches/10_dev_dsk.diff
Modified:
   trunk/zfsutils/debian/patches/series
Log:
Replace 10_dev_dsk.diff by 10_zpool_import.diff which fixes the zpool import issue, as well as other (upstream) bugs with the -d argument (see pr misc/150207)


Deleted: trunk/zfsutils/debian/patches/10_dev_dsk.diff
===================================================================
--- trunk/zfsutils/debian/patches/10_dev_dsk.diff	2010-09-01 19:03:00 UTC (rev 3179)
+++ trunk/zfsutils/debian/patches/10_dev_dsk.diff	2010-09-01 23:38:39 UTC (rev 3180)
@@ -1,40 +0,0 @@
---- a/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c
-+++ b/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c
-@@ -1468,7 +1468,11 @@
- 
- 	if (searchdirs == NULL) {
- 		searchdirs = safe_malloc(sizeof (char *));
-+#ifdef __sun
- 		searchdirs[0] = "/dev/dsk";
-+#else
-+		searchdirs[0] = "/dev";
-+#endif
- 		nsearch = 1;
- 	}
- 
---- a/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c
-+++ b/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c
-@@ -848,7 +848,11 @@
- 	size_t pathleft;
- 	struct stat64 statbuf;
- 	nvlist_t *ret = NULL, *config;
-+#ifdef __sun
- 	static char *default_dir = "/dev/dsk";
-+#else
-+	static char *default_dir = "/dev";
-+#endif
- 	int fd;
- 	pool_list_t pools = { 0 };
- 	pool_entry_t *pe, *penext;
-@@ -894,9 +898,11 @@
- 		 * reading the labels skips a bunch of slow operations during
- 		 * close(2) processing, so we replace /dev/dsk with /dev/rdsk.
- 		 */
-+#ifdef __sun
- 		if (strcmp(path, "/dev/dsk/") == 0)
- 			rdsk = "/dev/rdsk/";
- 		else
-+#endif
- 			rdsk = path;
- 
- 		if ((dirp = opendir(rdsk)) == NULL) {

Added: trunk/zfsutils/debian/patches/10_zpool_import.diff
===================================================================
--- trunk/zfsutils/debian/patches/10_zpool_import.diff	                        (rev 0)
+++ trunk/zfsutils/debian/patches/10_zpool_import.diff	2010-09-01 23:38:39 UTC (rev 3180)
@@ -0,0 +1,68 @@
+--- a/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c
++++ b/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c
+@@ -845,7 +845,5 @@
+ 	struct dirent64 *dp;
+ 	char path[MAXPATHLEN];
+-	char *end;
+-	size_t pathleft;
+ 	struct stat64 statbuf;
+ 	nvlist_t *ret = NULL, *config;
+ 	static char *default_dir = "/dev/dsk";
+@@ -872,6 +871,11 @@
+ 		char *rdsk;
+ 		int dfd;
+ 
++		if (strcmp(argv[i], default_dir) == 0) {
++			geom_find_import(hdl, &pools);
++			continue;
++		}
++
+ 		/* use realpath to normalize the path */
+ 		if (realpath(argv[i], path) == 0) {
+ 			(void) zfs_error_fmt(hdl, EZFS_BADPATH,
+@@ -879,15 +883,6 @@
+ 			    argv[i]);
+ 			goto error;
+ 		}
+-		end = &path[strlen(path)];
+-		*end++ = '/';
+-		*end = 0;
+-		pathleft = &path[sizeof (path)] - end;
+-
+-		if (strcmp(argv[i], default_dir) == 0) {
+-			geom_find_import(hdl, &pools);
+-			continue;
+-		}
+ 
+ 		/*
+ 		 * Using raw devices instead of block devices when we're
+@@ -911,15 +906,16 @@
+ 		 * This is not MT-safe, but we have no MT consumers of libzfs
+ 		 */
+ 		while ((dp = readdir64(dirp)) != NULL) {
++	                char devpath[MAXPATHLEN];
+ 			const char *name = dp->d_name;
+ 			if (name[0] == '.' &&
+ 			    (name[1] == 0 || (name[1] == '.' && name[2] == 0)))
+ 				continue;
+ 
+-			(void) snprintf(path, sizeof (path), "%s/%s", rdsk,
+-			    dp->d_name);
++			(void) snprintf(devpath, sizeof (devpath), "%s/%s",
++			    rdsk, dp->d_name);
+ 
+-			if ((fd = open64(path, O_RDONLY)) < 0)
++			if ((fd = open64(devpath, O_RDONLY)) < 0)
+ 				continue;
+ 
+ 			/*
+@@ -966,8 +962,7 @@
+ 					continue;
+ 				}
+ 				/* use the non-raw path for the config */
+-				(void) strlcpy(end, name, pathleft);
+-				if (add_config(hdl, &pools, path, config) != 0)
++				if (add_config(hdl, &pools, devpath, config) != 0)
+ 					goto error;
+ 			}
+ 		}

Modified: trunk/zfsutils/debian/patches/series
===================================================================
--- trunk/zfsutils/debian/patches/series	2010-09-01 19:03:00 UTC (rev 3179)
+++ trunk/zfsutils/debian/patches/series	2010-09-01 23:38:39 UTC (rev 3180)
@@ -7,6 +7,6 @@
 07_manpages.diff
 08_libbsd.diff
 09_xdr_control.diff
-10_dev_dsk.diff
+10_zpool_import.diff
 11_endian.diff
 12_freebsd.diff




More information about the Glibc-bsd-commits mailing list