svn commit: r259480 - head/usr.sbin/bsdinstall/scripts

Devin Teske dteske at FreeBSD.org
Mon Dec 16 19:51:11 UTC 2013


Author: dteske
Date: Mon Dec 16 19:51:11 2013
New Revision: 259480
URL: http://svnweb.freebsd.org/changeset/base/259480

Log:
  Fix a long-standing edge-case that would result in a ghosted `zroot' pool
  and subsequent headaches caused by multiple pools with the same name.
  Specifically, blast away any labels on the designated swap partition.
  Problem was when you install to a given layout *with* swap and then turn
  around and re-install the same layout *without* swap (we weren't doing a
  labelclear for the swap device, so would end up with an "UNAVAIL" status
  zroot pool that may only exist in the pool cache).
  
  MFC after:	3 days

Modified:
  head/usr.sbin/bsdinstall/scripts/zfsboot

Modified: head/usr.sbin/bsdinstall/scripts/zfsboot
==============================================================================
--- head/usr.sbin/bsdinstall/scripts/zfsboot	Mon Dec 16 19:47:04 2013	(r259479)
+++ head/usr.sbin/bsdinstall/scripts/zfsboot	Mon Dec 16 19:51:11 2013	(r259480)
@@ -745,6 +745,9 @@ zfs_create_diskpart()
 			             "$GPART_ADD_LABEL_WITH_SIZE" swap$index \
 			             freebsd-swap ${swapsize}b $disk ||
 			             return $FAILURE
+			# Pedantically nuke any old labels on the swap
+			f_eval_catch -d $funcname zpool "$ZPOOL_LABELCLEAR_F" \
+			                /dev/gpt/swap$index
 			# Update fstab(5)
 			f_eval_catch $funcname printf "$PRINTF_FSTAB" \
 			             /dev/gpt/swap$index none swap sw 0 0 \
@@ -818,6 +821,9 @@ zfs_create_diskpart()
 			             "$GPART_ADD_INDEX_WITH_SIZE" 2 \
 			             freebsd-swap ${swapsize}b ${disk}s1 ||
 			             return $FAILURE
+			# Pedantically nuke any old labels on the swap
+			f_eval_catch -d $funcname zpool "$ZPOOL_LABELCLEAR_F" \
+			                /dev/${disk}s1b
 			# Update fstab(5)
 			f_eval_catch $funcname printf "$PRINTF_FSTAB" \
 			             /dev/${disk}s1b none swap sw 0 0 \


More information about the svn-src-all mailing list