Date: Mon, 19 Mar 2012 23:17:26 +0000 (UTC) From: Josh Paetzel <jpaetzel@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r233223 - stable/9/usr.sbin/pc-sysinstall/backend Message-ID: <201203192317.q2JNHQgl091402@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jpaetzel Date: Mon Mar 19 23:17:26 2012 New Revision: 233223 URL: http://svn.freebsd.org/changeset/base/233223 Log: MFC: 232898 Improve ZFS exporting functionality, only export pools which are on a specific device we happen to be writing to. This fixes an issue when running pc-sysinstall on a running system which needs ZFS and the main disk gets exported. Submitted by: kmoore Obtained from: PC-BSD Modified: stable/9/usr.sbin/pc-sysinstall/backend/functions-disk.sh Directory Properties: stable/9/usr.sbin/pc-sysinstall/ (props changed) Modified: stable/9/usr.sbin/pc-sysinstall/backend/functions-disk.sh ============================================================================== --- stable/9/usr.sbin/pc-sysinstall/backend/functions-disk.sh Mon Mar 19 23:14:47 2012 (r233222) +++ stable/9/usr.sbin/pc-sysinstall/backend/functions-disk.sh Mon Mar 19 23:17:26 2012 (r233223) @@ -224,16 +224,6 @@ get_disk_mediasize() export VAL="${mediasize}" }; -# Function which exports all zpools, making them safe to overwrite potentially -export_all_zpools() -{ - # Export any zpools - for i in `zpool list -H -o name` - do - zpool export -f ${i} - done -}; - # Function to delete all gparts before starting an install delete_all_gpart() { @@ -268,10 +258,15 @@ delete_all_gpart() # Function to export all zpools before starting an install stop_all_zfs() { - # Export all zpools again, so that we can overwrite these partitions potentially + local DISK="`echo ${1} | sed 's|/dev/||g'`" + + # Export any zpools using this device so we can overwrite for i in `zpool list -H -o name` do - zpool export -f ${i} + ztst=`zpool status ${i} | grep "ONLINE" | awk '{print $1}' | grep -q ${DISK}` + if [ "$ztst" = "$DISK" ] ; then + zpool export -f ${i} + fi done }; @@ -324,9 +319,6 @@ setup_disk_slice() disknum="0" gmnum="0" - # Make sure all zpools are exported - export_all_zpools - # We are ready to start setting up the disks, lets read the config and do the actions while read line do @@ -354,7 +346,7 @@ setup_disk_slice() stop_all_geli ${DISK} # Make sure we don't have any zpools loaded - stop_all_zfs + stop_all_zfs ${DISK} fi @@ -375,6 +367,16 @@ setup_disk_slice() then exit_err "ERROR: The mirror disk ${MIRRORDISK} does not exist!" fi + + # Make sure we stop any gmirrors on this mirror disk + stop_all_gmirror ${MIRRORDISK} + + # Make sure we stop any geli stuff on this mirror disk + stop_all_geli ${MIRRORDISK} + + # Make sure we don't have any zpools mirror loaded + stop_all_zfs ${MIRRORDISK} + fi # Lets see if we have been given a mirror balance choice
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201203192317.q2JNHQgl091402>