mirror of
				https://git.proxmox.com/git/mirror_zfs.git
				synced 2025-10-26 18:05:04 +03:00 
			
		
		
		
	zed: Avoid core dump if wholedisk property does not exist
zed aborts and dumps core in vdev_whole_disk_from_config() if wholedisk property does not exist. make_leaf_vdev() adds the property but there may be already pools that don't have the wholedisk in the label. Reviewed-by: Ryan Moeller <ryan@iXsystems.com> Reviewed-by: Alexander Motin <mav@FreeBSD.org> Reviewed-by: Richard Yao <richard.yao@alumni.stonybrook.edu> Signed-off-by: Ameer Hamza <ahamza@ixsystems.com> Closes #14062
This commit is contained in:
		
							parent
							
								
									ca3a675c74
								
							
						
					
					
						commit
						8c0684d326
					
				| @ -938,14 +938,13 @@ vdev_whole_disk_from_config(zpool_handle_t *zhp, const char *vdev_path) | |||||||
| { | { | ||||||
| 	nvlist_t *nvl = NULL; | 	nvlist_t *nvl = NULL; | ||||||
| 	boolean_t avail_spare, l2cache, log; | 	boolean_t avail_spare, l2cache, log; | ||||||
| 	uint64_t wholedisk; | 	uint64_t wholedisk = 0; | ||||||
| 
 | 
 | ||||||
| 	nvl = zpool_find_vdev(zhp, vdev_path, &avail_spare, &l2cache, &log); | 	nvl = zpool_find_vdev(zhp, vdev_path, &avail_spare, &l2cache, &log); | ||||||
| 	if (!nvl) | 	if (!nvl) | ||||||
| 		return (0); | 		return (0); | ||||||
| 
 | 
 | ||||||
| 	verify(nvlist_lookup_uint64(nvl, ZPOOL_CONFIG_WHOLE_DISK, | 	(void) nvlist_lookup_uint64(nvl, ZPOOL_CONFIG_WHOLE_DISK, &wholedisk); | ||||||
| 	    &wholedisk) == 0); |  | ||||||
| 
 | 
 | ||||||
| 	return (wholedisk); | 	return (wholedisk); | ||||||
| } | } | ||||||
| @ -984,7 +983,7 @@ zfsdle_vdev_online(zpool_handle_t *zhp, void *data) | |||||||
| 	if ((tgt = zpool_find_vdev_by_physpath(zhp, devname, | 	if ((tgt = zpool_find_vdev_by_physpath(zhp, devname, | ||||||
| 	    &avail_spare, &l2cache, NULL)) != NULL) { | 	    &avail_spare, &l2cache, NULL)) != NULL) { | ||||||
| 		char *path, fullpath[MAXPATHLEN]; | 		char *path, fullpath[MAXPATHLEN]; | ||||||
| 		uint64_t wholedisk; | 		uint64_t wholedisk = 0; | ||||||
| 
 | 
 | ||||||
| 		error = nvlist_lookup_string(tgt, ZPOOL_CONFIG_PATH, &path); | 		error = nvlist_lookup_string(tgt, ZPOOL_CONFIG_PATH, &path); | ||||||
| 		if (error) { | 		if (error) { | ||||||
| @ -992,10 +991,8 @@ zfsdle_vdev_online(zpool_handle_t *zhp, void *data) | |||||||
| 			return (0); | 			return (0); | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 		error = nvlist_lookup_uint64(tgt, ZPOOL_CONFIG_WHOLE_DISK, | 		(void) nvlist_lookup_uint64(tgt, ZPOOL_CONFIG_WHOLE_DISK, | ||||||
| 		    &wholedisk); | 		    &wholedisk); | ||||||
| 		if (error) |  | ||||||
| 			wholedisk = 0; |  | ||||||
| 
 | 
 | ||||||
| 		if (wholedisk) { | 		if (wholedisk) { | ||||||
| 			path = strrchr(path, '/'); | 			path = strrchr(path, '/'); | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Ameer Hamza
						Ameer Hamza