mirror of
				https://git.proxmox.com/git/mirror_zfs.git
				synced 2025-10-26 18:05:04 +03:00 
			
		
		
		
	Fix Dracut scripts to allow for blanks in pool and dataset names
The ability to use blanks is documented in zpool(8) and implemented in module/zcommon/zfs_namecheck.c:valid_char(). Signed-off-by: Lukas Wunner <lukas@wunner.de> Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> Closes #3083
This commit is contained in:
		
							parent
							
								
									293d141ae4
								
							
						
					
					
						commit
						bf5efb5c66
					
				| @ -4,15 +4,21 @@ _do_zpool_export() { | ||||
| 	local ret=0 | ||||
| 	local final=$1 | ||||
| 	local force | ||||
| 	local OLDIFS="$IFS" | ||||
| 	local NEWLINE=" | ||||
| " | ||||
| 
 | ||||
| 	if [ "x$final" != "x" ]; then | ||||
| 		force="-f" | ||||
| 	fi | ||||
| 
 | ||||
| 	info "Exporting ZFS storage pools" | ||||
| 	# Change IFS to allow for blanks in pool names. | ||||
| 	IFS="$NEWLINE" | ||||
| 	for fs in `zpool list -H -o name` ; do | ||||
| 		zpool export $force "$fs" || ret=$? | ||||
| 	done | ||||
| 	IFS="$OLDIFS" | ||||
| 
 | ||||
| 	if [ "x$final" != "x" ]; then | ||||
| 		info "zpool list" | ||||
|  | ||||
| @ -3,6 +3,9 @@ | ||||
| . /lib/dracut-lib.sh | ||||
| 
 | ||||
| ZPOOL_FORCE="" | ||||
| OLDIFS="$IFS" | ||||
| NEWLINE=" | ||||
| " | ||||
| 
 | ||||
| if getargbool 0 zfs_force -y zfs.force -y zfsforce ; then | ||||
| 	warn "ZFS: Will force-import pools if necessary." | ||||
| @ -34,9 +37,12 @@ case "$root" in | ||||
| 
 | ||||
| 					# Re-export everything since we're not prepared to take | ||||
| 					# responsibility for them. | ||||
| 					zpool list -H | while read fs rest ; do | ||||
| 					# Change IFS to allow for blanks in pool names. | ||||
| 					IFS="$NEWLINE" | ||||
| 					for fs in `zpool list -H -o name` ; do | ||||
| 						zpool export "$fs" | ||||
| 					done | ||||
| 					IFS="$OLDIFS" | ||||
| 
 | ||||
| 					return 1 | ||||
| 				fi | ||||
| @ -46,11 +52,11 @@ case "$root" in | ||||
| 			# Should have an explicit pool set, so just import it and we're done. | ||||
| 			zfsbootfs="${root#zfs:}" | ||||
| 			pool="${zfsbootfs%%/*}" | ||||
| 			if ! zpool list -H $pool > /dev/null ; then | ||||
| 			if ! zpool list -H "$pool" > /dev/null ; then | ||||
| 				# pool wasn't imported automatically by the kernel module, so | ||||
| 				# try it manually. | ||||
| 				info "ZFS: Importing pool ${pool}..." | ||||
| 				if ! zpool import -N ${ZPOOL_FORCE} $pool ; then | ||||
| 				if ! zpool import -N ${ZPOOL_FORCE} "$pool" ; then | ||||
| 					warn "ZFS: Unable to import pool ${pool}." | ||||
| 					rootok=0 | ||||
| 
 | ||||
| @ -61,7 +67,7 @@ case "$root" in | ||||
| 
 | ||||
| 		# Above should have left our rpool imported and pool/dataset in $root. | ||||
| 		# We need zfsutil for non-legacy mounts and not for legacy mounts. | ||||
| 		mountpoint=`zfs get -H -o value mountpoint $zfsbootfs` | ||||
| 		mountpoint=`zfs get -H -o value mountpoint "$zfsbootfs"` | ||||
| 		if [ "$mountpoint" = "legacy" ] ; then | ||||
| 			mount -t zfs "$zfsbootfs" "$NEWROOT" && ROOTFS_MOUNTED=yes | ||||
| 		else | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Lukas Wunner
						Lukas Wunner