summaryrefslogtreecommitdiffstats
path: root/sbin/swapon/swapon.c
diff options
context:
space:
mode:
authorjilles <jilles@FreeBSD.org>2016-11-20 13:44:27 +0000
committerjilles <jilles@FreeBSD.org>2016-11-20 13:44:27 +0000
commitf40dc50ad2f89e81e3e36797a4771a529126b76c (patch)
tree1d6e455c2ac5f7dac0f8fd66994c90c6d3f63843 /sbin/swapon/swapon.c
parent9b8a89b75060dd9ad7df57e8ea1ac8bf87ef1549 (diff)
downloadFreeBSD-src-f40dc50ad2f89e81e3e36797a4771a529126b76c.zip
FreeBSD-src-f40dc50ad2f89e81e3e36797a4771a529126b76c.tar.gz
MFC r307755: swapoff: Remove only late devices with -aL.
Currently, '/etc/rc.d/swaplate stop' removes all swap devices. This can be very slow and may not even be possible if there is a lot of swap space in use. However, removing swap devices is only needed for late swap devices that may depend on daemons that subsequent shutdown steps stop. Normal swap devices such as hard disk partitions will remain available throughout the shutdown process and need not be removed. In swapoff, interpret -aL to remove late swap devices only, and use this in etc/rc.d/swaplate. The meaning of -aL in swapon remains unchanged (add all swap devices, both normal and late). PR: 187081
Diffstat (limited to 'sbin/swapon/swapon.c')
-rw-r--r--sbin/swapon/swapon.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/sbin/swapon/swapon.c b/sbin/swapon/swapon.c
index db01223..436ccd6 100644
--- a/sbin/swapon/swapon.c
+++ b/sbin/swapon/swapon.c
@@ -176,6 +176,10 @@ main(int argc, char **argv)
strstr(fsp->fs_mntops, "late") &&
late == 0)
continue;
+ if (which_prog == SWAPOFF &&
+ strstr(fsp->fs_mntops, "late") == NULL &&
+ late != 0)
+ continue;
swfile = swap_on_off(fsp->fs_spec, 1,
fsp->fs_mntops);
if (swfile == NULL) {
OpenPOWER on IntegriCloud