Bug 205882 - [zfs] can't import l2arc devices by guid after r292066
Summary: [zfs] can't import l2arc devices by guid after r292066
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: CURRENT
Hardware: amd64 Any
: --- Affects Some People
Assignee: Alan Somers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-01-04 16:20 UTC by Alan Somers
Modified: 2016-01-11 23:15 UTC (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alan Somers freebsd_committer freebsd_triage 2016-01-04 16:20:34 UTC
r292066 makes vdev_geom more careful about what devices it will open.  It fixed a bug with booting from ZFS when the device order has changed.  However, delphij points out that it breaks importing l2arc devices by guid, because l2arc devices' labels lack a pool guid.  The following sequence of commands will reproduce the failure:

zpool create -f withcache mirror da0 da2 cache da3
zpool export withcache
# remove da1 and da3, then reinsert da3.  It should now be called da1
zpool import withcache
# zpool status withcache
  pool: withcache
 state: ONLINE
status: One or more devices could not be opened.  Sufficient replicas exist for
	the pool to continue functioning in a degraded state.
action: Attach the missing device and online it using 'zpool online'.
   see: http://illumos.org/msg/ZFS-8000-2Q
  scan: none requested
config:

	NAME                    STATE     READ WRITE CKSUM
	withcache               ONLINE       0     0     0
	  mirror-0              ONLINE       0     0     0
	    da0                 ONLINE       0     0     0
	    da2                 ONLINE       0     0     0
	cache
	  13126929149130124089  UNAVAIL      0     0     0  was /dev/da3

errors: No known data errors
Comment 1 commit-hook freebsd_committer freebsd_triage 2016-01-11 20:00:57 UTC
A commit references this bug:

Author: asomers
Date: Mon Jan 11 20:00:22 UTC 2016
New revision: 293689
URL: https://svnweb.freebsd.org/changeset/base/293689

Log:
  Add testcase for PR205882 "can't import l2arc devices by guid"

  PR:		205882
  Sponsored by:	Spectra Logic Corp

Changes:
  projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zpool_import/Makefile
  projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zpool_import/zpool_import_missing_005_pos.ksh
  projects/zfsd/head/tests/sys/cddl/zfs/tests/cli_root/zpool_import/zpool_import_test.sh
Comment 2 Alan Somers freebsd_committer freebsd_triage 2016-01-11 23:15:50 UTC
Fixed by change 293708

Fix importing l2arc device by guid

  After r292066, vdev_geom verifies both the vdev and pool guids of device
  labels during open. However, spare and l2arc devices don't have pool guids,
  so opening them by guid will fail (opening by path, when the pathname is
  known, still succeeds). This change allows a vdev to be opened by guid if
  the label contains no pool_guid, which is the case for inactive spares and
  l2arc devices.