Blame SOURCES/nfs-utils-2.3.3-mount-sloppy.patch

5f9a66
diff -up nfs-utils-2.3.3/utils/mount/nfs.man.save nfs-utils-2.3.3/utils/mount/nfs.man
5f9a66
--- nfs-utils-2.3.3/utils/mount/nfs.man.save	2021-07-28 14:42:20.977740892 -0400
5f9a66
+++ nfs-utils-2.3.3/utils/mount/nfs.man	2021-07-28 14:42:01.133212815 -0400
5f9a66
@@ -525,6 +525,13 @@ using the FS-Cache facility. See cachefi
5f9a66
 and <kernel_soruce>/Documentation/filesystems/caching
5f9a66
 for detail on how to configure the FS-Cache facility.
5f9a66
 Default value is nofsc.
5f9a66
+.TP 1.5i
5f9a66
+.B sloppy
5f9a66
+The
5f9a66
+.B sloppy
5f9a66
+option is an alternative to specifying
5f9a66
+.BR mount.nfs " -s " option.
5f9a66
+
5f9a66
 .SS "Options for NFS versions 2 and 3 only"
5f9a66
 Use these options, along with the options in the above subsection,
5f9a66
 for NFS versions 2 and 3 only.
5f9a66
diff -up nfs-utils-2.3.3/utils/mount/parse_opt.c.save nfs-utils-2.3.3/utils/mount/parse_opt.c
5f9a66
--- nfs-utils-2.3.3/utils/mount/parse_opt.c.save	2021-07-28 14:40:15.467400995 -0400
5f9a66
+++ nfs-utils-2.3.3/utils/mount/parse_opt.c	2021-07-28 14:39:57.666927309 -0400
5f9a66
@@ -178,6 +178,22 @@ static void options_tail_insert(struct m
5f9a66
 	options->count++;
5f9a66
 }
5f9a66
 
5f9a66
+static void options_head_insert(struct mount_options *options,
5f9a66
+				struct mount_option *option)
5f9a66
+{
5f9a66
+	struct mount_option *ohead = options->head;
5f9a66
+
5f9a66
+	option->prev = NULL;
5f9a66
+	option->next = ohead;
5f9a66
+	if (ohead)
5f9a66
+		ohead->prev = option;
5f9a66
+	else
5f9a66
+		options->tail = option;
5f9a66
+	options->head = option;
5f9a66
+
5f9a66
+	options->count++;
5f9a66
+}
5f9a66
+
5f9a66
 static void options_delete(struct mount_options *options,
5f9a66
 			   struct mount_option *option)
5f9a66
 {
5f9a66
@@ -374,6 +390,23 @@ po_return_t po_join(struct mount_options
5f9a66
 }
5f9a66
 
5f9a66
 /**
5f9a66
+ * po_insert - insert an option into a group of options
5f9a66
+ * @options: pointer to mount options
5f9a66
+ * @option: pointer to a C string containing the option to add
5f9a66
+ *
5f9a66
+ */
5f9a66
+po_return_t po_insert(struct mount_options *options, char *str)
5f9a66
+{
5f9a66
+	struct mount_option *option = option_create(str);
5f9a66
+
5f9a66
+	if (option) {
5f9a66
+		options_head_insert(options, option);
5f9a66
+		return PO_SUCCEEDED;
5f9a66
+	}
5f9a66
+	return PO_FAILED;
5f9a66
+}
5f9a66
+
5f9a66
+/**
5f9a66
  * po_append - concatenate an option onto a group of options
5f9a66
  * @options: pointer to mount options
5f9a66
  * @option: pointer to a C string containing the option to add
5f9a66
diff -up nfs-utils-2.3.3/utils/mount/parse_opt.h.save nfs-utils-2.3.3/utils/mount/parse_opt.h
5f9a66
--- nfs-utils-2.3.3/utils/mount/parse_opt.h.save	2021-07-28 14:40:54.292434148 -0400
5f9a66
+++ nfs-utils-2.3.3/utils/mount/parse_opt.h	2021-07-28 14:39:57.666927309 -0400
5f9a66
@@ -43,6 +43,7 @@ void			po_replace(struct mount_options *
5f9a66
 				   struct mount_options *);
5f9a66
 po_return_t		po_join(struct mount_options *, char **);
5f9a66
 
5f9a66
+po_return_t		po_insert(struct mount_options *, char *);
5f9a66
 po_return_t		po_append(struct mount_options *, char *);
5f9a66
 po_found_t		po_contains(struct mount_options *, char *);
5f9a66
 po_found_t		po_contains_prefix(struct mount_options *options,
5f9a66
diff -up nfs-utils-2.3.3/utils/mount/stropts.c.save nfs-utils-2.3.3/utils/mount/stropts.c
5f9a66
--- nfs-utils-2.3.3/utils/mount/stropts.c.save	2021-07-28 14:41:14.842981010 -0400
5f9a66
+++ nfs-utils-2.3.3/utils/mount/stropts.c	2021-07-28 14:42:01.134212842 -0400
5f9a66
@@ -336,13 +336,21 @@ static int nfs_verify_lock_option(struct
5f9a66
 	return 1;
5f9a66
 }
5f9a66
 
5f9a66
-static int nfs_append_sloppy_option(struct mount_options *options)
5f9a66
+static int nfs_insert_sloppy_option(struct mount_options *options)
5f9a66
 {
5f9a66
-	if (!sloppy || linux_version_code() < MAKE_VERSION(2, 6, 27))
5f9a66
+	if (linux_version_code() < MAKE_VERSION(2, 6, 27))
5f9a66
 		return 1;
5f9a66
 
5f9a66
-	if (po_append(options, "sloppy") == PO_FAILED)
5f9a66
-		return 0;
5f9a66
+	if (po_contains(options, "sloppy")) {
5f9a66
+		po_remove_all(options, "sloppy");
5f9a66
+		sloppy++;
5f9a66
+	}
5f9a66
+
5f9a66
+	if (sloppy) {
5f9a66
+		if (po_insert(options, "sloppy") == PO_FAILED)
5f9a66
+			return 0;
5f9a66
+	}
5f9a66
+
5f9a66
 	return 1;
5f9a66
 }
5f9a66
 
5f9a66
@@ -424,7 +432,7 @@ static int nfs_validate_options(struct n
5f9a66
 	if (!nfs_set_version(mi))
5f9a66
 		return 0;
5f9a66
 
5f9a66
-	if (!nfs_append_sloppy_option(mi->options))
5f9a66
+	if (!nfs_insert_sloppy_option(mi->options))
5f9a66
 		return 0;
5f9a66
 
5f9a66
 	return 1;