Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1392209pxb; Thu, 28 Jan 2021 15:41:12 -0800 (PST) X-Google-Smtp-Source: ABdhPJxj9RXYqpSMUOwSOM+KVDL47qcyR8B6aqDrtMKpdo4XJ8u5bb4Py6gRIDFLf81xoELaiVBh X-Received: by 2002:a50:fc04:: with SMTP id i4mr2240869edr.137.1611877272407; Thu, 28 Jan 2021 15:41:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611877272; cv=none; d=google.com; s=arc-20160816; b=M3BOP18yX8VU7itumtArFHhrgk05/JGr4lid7lA8MSsF9NPOp9wHxtKJFpjx2LvN05 P0hJH67Ellc+x7Nsz1OxgexU/s7+P9/5YMtRCnTU7uYggaGs2rH+SdVSQpxA4t/Fu/OK wpL9A+FvtAFK6PAICiy6oaWRA+bNGLTUx5moG7chtcCvRn1Hsb7bs80MWPX7MFZwmX8c vxmRoabiRMBTH/wJo6PDCvAcu8nvAoKvSnllKBRbaRE38jB58cvqOE4K3f4aDXIodsg9 Mk80Oa4EbI1G3/4z52xID75SAHMefhfnVSjyKmeVnFutN0RTTN0Bk8ClzXUKW6rLvrwS +FfQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:references:in-reply-to :subject:date:to:from; bh=fH+HYg4i7gncUP3VtXBualD9qmwNRVCtb+tBjkmPZHw=; b=JYG/NuexUDQ1X+iDp7B6hz7CDuQi8qRykrDz8wlDtOsnOsj/qPDjQBZKBexmrbgh5o wa7TpUBiqQWidHLos7dOJh7U7tXotQ8GJ7bfQyPBQztVgFOrSUzCBbg7a9g+XOSOudwS Kwt6unLa9oVdT7V/IEjDFZ5uyBbJBffZ1Nl2ZXgtc05c2ScfbY/zv0LtQMINftSb101c rb8RVUUE77YvOApMh9Mfi//f0flgdOBiyx3os2zbhQgJeckHbK6BHxFsmC24HSQRTPDY addHMzWeRF8tJ40HdDc7/J9O5WxAXhsaK3L5sKWQyaHW+F/VSWA1TGhDOiI5zo+Ckm5P 4Prg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a1si4150640edq.48.2021.01.28.15.40.36; Thu, 28 Jan 2021 15:41:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231224AbhA1XkJ (ORCPT + 99 others); Thu, 28 Jan 2021 18:40:09 -0500 Received: from mx2.suse.de ([195.135.220.15]:58272 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229828AbhA1XkI (ORCPT ); Thu, 28 Jan 2021 18:40:08 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 943F1AC60; Thu, 28 Jan 2021 23:39:26 +0000 (UTC) From: NeilBrown To: Steve Dickson , Linux NFS Mailing list Date: Fri, 29 Jan 2021 10:39:21 +1100 Subject: Re: [PATCH] mount: parse default values correctly In-Reply-To: <20210106184028.150925-1-steved@redhat.com> References: <20210106184028.150925-1-steved@redhat.com> Message-ID: <87o8h8fx7a.fsf@notabene.neil.brown.name> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable On Wed, Jan 06 2021, Steve Dickson wrote: > Commit 88c22f92 converted the configfile.c routines > to use the parse_opt interfaces which broke how > default values from nfsmount.conf are managed. > > Default values can not be added to the mount string > handed to the kernel. They must be interpreted into > the correct mount options then passed to the kernel. > > Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=3D1912877 > > Signed-off-by: Steve Dickson > --- > utils/mount/configfile.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/utils/mount/configfile.c b/utils/mount/configfile.c > index 7934f4f..e865998 100644 > --- a/utils/mount/configfile.c > +++ b/utils/mount/configfile.c > @@ -277,8 +277,10 @@ conf_parse_mntopts(char *section, char *arg, struct = mount_options *options) > } > if (buf[0] =3D=3D '\0') > continue; > + if (default_value(buf)) > + continue; > + > po_append(options, buf); > - default_value(buf); > } > conf_free_list(list); > } > --=20 > 2.29.2 Hi, unfortunately this is incorrect. As the referenced patch said: The default_value() call is now made as soon as the option has been parsed. It is left on the options list so that new instances of the value are ignored. The new code doesn't leave it on the option list, so new instances are not ignored. conf_get_mntopts() processes options for the mount point, then options for the server, then global options. If there is e.g. a defaultvers for both the mountpoint and as a global option, the global option will now not be ignored, so it takes precedence. The real problem as identified in the bugzilla discussion, is that po_remove_all(options, "default"); doesn't remove all the "default*" options as was the intent. Clearly I never tested that. This is easily fixed with - po_remove_all(options, "default"); + while (po_contains_prefix(options, "default", &ptr, 0) =3D=3D PO_FOUND) + po_remove_all(options, ptr); which I have tested :-) I'll follow up with a patch which reverts the incorrect fix, and adds this one. Thanks, NeilBrown --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQJCBAEBCAAsFiEEG8Yp69OQ2HB7X0l6Oeye3VZigbkFAmATSyoOHG5laWxiQHN1 c2UuZGUACgkQOeye3VZigbnYpQ//VxJskdcTxqDRlzUG9GRtzw8BupjMg3mvJItU IBz5ZOLTOrvurUnjizHzuMh01hmriLzX3y4ouzQRdiWnNrjpDrt81XkZKd8ZjoL0 F0Is5cUYd8TSeUbXF2jZzGXQ03xDIWTMgdn2N+3MGj6ij8pvSUMaO2w2MuZOj0xc Dhq2+fspgBqd8bULl7KkSXX1VN7TSPAcQuHybsRoWb3+g/dR3otQBQgHNnIyojXz FKigQ2r8rZM2BSCG/PWJpk3CVYi++KOA4YtrGZUxInbHmlwiyFhocMLzlW1FnoB1 H3H17SRQSLnTesbIdZOBt/rFtclX6e6WWFS0RLzhzhVCggEJ3a8KEED7JHiQw7K3 oug9Q2WP/ldmaBQXnnOomhc+vZmdKjIkyPifW4gm6kfvFTo2v/41y6mGZ+7PQxGP m+aNamHVa0trlD+0yZ9JzEszrkAIuCqy9M4iVBDWEwvWKBens0fXjEUCC4FGkHq9 owP+ZWIzMBAu2bKIMLkhYEhGsStnT3y5XtN6GHj6HyGBuB+86jHWgmgplPOY52RS po0/lP1CkTAQxq67yqIqGuBf+x5fQJnC15tVlRP1ZuHL+1Dhfeeoqmd3GzdSjRMS IwcX1SVafGFoV3QlHkon4e+8IB+Pm11o4zFDreCTxANA+4kkVTaWbCSH+0btF4jM ntPQ0ro= =+7UE -----END PGP SIGNATURE----- --=-=-=--