freebsd-dev/sys/cddl
Pawel Jakub Dawidek 58804a192e The same code is used to import and to create pool.
The order of operations is the following:
1. Try to open vdev by remembered path and guid.
2. If 1 failed, try to find vdev which guid matches and ignore the path.
3. If 2 failed this means either that the vdev we're looking for is gone
   or that pool is being created and vdev doesn't contain proper guid yet.
   To be able to handle pool creation we open vdev by path anyway.

Because of 3 it is possible that we open wrong vdev on import which can lead to
confusions.

The solution for this is to check spa_load_state. On pool creation it will be
equal to SPA_LOAD_NONE and we can open vdev only by path immediately and if it
is not equal to SPA_LOAD_NONE we first open by path+guid and when that fails,
we open by guid. We no longer open wrong vdev on import.

MFC after:	2 weeks
2010-03-19 20:14:27 +00:00
..
boot/zfs Instead of assuming all vdevs are healthy, check the newest vdev label 2010-01-06 23:09:23 +00:00
compat/opensolaris On FreeBSD, time_t is 64-bit for all platforms except i386 and powerpc, 2010-01-25 07:52:54 +00:00
contrib/opensolaris The same code is used to import and to create pool. 2010-03-19 20:14:27 +00:00
dev dtrace_gethrtime: improve scaling of TSC ticks to nanoseconds 2009-07-15 17:07:39 +00:00