From nobody Mon Jan 3 18:51:31 2022 X-Original-To: freebsd-current@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 239FC1924E22 for ; Mon, 3 Jan 2022 18:51:42 +0000 (UTC) (envelope-from delphij@delphij.net) Received: from anubis.delphij.net (anubis.delphij.net [64.62.153.212]) (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 "anubis.delphij.net", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4JSPws2R6Nz3LYm; Mon, 3 Jan 2022 18:51:41 +0000 (UTC) (envelope-from delphij@delphij.net) Received: from [100.64.10.108] (c-141-193-140-252.rev.sailinternet.net [141.193.140.252]) by anubis.delphij.net (Postfix) with ESMTPSA id 00649312A0; Mon, 3 Jan 2022 10:51:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=delphij.net; s=m7e2; t=1641235894; x=1641250294; bh=I16Ilhr62pfr4YHpsO/VcdMnqQpWCT0/1/I4EdMjrw8=; h=Date:Reply-To:To:Cc:From:Subject; b=gxSOWU/FTyhnt0Eawhs0/nBlEmlkeHxS0ChMUYP53/JDxgVrW6jG667+h616ZkPLi eJR5ZXkA+wmLfTs5eAI8UdLfTZ5E020jFkQL8hW/gjin/y+PMLLCKCNADcp+6K3vPa Up0Jnjdtr8lOwYBajvMhUixOxcPYKP44KkIkfodrEXRSGRpd62PytkqGqZD0GmXn1R gqZuX3wT+powIFUu3r0a+8BApppvdy+lWakQ+mVhNUxz34BCG6gw/e5hkBvM+gAXxF DFlAqbqyqRedj9lxVCPnn9cm8PY2BNpduAlEA8ghAXIvflhL4t7FqDt7P1m/GCD8YL ZFOQ60re2c2iQ== Content-Type: multipart/mixed; boundary="------------emBi8ePUfEbKBsuUI3TW0MQo" Message-ID: Date: Mon, 3 Jan 2022 10:51:31 -0800 List-Id: Discussions about the use of FreeBSD-current List-Archive: https://lists.freebsd.org/archives/freebsd-current List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-current@freebsd.org MIME-Version: 1.0 Reply-To: d@delphij.net Content-Language: en-US To: freebsd-current Cc: rmacklem@freebsd.org, "re@FreeBSD.org Engineering Team" Organization: The FreeBSD Project Subject: [RFC] Making mount_nfs to attempt NFSv4 before NFSv3 and NFSv2? X-Rspamd-Queue-Id: 4JSPws2R6Nz3LYm X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; dkim=pass header.d=delphij.net header.s=m7e2 header.b="gxSOWU/F"; dmarc=pass (policy=reject) header.from=delphij.net; spf=pass (mx1.freebsd.org: domain of delphij@delphij.net designates 64.62.153.212 as permitted sender) smtp.mailfrom=delphij@delphij.net X-Spamd-Result: default: False [-1.43 / 15.00]; HAS_REPLYTO(0.00)[d@delphij.net]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+mx]; HAS_ATTACHMENT(0.00)[]; MIME_BASE64_TEXT_BOGUS(1.00)[]; HAS_ORG_HEADER(0.00)[]; DKIM_TRACE(0.00)[delphij.net:+]; MIME_BASE64_TEXT(0.10)[]; DMARC_POLICY_ALLOW(-0.50)[delphij.net,reject]; NEURAL_HAM_SHORT(-0.70)[-0.701]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:+]; SUBJECT_ENDS_QUESTION(1.00)[]; ASN(0.00)[asn:6939, ipnet:64.62.128.0/18, country:US]; MID_RHS_MATCH_FROM(0.00)[]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-0.83)[-0.832]; R_DKIM_ALLOW(-0.20)[delphij.net:s=m7e2]; FREEFALL_USER(0.00)[delphij]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-0.998]; MIME_GOOD(-0.10)[multipart/mixed,text/plain,text/x-patch]; REPLYTO_DOM_EQ_FROM_DOM(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[] Reply-To: delphij@delphij.net From: Xin Li via freebsd-current X-Original-From: Xin Li X-Spam: Yes X-ThisMailContainsUnwantedMimeParts: N This is a multi-part message in MIME format. --------------emBi8ePUfEbKBsuUI3TW0MQo Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Hi, Currently, mount_nfs will attempt to use NFSv3 and fallback to NFSv2. The manual page says: nfsv2 Use the NFS Version 2 protocol (the default is to try version 3 first then version 2). Note that NFS version 2 has a file size limit of 2 gigabytes. And the code agrees, too: %%%%%%%% if (trymntmode == V4) { nfsvers = 4; mntvers = 3; /* Workaround for GCC. */ } else if (trymntmode == V2) { nfsvers = 2; mntvers = 1; } else { nfsvers = 3; mntvers = 3; } %%%%%%%% When trymntmode == ANY, which is the default, mount_nfs would attempt NFSv3, and if rpcb_getaddr() returned RPC_PROGVERSMISMATCH, it would try again with trymntmode = V2. Nowadays, it seems that NFSv4 is becoming more and more popular. If a server is providing only NFSv4 service, when mounting without -o nfsv4, the user would receive message like: RPCPROG_MNT: RPC:Timed out A friend of mine who is using TrueNAS core hit this yesterday and his Linux client worked just fine. It took me some time to figure out that the root cause. It seems that modern Linux distributions have been using NFSv4 by default for some time. So I think it makes sense to teach mount_nfs to attempt NFSv4, then NFSv3 and NFSv2. However, this might be a POLA violation and we would like to know if there is any objections. (I've attached a patch but I haven't actually tested it yet). Cheers, --------------emBi8ePUfEbKBsuUI3TW0MQo Content-Type: text/x-patch; charset=UTF-8; name="0001-mount_nfs-Attempt-NFSv4-before-NFSv3-and-NFSv2.patch" Content-Disposition: attachment; filename*0="0001-mount_nfs-Attempt-NFSv4-before-NFSv3-and-NFSv2.patch" Content-Trans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