From nobody Fri Jul 01 21:44:34 2022 X-Original-To: dev-commits-src-main@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 9943A874B0A; Fri, 1 Jul 2022 21:44:34 +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 4LZTHk3dkmz4TYc; Fri, 1 Jul 2022 21:44:34 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1656711874; 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=suY1rmdFVCld5rImgl2oLU8aryrVUPjKTeLN4hJIfkk=; b=t/gtyqZef+0TtgamPhoySQULcQxTHA8/4J9jrX2FjzWL02lJ/ghmZ6OGSI7u7a9TGnmTqx LoyJQsumzoleW9xUu/AqhWpEBknvjmJvq1K4sM/q7BJwH9dN4sitrRd7CYAYVa/dMmP338 PKbhzQ0OpTnkIALNQfBbHdci1ULvSD568ETybYjspx56YDP0Y0XVoosRTqRP8UYXsZfPSu FNSNfp89iEei23feoPBCrMXhLR8Wn0GtazbamqN7MgKn/XlZhJJc9BcFMRfpIEV6eP5uFi vN5zrkiv61f/2dJ8JyJ6k7pZ2EphWoPIFzpwpd6r/drPST6S2iUB5we1SVB2Ow== 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 58AD823519; Fri, 1 Jul 2022 21:44:34 +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 261LiYMk013664; Fri, 1 Jul 2022 21:44:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 261LiYoU013663; Fri, 1 Jul 2022 21:44:34 GMT (envelope-from git) Date: Fri, 1 Jul 2022 21:44:34 GMT Message-Id: <202207012144.261LiYoU013663@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Rick Macklem Subject: git: c0d14b0220ae - main - mount_nfs: Warn that intr, soft are not safe for NFSv4 List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@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/main X-Git-Reftype: branch X-Git-Commit: c0d14b0220ae22d25462cef191f20e9f04c5e87e Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1656711874; 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=suY1rmdFVCld5rImgl2oLU8aryrVUPjKTeLN4hJIfkk=; b=e+TiUYGoh6biAw85Dj6Nj9KTYJ3Hhh9vuI2oHakLmhrHFyn0KQkdZ+KCK6DplZUJmgVnX1 N7txCCMhQLw3YYOd+BhoKpZSexp8hwk0YpCU0stQthQHnfc9M/kAh8ESPmW8h42kro8J0V htROvdeuU8pysXFMXTQVwFfhjeNFQuMss7DEjeGA4v+R9fVqRlV2/9d56XKKKAliaj9oYP eBZP+UmpG3I20HBv0yHWheYtqgqzYDivryCmYqu7A84tHjXcRPjBpyVcICmOYa59hCgZz0 dxYc3bLLiy59mQY/jRuyn8iVBsts3cF6ZVLUlYbLmTob68AeiMPpyvQ0DMS13w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1656711874; a=rsa-sha256; cv=none; b=L2St1FjG1bpJcMRhe+sK0O4xFJ8EW71+z2by5dVZ67CygoNnmWEHpz/Laj80G6XSIXSwcQ WvYiNqRT3ZCPXEI6loTxtxl424kWavOgyhKT6jt5n1KJ/ynkecUSlJkEtMCMnWuCDls1eT brTyOi1KaLsljB7m0+swxltAPQPgJpE05B8LFNE6rwEDWGJf+3NoMH8TtxBpRM0J69QAiQ yxqrycDSaXGrX0OIgDHmX/DP6J1U/pkQKvIHFJL2AVAeA1Eh1daa17HGQpKolgKJEoQoCZ C4GcCNPvkRYV0hQefUM4Y0co5PamIWdecNrqOonwBiq5MWbsdEjn7Eyzs5zBag== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=c0d14b0220ae22d25462cef191f20e9f04c5e87e commit c0d14b0220ae22d25462cef191f20e9f04c5e87e Author: Rick Macklem AuthorDate: 2022-07-01 21:43:17 +0000 Commit: Rick Macklem CommitDate: 2022-07-01 21:43:17 +0000 mount_nfs: Warn that intr, soft are not safe for NFSv4 If the "intr" and/or "soft" mount options are used for NFSv4 mounts, the protocol can be broken when the operation returns without waiting for the RPC reply. The likelyhood of failure increases for NFSv4.1/4.2 mounts, since the session slot will be broken when an RPC reply is not processed. This is mentioned in the BUGS section of "man mount_nfs", but more needs to be done. This patch adds code that generates a warning message when the mount is done. PR: 260011 Reviewed by: emaste MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D35407 --- sbin/mount_nfs/mount_nfs.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/sbin/mount_nfs/mount_nfs.c b/sbin/mount_nfs/mount_nfs.c index 6ea861193df8..284b34323885 100644 --- a/sbin/mount_nfs/mount_nfs.c +++ b/sbin/mount_nfs/mount_nfs.c @@ -73,6 +73,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -160,7 +161,9 @@ main(int argc, char *argv[]) char mntpath[MAXPATHLEN], errmsg[255]; char hostname[MAXHOSTNAMELEN + 1], gssn[MAXHOSTNAMELEN + 50]; const char *gssname, *nmount_errstr; + bool softintr; + softintr = false; iov = NULL; iovlen = 0; memset(errmsg, 0, sizeof(errmsg)); @@ -210,6 +213,7 @@ main(int argc, char *argv[]) case 'i': printf("-i deprecated, use -o intr\n"); build_iovec(&iov, &iovlen, "intr", NULL, 0); + softintr = true; break; case 'L': printf("-L deprecated, use -o nolockd\n"); @@ -366,6 +370,10 @@ main(int argc, char *argv[]) "value -- %s", val); } pass_flag_to_nmount=0; + } else if (strcmp(opt, "soft") == 0) { + softintr = true; + } else if (strcmp(opt, "intr") == 0) { + softintr = true; } if (pass_flag_to_nmount) { build_iovec(&iov, &iovlen, opt, @@ -395,6 +403,7 @@ main(int argc, char *argv[]) case 's': printf("-s deprecated, use -o soft\n"); build_iovec(&iov, &iovlen, "soft", NULL, 0); + softintr = true; break; case 'T': nfsproto = IPPROTO_TCP; @@ -433,6 +442,11 @@ main(int argc, char *argv[]) /* NOTREACHED */ } + /* Warn that NFSv4 mounts only work correctly as hard mounts. */ + if (mountmode == V4 && softintr) + warnx("Warning, options soft and/or intr cannot be safely used" + " for NFSv4. See the BUGS section of mount_nfs(8)"); + spec = *argv++; mntname = *argv;