Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 20 Nov 2016 13:44:27 +0000 (UTC)
From:      Jilles Tjoelker <jilles@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r308886 - in stable/10: etc/rc.d sbin/swapon
Message-ID:  <201611201344.uAKDiR9X088750@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jilles
Date: Sun Nov 20 13:44:27 2016
New Revision: 308886
URL: https://svnweb.freebsd.org/changeset/base/308886

Log:
  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

Modified:
  stable/10/etc/rc.d/swaplate
  stable/10/sbin/swapon/swapon.8
  stable/10/sbin/swapon/swapon.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/etc/rc.d/swaplate
==============================================================================
--- stable/10/etc/rc.d/swaplate	Sun Nov 20 13:04:02 2016	(r308885)
+++ stable/10/etc/rc.d/swaplate	Sun Nov 20 13:44:27 2016	(r308886)
@@ -11,7 +11,7 @@
 
 name="swaplate"
 start_cmd='/sbin/swapon -aLq'
-stop_cmd='/sbin/swapoff -aq'
+stop_cmd='/sbin/swapoff -aLq'
 
 load_rc_config swap
 run_rc_command "$1"

Modified: stable/10/sbin/swapon/swapon.8
==============================================================================
--- stable/10/sbin/swapon/swapon.8	Sun Nov 20 13:04:02 2016	(r308885)
+++ stable/10/sbin/swapon/swapon.8	Sun Nov 20 13:44:27 2016	(r308886)
@@ -28,7 +28,7 @@
 .\"     @(#)swapon.8	8.1 (Berkeley) 6/5/93
 .\" $FreeBSD$
 .\"
-.Dd October 2, 2016
+.Dd October 21, 2016
 .Dt SWAPON 8
 .Os
 .Sh NAME
@@ -98,6 +98,12 @@ will be removed, unless their
 .Dq noauto
 option is also set.
 If the
+.Fl L
+option is specified,
+only swap devices with the
+.Dq late
+option will be removed.
+If the
 .Fl q
 option is used,
 informational messages will not be

Modified: stable/10/sbin/swapon/swapon.c
==============================================================================
--- stable/10/sbin/swapon/swapon.c	Sun Nov 20 13:04:02 2016	(r308885)
+++ stable/10/sbin/swapon/swapon.c	Sun Nov 20 13:44:27 2016	(r308886)
@@ -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) {



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