Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 11 Sep 2009 17:41:42 +0200
From:      Pawel Jakub Dawidek <pjd@FreeBSD.org>
To:        Adrian Penisoara <ady@freebsd.ady.ro>
Cc:        guido@freebsd.org, freebsd-rc@freebsd.org
Subject:   Re: conf/120228: [zfs] [patch] Split ZFS volume startup / ease ZFS swap volumes management
Message-ID:  <20090911154142.GF1673@garage.freebsd.pl>
In-Reply-To: <78cb3d3f0909110819m35f2d5ceo64de128320091a76@mail.gmail.com>
References:  <200909091831.n89IVOS9065418@freefall.freebsd.org> <78cb3d3f0909110334g6757f08fh57a0ab97c02b2d9a@mail.gmail.com> <20090911122050.GC1673@garage.freebsd.pl> <78cb3d3f0909110819m35f2d5ceo64de128320091a76@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help

--VuQYccsttdhdIfIP
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Fri, Sep 11, 2009 at 05:19:41PM +0200, Adrian Penisoara wrote:
>  Actually using /etc/fstab for zvol swap is not quite working in the
> current setup since /etc/rc.d/swap1 does not automatically swapoff
> upon shutdown which makes 'zvol stop' attempt to close the (swap)
> volume(s) while still in use.
>   I guess 'zfs volfini' should be triggered by a shutdown hook
> similarly to what geom(4) classes are using.
>=20
>  I see Guido committed a swapoff hook in changeset 189624 (similar to
> what I suggested in my initial PR) but immediately backed it out the
> next day. Funny thing is that this swapoff hook flip-flopped over
> time, see changesets 135389, 137255.
>=20
>  Is there a reason not to have the swap devices automatically
> unmounted from /etc/swap1 upon shutdown ?

The answer is simple: we don't want swapoff to fail.

There really no point in removing swap on shutdown (it could still be a
good idea to do it when administrator executes /etc/rc.d/swap1 stop).
We unmount file systems on shutdown, because we want to keep them
consistent. There is no need to keep swap consistent, as the data will
be useless after reboot anyway.

All in all running swapoff at shutdown time increases reboot time and
introduce possibility of failure (I think the kernel can panic if there
is no enough memory to move everything out of the swap, but I might be
wrong here).

There are some tricky cases too. For example:

	# truncate -s 1g /swap.img
	# mdconfig -a -f /swap.img
	# swapon /dev/md0

Now if we don't remove swap we won't be able to unmount file system in
non-forcible way.

> > system to 'legacy' and then you can mount it from to /etc/fstab too.
> >
>=20
>  Perhaps not the best idea: what if I export and then import a zpool
> from one system to another -- then I will have some swap volumes
> automatically mounted upon boot, breaking POLA.
>=20
>  You can argue that ZFS filesystems will also be automatically mounted
> too, but this is a consistent behavior across different OSes while the
> discussed swap volume automount is FreeBSD specific.
>=20
>  Sorry to insist, but I still think we should we keep it simple...
> Unless people are already using/depending on this feature.

Please understand that I don't want to disallow swap configuration from
/etc/fstab. I'm just giving an option.

I'll think about it a bit more and talk to some people what they think
about this and I'll get back to you. Maybe this property is indeed
redundant, but I don't want to make any rush decisions.

--=20
Pawel Jakub Dawidek                       http://www.wheel.pl
pjd@FreeBSD.org                           http://www.FreeBSD.org
FreeBSD committer                         Am I Evil? Yes, I Am!

--VuQYccsttdhdIfIP
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.4 (FreeBSD)

iD8DBQFKqm+2ForvXbEpPzQRAlCbAJ9NrKXxe0iHQ/II/Y4tDlRs6NKGoQCgywOn
/8QRcqDdnK+syjkz6G4ab9o=
=FcZK
-----END PGP SIGNATURE-----

--VuQYccsttdhdIfIP--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20090911154142.GF1673>