Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1392954pxb; Thu, 28 Jan 2021 15:42:47 -0800 (PST) X-Google-Smtp-Source: ABdhPJy1u14Nb6pVRVLURjWEhbDBojpMM4SFux8EXLwqQBrV5+kFh9auUzDz8udzT5Isowe4k1EZ X-Received: by 2002:a50:b586:: with SMTP id a6mr2280774ede.206.1611877366799; Thu, 28 Jan 2021 15:42:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611877366; cv=none; d=google.com; s=arc-20160816; b=xLGVpBoyWt3DeN4Tcu25CdewXP93epr2zud511duOzZ3eK4Vtbb6N4x/jmVo+vLrsw trHX9GS9LK91CZ7e3kWdAfySxosrYryGzvEnaq2N4t+Z7dqRzUy2NnZ26+FjIR6NcQK3 bO0uFxVwhz947dq8cBDFzw5u0p4HZT2DpQfe6xyrsPcU+XG+HDNafcai2qjP14qf8aTY rasYNaRlWHUIh8+0yuGFAhAyROBIfv/0WG7/ef8Xwwerkg17UHmcTJJdqYoa08mX7c5b 2auxnDFSYoqOv+4bPrq6yIbQ2ffbokBk2uw5q0833sCxuVYD6oQsWB9gng7E7qJIJLl0 KAAw== 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=NuPbXgeiL0LzwFf+1YwcSTugfcmH6bzryFha4GVhRoM=; b=iSbyz3rNdt9VDfftYX9F4bX1QKzVIqGnL/kOQSVEAcRfJdKNArVdBlHjxCKHlR8T7r E4dD0L771xnkW20rs0lw33kDgp0CJ1RFGtyyNb+K4VSQjizPGsaybL2y1rwuJRwDWGL9 +zAqbRAhB9CJhBLswVzdtFHRo0lxf958/tT/PegfhLuJXih+t5ShM9Q4HbBWTvSZf9+9 zH85ah3d7aSk652xBGycq1AIIwlL6mxNPKf59EuMH7HCTJqByg4fN6sxOW6cW7L0HC3t adS69Ir6fE3NOFg/ij+CvE64y554ZuEKk5d7nQDczq7D9bglzx9j7duivnuVJU61iSBv IM3g== 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 ga16si3385807ejc.412.2021.01.28.15.42.22; Thu, 28 Jan 2021 15:42:46 -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 S231481AbhA1XlG (ORCPT + 99 others); Thu, 28 Jan 2021 18:41:06 -0500 Received: from mx2.suse.de ([195.135.220.15]:58620 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229828AbhA1XlA (ORCPT ); Thu, 28 Jan 2021 18:41:00 -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 E0699ABC4; Thu, 28 Jan 2021 23:40:18 +0000 (UTC) From: NeilBrown To: Steve Dickson , Linux NFS Mailing list Date: Fri, 29 Jan 2021 10:40:14 +1100 Subject: [PATCH nfs-utils] mount: fix parsing of default options In-Reply-To: <87o8h8fx7a.fsf@notabene.neil.brown.name> References: <20210106184028.150925-1-steved@redhat.com> <87o8h8fx7a.fsf@notabene.neil.brown.name> Message-ID: <87lfccfx5t.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 A recent patch to change configfile.c to use parse_opt.c contained code which was intended to remove all "default*" options from the list before that could be passed to the kernel. This code didn't work, so default* options WERE passed to the kernel, and the kernel complained and failed the mount attempt. A more recent patch attempted to fix this by not including the "default*" options in the option list at all. This resulting in global-default defaults over-riding per-mount or per-server defaults. This patch reverse the "more recent" patch, and fixes the original patch by providing correct code to remove all "default*" options before the kernel can see them. Fixes: 88c22f924f1b ("mount: convert configfile.c to use parse_opt.c") Fixes: 8142542bda28 ("mount: parse default values correctly") Signed-off-by: NeilBrown =2D-- utils/mount/configfile.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/utils/mount/configfile.c b/utils/mount/configfile.c index e865998dd5a9..ab386d08b031 100644 =2D-- a/utils/mount/configfile.c +++ b/utils/mount/configfile.c @@ -277,10 +277,9 @@ conf_parse_mntopts(char *section, char *arg, struct mo= unt_options *options) } if (buf[0] =3D=3D '\0') continue; =2D if (default_value(buf)) =2D continue; =20 po_append(options, buf); + default_value(buf); } conf_free_list(list); } @@ -335,7 +334,8 @@ char *conf_get_mntopts(char *spec, char *mount_point, * Strip out defaults, which have already been handled, * then join the rest and return. */ =2D po_remove_all(options, "default"); + while (po_contains_prefix(options, "default", &ptr, 0) =3D=3D PO_FOUND) + po_remove_all(options, ptr); =20 po_join(options, &mount_opts); po_destroy(options); =2D-=20 2.30.0 --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQJCBAEBCAAsFiEEG8Yp69OQ2HB7X0l6Oeye3VZigbkFAmATS14OHG5laWxiQHN1 c2UuZGUACgkQOeye3VZigblVPRAAi85XuQwaUB12qEYJ/YRQWxKPDu+fuobhFnm7 acepOsR5SJ9hThsKcG23aeaPJYRdTJOssum+93CmQuKze+5gHSfJBm+SAKGN85BZ SBKUw9Vc0bkZQF0Ca4QJX/Cw69VVRXTwWavw1EHVdkqgX9JLsKe++guLZhRrlV9i rHOVVMlmTxNHy44OEmZSaNQYUBhQeDu6CMyhWmwKGVdFGbXW2TlDWuS3tLMSm2Fv K51YVexWs7TciFRndCHWH7QShucQueC7QACnQKF7gnuqiv2zI2Y2fqFdfgMVeJ+0 /0nEbxgrOulwJyYvKDOI05Wnd8+0MSf5gxShJvVe+gz4Rr2hPZeJhGV/jpT/zu1S rkKHrLfLBWvs/JQ3ahIoh9H6xL1cbnzIelRRblDwHc6J4kMq01fQMV/OK2Mh89U6 k/md1pb1kZmTQLhieXdhV+7ZLVlMt8BkB7ml+FlcYLDIKr7F1geyCarbNtJKtGqo 7dS0ZVsidG1K/CTuWOfdk/OO1VERFPhxCnjUjfJdevtV4sQhMtv7jP75IxAMoyy2 0NtDdX6ZdcWRX1SP6gwKMvNAYwHyqP1AahV6Q+c/01udDrt+SplVKvcY8Ltr6pZk lFvaLvbr+u6U/aYZGMsxhHxjI0DRZTYLwyQTzOWlZTlkq+lQxRQzz6ZrANBTrgv2 ikflgLw= =szlP -----END PGP SIGNATURE----- --=-=-=--