From owner-svn-src-stable@freebsd.org Wed Jan 6 09:56:08 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2186BA6514C; Wed, 6 Jan 2016 09:56:08 +0000 (UTC) (envelope-from smh@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D55B710D3; Wed, 6 Jan 2016 09:56:07 +0000 (UTC) (envelope-from smh@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u069u64N000755; Wed, 6 Jan 2016 09:56:06 GMT (envelope-from smh@FreeBSD.org) Received: (from smh@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u069u6Yw000753; Wed, 6 Jan 2016 09:56:06 GMT (envelope-from smh@FreeBSD.org) Message-Id: <201601060956.u069u6Yw000753@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: smh set sender to smh@FreeBSD.org using -f From: Steven Hartland Date: Wed, 6 Jan 2016 09:56:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r293232 - stable/10/sbin/reboot X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Jan 2016 09:56:08 -0000 Author: smh Date: Wed Jan 6 09:56:06 2016 New Revision: 293232 URL: https://svnweb.freebsd.org/changeset/base/293232 Log: MFC: r292266 & r292947 Add flag to disable inital reboot(8) userland sync Sponsored by: Multiplay Modified: stable/10/sbin/reboot/reboot.8 stable/10/sbin/reboot/reboot.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sbin/reboot/reboot.8 ============================================================================== --- stable/10/sbin/reboot/reboot.8 Wed Jan 6 05:23:25 2016 (r293231) +++ stable/10/sbin/reboot/reboot.8 Wed Jan 6 09:56:06 2016 (r293232) @@ -29,6 +29,7 @@ .\" $FreeBSD$ .\" .Dd October 11, 2010 +.Dd Jan 06, 2016 .Dt REBOOT 8 .Os .Sh NAME @@ -39,16 +40,16 @@ .Nd stopping and restarting the system .Sh SYNOPSIS .Nm halt -.Op Fl lnpq +.Op Fl lNnpq .Op Fl k Ar kernel .Nm -.Op Fl dlnpq +.Op Fl dlNnpq .Op Fl k Ar kernel .Nm fasthalt -.Op Fl lnpq +.Op Fl lNnpq .Op Fl k Ar kernel .Nm fastboot -.Op Fl dlnpq +.Op Fl dlNnpq .Op Fl k Ar kernel .Sh DESCRIPTION The @@ -94,6 +95,16 @@ that call or .Nm halt and log this themselves. +.It Fl N +The file system cache is not flushed during the initial process clean-up, +however the kernel level +.Xr reboot 2 +is still processed with a sync. +This option can be useful for performing a +.Dq best-effort +reboot when devices might be unavailable. +This can happen when devices have been disconnected, such as with +.Xr iscsi 4 . .It Fl n The file system cache is not flushed. This option should probably not be used. Modified: stable/10/sbin/reboot/reboot.c ============================================================================== --- stable/10/sbin/reboot/reboot.c Wed Jan 6 05:23:25 2016 (r293231) +++ stable/10/sbin/reboot/reboot.c Wed Jan 6 09:56:06 2016 (r293232) @@ -67,7 +67,7 @@ main(int argc, char *argv[]) { struct utmpx utx; const struct passwd *pw; - int ch, howto, i, fd, lflag, nflag, qflag, sverrno; + int ch, howto, i, fd, lflag, nflag, qflag, sverrno, Nflag; u_int pageins; const char *user, *kernel = NULL; @@ -76,8 +76,8 @@ main(int argc, char *argv[]) howto = RB_HALT; } else howto = 0; - lflag = nflag = qflag = 0; - while ((ch = getopt(argc, argv, "dk:lnpq")) != -1) + lflag = nflag = qflag = Nflag = 0; + while ((ch = getopt(argc, argv, "dk:lNnpq")) != -1) switch(ch) { case 'd': howto |= RB_DUMP; @@ -92,6 +92,10 @@ main(int argc, char *argv[]) nflag = 1; howto |= RB_NOSYNC; break; + case 'N': + nflag = 1; + Nflag = 1; + break; case 'p': howto |= RB_POWEROFF; break; @@ -107,6 +111,8 @@ main(int argc, char *argv[]) if ((howto & (RB_DUMP | RB_HALT)) == (RB_DUMP | RB_HALT)) errx(1, "cannot dump (-d) when halting; must reboot instead"); + if (Nflag && (howto & RB_NOSYNC) != 0) + errx(1, "-N cannot be used with -n"); if (geteuid()) { errno = EPERM; err(1, NULL);