From nobody Tue Jan 25 23:26:26 2022 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 51FBF1970FF5; Tue, 25 Jan 2022 23:26:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Jk2zl0zjKz4lbs; Tue, 25 Jan 2022 23:26:27 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1643153187; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=i9XQ8dTTa+34+ERM8ClUxIstJmyiVC4bVn7PZzQ01qo=; b=JzVMv3CFx7KBXk1TS1Hg5NknstENHzVuZLJ5h1hCEiGifatTzwOYekXRnedQg/usAzQmg1 mdAARJcREObTDZM/BkHiNzXDE48nUyW9E3ozax5+0TuF718I4wRrlwI6Vfu2MyuLIJvFwk llKFa/Yn5Izxxo5tkij7lRVr02uxu0Nx7DaW5OqW+LQ0+nr7hKJqKSxE6I5xTGWvS3Ataz wnxiH3aJ72JkVAS6o5DLgpzPCJ6ckHvSdWLVJTSwOEg0CTiC/jogXL2DV149l4vWVRxM/k HjPOug098vservbr4V+2EIgCDexj0tMw5j6m9kRUIStVLpnb+9Hqwis8LCC5mQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F343A12D48; Tue, 25 Jan 2022 23:26:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 20PNQQN8007171; Tue, 25 Jan 2022 23:26:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 20PNQQDA007170; Tue, 25 Jan 2022 23:26:26 GMT (envelope-from git) Date: Tue, 25 Jan 2022 23:26:26 GMT Message-Id: <202201252326.20PNQQDA007170@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Rick Macklem Subject: git: 82dbca47a558 - stable/13 - mount_nfs: Add a "bgnow" NFS mount option List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 82dbca47a5588efeadac7d52be690801de5f3ae8 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1643153187; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=i9XQ8dTTa+34+ERM8ClUxIstJmyiVC4bVn7PZzQ01qo=; b=qtFmjBiwU1CpUcPIfUOzE1ebG06164evGV2pg1cD09+x2aQpRrM9+F9j2diDDog3t+rca2 CwkDHjtlPtXwOG+W0ubuH8jeKAR8OoPJqXnMhGR6+om+QlDPwaXXUFqOWJSmmjAnv9ntK0 zBEBY/xifUeB1dPEGInHiE+1rVLj2YcAF47RkPnvrIHT3YiZ73d+XfxOp+otJk4OTLaE3o Hyn6K4HYCyUBs1t1wGuvxPBLSS8WhXRRvgabUoSJjkp4XwrVrsq1PfQGtdYfgjjeoH8rZm 9Zo8YqVwTRKte8umDimf2gd5INDDB2CvXz5XBtMOXTBwq2lz+rBzXO8+T6Jzlg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1643153187; a=rsa-sha256; cv=none; b=SOv4H70yK6/9DTrsrbLrKIRU9dQjAkeEWAtP1+Dxm4Am72K9aDtTNiTgjxJkZF4VwruvtV Jffp+Z92mjuLCYjKfKLh3KMRP6Y0Y0fuSjbq13BUFBneZISGyNshMuVzq6YqaH3oq1AJh9 b5INjFLZmyLIRHDm3UtjSYsKHLU+yZgbedbgyZNAI0MIDocvs+z3yyug+WXccvyg02Isl5 GD8AhEQus2u6qq/wqC0JlLz7WzESyfICuG3Yz9K4QXHi4wmIu4DWZic2XklHzm7qUAI0NV RYbn2pDRxZE3FceXzy8dPFIlwlp1amy4wvIyZj+til4loeWNo/VvwU9B+MvGgw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=82dbca47a5588efeadac7d52be690801de5f3ae8 commit 82dbca47a5588efeadac7d52be690801de5f3ae8 Author: Rick Macklem AuthorDate: 2022-01-11 16:20:01 +0000 Commit: Rick Macklem CommitDate: 2022-01-25 23:25:06 +0000 mount_nfs: Add a "bgnow" NFS mount option The "bg" option does not go background until the initial mount attempt fails, which can take 60+ seconds. This new "bgnow" option goes background immediately, avoiding the 60+ second delay, if the NFS server is not yet available. The man page update is a content change. PR: 260764 (cherry picked from commit 08a8d16cbb269d4c2be02eb67351c59d16f4ecb9) --- sbin/mount_nfs/mount_nfs.8 | 14 +++++++++++++- sbin/mount_nfs/mount_nfs.c | 23 +++++++++++++++++++---- 2 files changed, 32 insertions(+), 5 deletions(-) diff --git a/sbin/mount_nfs/mount_nfs.8 b/sbin/mount_nfs/mount_nfs.8 index 648cb2128e90..5725b6eccf65 100644 --- a/sbin/mount_nfs/mount_nfs.8 +++ b/sbin/mount_nfs/mount_nfs.8 @@ -28,7 +28,7 @@ .\" @(#)mount_nfs.8 8.3 (Berkeley) 3/29/95 .\" $FreeBSD$ .\" -.Dd July 10, 2021 +.Dd January 11, 2022 .Dt MOUNT_NFS 8 .Os .Sh NAME @@ -129,6 +129,18 @@ trying the mount in the background. Useful for .Xr fstab 5 , where the file system mount is not critical to multiuser operation. +.It Cm bgnow +Like +.Cm bg , +fork off a child to keep trying the mount in the background, +but do not attempt to mount in the foreground first. +This eliminates a +60+ second timeout when the server is not responding. +Useful for speeding up the boot process of a client when the server is +likely to be unavailable. +This is often the case for interdependent servers +such as cross-mounted servers (each of two servers is an NFS client of +the other) and for cluster nodes that must boot before the file servers. .It Cm deadthresh Ns = Ns Aq Ar value Set the .Dq "dead server threshold" diff --git a/sbin/mount_nfs/mount_nfs.c b/sbin/mount_nfs/mount_nfs.c index e1eaf206e982..898a6dc9d724 100644 --- a/sbin/mount_nfs/mount_nfs.c +++ b/sbin/mount_nfs/mount_nfs.c @@ -103,10 +103,11 @@ struct nfhret { long fhsize; u_char nfh[NFS3_FHSIZE]; }; -#define BGRND 1 -#define ISBGRND 2 -#define OF_NOINET4 4 -#define OF_NOINET6 8 +#define BGRND 0x01 +#define ISBGRND 0x02 +#define OF_NOINET4 0x04 +#define OF_NOINET6 0x08 +#define BGRNDNOW 0x10 static int retrycnt = -1; static int opflags = 0; static int nfsproto = IPPROTO_TCP; @@ -242,6 +243,9 @@ main(int argc, char *argv[]) if (strcmp(opt, "bg") == 0) { opflags |= BGRND; pass_flag_to_nmount=0; + } else if (strcmp(opt, "bgnow") == 0) { + opflags |= BGRNDNOW; + pass_flag_to_nmount=0; } else if (strcmp(opt, "fg") == 0) { /* same as not specifying -o bg */ pass_flag_to_nmount=0; @@ -421,6 +425,9 @@ main(int argc, char *argv[]) argc -= optind; argv += optind; + if ((opflags & (BGRND | BGRNDNOW)) == (BGRND | BGRNDNOW)) + errx(1, "Options bg and bgnow are mutually exclusive"); + if (argc != 2) { usage(); /* NOTREACHED */ @@ -649,6 +656,14 @@ getnfsargs(char *spec, struct iovec **iov, int *iovlen) } } + if ((opflags & (BGRNDNOW | ISBGRND)) == BGRNDNOW) { + warnx("Mount %s:%s, backgrounding", + hostp, spec); + opflags |= ISBGRND; + if (daemon(0, 0) != 0) + err(1, "daemon"); + } + ret = TRYRET_LOCALERR; for (;;) { /*