From owner-svn-src-all@FreeBSD.ORG Thu Sep 5 20:50:52 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 99F64D3B; Thu, 5 Sep 2013 20:50:52 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 86BBB2F8A; Thu, 5 Sep 2013 20:50:52 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r85KoquX000927; Thu, 5 Sep 2013 20:50:52 GMT (envelope-from hrs@svn.freebsd.org) Received: (from hrs@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r85KoqIx000926; Thu, 5 Sep 2013 20:50:52 GMT (envelope-from hrs@svn.freebsd.org) Message-Id: <201309052050.r85KoqIx000926@svn.freebsd.org> From: Hiroki Sato Date: Thu, 5 Sep 2013 20:50:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r255265 - head/sbin/swapon X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Sep 2013 20:50:52 -0000 Author: hrs Date: Thu Sep 5 20:50:52 2013 New Revision: 255265 URL: http://svnweb.freebsd.org/changeset/base/255265 Log: Enable "late" option when a file= option is specified in /etc/fstab. The file= option requires rw mount where the backing store exists but it does not work because rc.d/swap runs before rc.d/fsck. Reported by: wblock Modified: head/sbin/swapon/swapon.c Modified: head/sbin/swapon/swapon.c ============================================================================== --- head/sbin/swapon/swapon.c Thu Sep 5 20:34:58 2013 (r255264) +++ head/sbin/swapon/swapon.c Thu Sep 5 20:50:52 2013 (r255265) @@ -170,13 +170,20 @@ main(int argc, char **argv) if (which_prog == SWAPON || which_prog == SWAPOFF) { if (doall) { while ((fsp = getfsent()) != NULL) { - if (strcmp(fsp->fs_type, FSTAB_SW)) + if (strcmp(fsp->fs_type, FSTAB_SW) != 0) continue; - if (strstr(fsp->fs_mntops, "noauto")) + if (strstr(fsp->fs_mntops, "noauto") != NULL) continue; + /* + * Forcibly enable "late" option when file= is + * specified. This is because mounting file + * systems with rw option is typically + * required to make the backing store ready. + */ if (which_prog != SWAPOFF && - strstr(fsp->fs_mntops, "late") && - !late) + (strstr(fsp->fs_mntops, "late") != NULL || + strstr(fsp->fs_mntops, "file=") != NULL) && + late == 0) continue; swfile = swap_on_off(fsp->fs_spec, 1, fsp->fs_mntops);