svn commit: r189624 - head/etc/rc.d

David Schultz das at FreeBSD.ORG
Tue Mar 10 11:07:15 PDT 2009


On Tue, Mar 10, 2009, Gavin Atkinson wrote:
> On Tue, 2009-03-10 at 15:19 +0000, Guido van Rooij wrote:
> > Author: guido
> > Date: Tue Mar 10 15:19:49 2009
> > New Revision: 189624
> > URL: http://svn.freebsd.org/changeset/base/189624
> > 
> > Log:
> >   When swap resides on a mirror and it is not stopped, the mirror
> >   is degraded upon the next reboot and will have to be rebuild.
> >   Thus call swapoff when rebooting (read: when stopping swap1)
> 
> Is this due to a bug/feature of gmirror?  A long time ago, swapoff used
> to be run on shutdown, but it was removed by pjd@ in src/etc/rc.d/swap1
> version 1.9 with the following commit message:
> 
> | Stop method for swap1 script was introduced, because gmirror needed
> | it. Now gmirror use shutdown hooks to mark mirrors as clean on
> | shutdown, so this is not needed anymore.
> 
> I'm not saying it's not needed, just intrigued why it is now needed
> again when it never used to be?
> 
> FWIW, I seem to remember that one of the reasons it was removed was that
> turning swap off created the possibility that lots of things would be
> paged back into RAM, which a) could take a long time, and b) fail if
> there was insufficient RAM.

Ideally it should be done only when (if?) needed, and as late as
possible in the shutdown process. For one, it's rather pointless
to swap in all the pages for applications that will only be killed
anyway. For two, swapoff() was designed as an infrequent
administrative operation; it's not robust against I/O errors, and
it doesn't do clustering or otherwise attempts to be efficient.


More information about the svn-src-all mailing list