Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 28 Feb 2017 15:05:23 +0300
From:      "Andrey V. Elsukov" <ae@FreeBSD.org>
To:        Andriy Gapon <avg@FreeBSD.org>, freebsd-geom@FreeBSD.org
Subject:   Re: GEOM_PART: zvol/pond/xxx was automatically resized, every boot
Message-ID:  <49828d0f-fe1c-f635-82c7-b63a32b6bba9@FreeBSD.org>
In-Reply-To: <cfbca2ca-57ec-2b49-b99e-2df794254b46@FreeBSD.org>
References:  <cfbca2ca-57ec-2b49-b99e-2df794254b46@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
This is an OpenPGP/MIME signed message (RFC 4880 and 3156)
--CWjdgrBH15C5AhFpe53762MbtwqDKmFRT
Content-Type: multipart/mixed; boundary="QoEGFsv31HWcWsp3EGLn16Mlk9CpkRDgA";
 protected-headers="v1"
From: "Andrey V. Elsukov" <ae@FreeBSD.org>
To: Andriy Gapon <avg@FreeBSD.org>, freebsd-geom@FreeBSD.org
Message-ID: <49828d0f-fe1c-f635-82c7-b63a32b6bba9@FreeBSD.org>
Subject: Re: GEOM_PART: zvol/pond/xxx was automatically resized, every boot
References: <cfbca2ca-57ec-2b49-b99e-2df794254b46@FreeBSD.org>
In-Reply-To: <cfbca2ca-57ec-2b49-b99e-2df794254b46@FreeBSD.org>

--QoEGFsv31HWcWsp3EGLn16Mlk9CpkRDgA
Content-Type: multipart/mixed;
 boundary="------------E88C7528E6DEDB205227EAD0"

This is a multi-part message in MIME format.
--------------E88C7528E6DEDB205227EAD0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

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

Hi Andriy,

I think the attached (untested) patch can help.

--=20
WBR, Andrey V. Elsukov

--------------E88C7528E6DEDB205227EAD0
Content-Type: text/x-patch;
 name="zvol.diff"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
 filename="zvol.diff"

Index: sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c	(revision 31429=
8)
+++ 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 =3D=3D 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 =3D=3D 0)
+			pp->mediasize =3D zv->zv_volsize;
+		else
+			g_resize_provider(pp, zv->zv_volsize);
 		g_topology_unlock();
 	}
 #endif	/* illumos */

--------------E88C7528E6DEDB205227EAD0--

--QoEGFsv31HWcWsp3EGLn16Mlk9CpkRDgA--

--CWjdgrBH15C5AhFpe53762MbtwqDKmFRT
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEzBAEBCAAdFiEE5lkeG0HaFRbwybwAAcXqBBDIoXoFAli1Z4MACgkQAcXqBBDI
oXovtwf/a0fJ+Ua8qaakFfs4n20BLscM+K7oWqebaSbUAjO1FNQwQmb0D97TAlrq
K/Qn/iuawv1R3Ox4oDcfwgX0tQcUBWoteTcuxuHbdY72dVN9iQc0rPY1tkEJfhf7
uWE7uRxhKdoJbp3Es3BGgf071VoJYpIs5QGEpeDANg25UcqSXBAGSFIkNVLBH0LK
vemd58CMyugPlJGnsRC3xvFU8nmmoifi8YqKoZ+pbYsA9z4byVfWrPmNWy4n3K2H
T/uKfNxuZ6fioisyaZjazw4zfP6pbDQlh02RhtNjfDMgUZ07wNnBTFb7sLxbkyCO
57XAJHtJsLphOtqMZ+t2AW29ykSFqw==
=apL4
-----END PGP SIGNATURE-----

--CWjdgrBH15C5AhFpe53762MbtwqDKmFRT--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?49828d0f-fe1c-f635-82c7-b63a32b6bba9>