42
42
* using our derived config, and record the results.
43
43
*/
44
44
45
+ #include <sys/types.h>
46
+ #include <sys/disk.h>
47
+ #include <sys/ioctl.h>
48
+ #include <sys/stat.h>
49
+ #include <sys/sysctl.h>
50
+
45
51
#include <aio.h>
46
52
#include <ctype.h>
47
53
#include <dirent.h>
51
57
#include <stddef.h>
52
58
#include <stdlib.h>
53
59
#include <string.h>
54
- #include <sys/disk.h>
55
- #include <sys/ioctl.h>
56
- #include <sys/stat.h>
57
60
#include <unistd.h>
58
61
#include <fcntl.h>
59
62
@@ -181,15 +184,17 @@ int
181
184
zpool_find_import_blkid (libpc_handle_t * hdl , pthread_mutex_t * lock ,
182
185
avl_tree_t * * slice_cache )
183
186
{
187
+ const char * oid = "vfs.zfs.vol.recursive" ;
184
188
char * end , path [MAXPATHLEN ];
185
189
rdsk_node_t * slice ;
186
190
struct gmesh mesh ;
187
191
struct gclass * mp ;
188
192
struct ggeom * gp ;
189
193
struct gprovider * pp ;
190
194
avl_index_t where ;
191
- size_t pathleft ;
192
- int error ;
195
+ int error , value ;
196
+ size_t pathleft , size = sizeof (value );
197
+ boolean_t skip_zvols = B_FALSE ;
193
198
194
199
end = stpcpy (path , "/dev/" );
195
200
pathleft = & path [sizeof (path )] - end ;
@@ -198,11 +203,16 @@ zpool_find_import_blkid(libpc_handle_t *hdl, pthread_mutex_t *lock,
198
203
if (error != 0 )
199
204
return (error );
200
205
206
+ if (sysctlbyname (oid , & value , & size , NULL , 0 ) == 0 && value == 0 )
207
+ skip_zvols = B_TRUE ;
208
+
201
209
* slice_cache = zutil_alloc (hdl , sizeof (avl_tree_t ));
202
210
avl_create (* slice_cache , slice_cache_compare , sizeof (rdsk_node_t ),
203
211
offsetof(rdsk_node_t , rn_node ));
204
212
205
213
LIST_FOREACH (mp , & mesh .lg_class , lg_class ) {
214
+ if (skip_zvols && strcmp (mp -> lg_name , "ZFS::ZVOL" ) == 0 )
215
+ continue ;
206
216
LIST_FOREACH (gp , & mp -> lg_geom , lg_geom ) {
207
217
LIST_FOREACH (pp , & gp -> lg_provider , lg_provider ) {
208
218
strlcpy (end , pp -> lg_name , pathleft );
0 commit comments