On 28.02.2017 13:00, Andriy Gapon wrote:
> This is quite annoying as I have to do gpart commit after each reboot to make 
> my
> zvols usable.
> 
> To add some data:
>> gpart show zvol/pond/raidz0
> =>      63  10485697  zvol/pond/raidz0  MBR  (5.0G)
>         63  10485697                    - free -  (5.0G)
> 
> The zvol actually has whole-disk ZFS on it, which uses zfsboot for booting.
> In other words, the first block of the zvol is the first block of zfsboot 
> binary.

Hi Andriy,

I think the attached (untested) patch can help.

-- 
WBR, Andrey V. Elsukov
Index: sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c
===================================================================
--- sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c	(revision 314298)
+++ sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c	(working copy)
@@ -278,7 +278,15 @@ zvol_size_changed(zvol_state_t *zv, uint64_t volsi
 		if (pp == NULL)
 			return;
 		g_topology_lock();
-		g_resize_provider(pp, zv->zv_volsize);
+		/*
+		 * Do not invoke resize event when initial size was zero.
+		 * ZVOL initializes the size on first open, this is not
+		 * real resizing.
+		 */
+		if (pp->mediasize == 0)
+			pp->mediasize = zv->zv_volsize;
+		else
+			g_resize_provider(pp, zv->zv_volsize);
 		g_topology_unlock();
 	}
 #endif	/* illumos */

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to