[PATCH nfs-utils] mount: fix parsing of default options

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <neilb@xxxxxxx>
---
 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
--- a/utils/mount/configfile.c
+++ b/utils/mount/configfile.c
@@ -277,10 +277,9 @@ conf_parse_mntopts(char *section, char *arg, struct mount_options *options)
 		}
 		if (buf[0] == '\0')
 			continue;
-		if (default_value(buf))
-			continue;
 
 		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.
 	 */
-	po_remove_all(options, "default");
+	while (po_contains_prefix(options, "default", &ptr, 0) == PO_FOUND)
+		po_remove_all(options, ptr);
 
 	po_join(options, &mount_opts);
 	po_destroy(options);
-- 
2.30.0

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux