Re: Swap Files

Andrew E. Mileski (aem@ott.hookup.net)
Sat, 18 Jan 1997 13:24:24 -0500 (EST)


> > I find this annoying: at shutdown, swapfiles are never turned off.
> > This keeps the partiton busy, and hence it needs to be fsck'ed at
> > next boot.
> >
> > Should something be put into the kernel shutdown to release all
> > swap files and umount all fs?
>
> This is a local configuration problem. I'm running kernel
> 2.1.17 + Debian 1.2 + sysvinit 2.6 and I don't have this
> problem.

I bet you don't use swap files! If so, then please explain what is wrong.
Try this yourself:
dd if=/dev/zero of=swap bs=1024 count=1028
mkswap swap
free ; swapon -v swap
free ; swapoff -a ; free
You'll then see what I mean - the swap file stays active.

An strace of "swapoff -a" shows that it is the problem, as it
only affects swap partitions and not swap files. IMHO, it should
affect swap files too - this may require a /proc entry listing
all swap sources and their types (so that a "new" swapoff could
read it, and turn off all swap sources. Or, the kernel system call
(I assume there already is one) could be expanded to handle this
special case (turning off all swap files).

--
Andrew E. Mileski   mailto:aem@ott.hookup.net
Linux Plug-and-Play Kernel Project http://www.redhat.com/linux-info/pnp/
XFree86 Matrox Team http://www.bf.rmit.edu.au/~ajv/xf86-matrox.html