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

d13089
commit 4dd8d833c9350d42528ada0fd65aee41b712f41d
d13089
Author: Steve Dickson <steved@redhat.com>
d13089
Date:   Tue Jul 20 17:14:04 2021 -0400
d13089
d13089
    mount.nfs: Fix the sloppy option processing
d13089
    
d13089
    The new mount API broke how the sloppy option is parsed.
d13089
    So the option processing needs to be moved up in
d13089
    the mount.nfs command.
d13089
    
d13089
    The option needs to be the first option in the string
d13089
    that is passed into the kernel with the -s mount(8)
d13089
    and/or the -o sloppy is used.
d13089
    
d13089
    Commit 92b664ef fixed the process of the -s flag
d13089
    and this version fixes the -o sloppy processing
d13089
    as well works when libmount-mount is and is not
d13089
    enabled plus cleans up the mount options passed
d13089
    to the kernel.
d13089
    
d13089
    Reviewed-and-tested-by: Dave Wysochanski <dwysocha@redhat.com>
d13089
    Signed-off-by: Steve Dickson <steved@redhat.com>
d13089
d13089
diff --git a/utils/mount/nfs.man b/utils/mount/nfs.man
d13089
index f98cb47d..f1b76936 100644
d13089
--- a/utils/mount/nfs.man
d13089
+++ b/utils/mount/nfs.man
d13089
@@ -555,6 +555,13 @@ using the FS-Cache facility. See cachefilesd(8)
d13089
 and <kernel_source>/Documentation/filesystems/caching
d13089
 for detail on how to configure the FS-Cache facility.
d13089
 Default value is nofsc.
d13089
+.TP 1.5i
d13089
+.B sloppy
d13089
+The
d13089
+.B sloppy
d13089
+option is an alternative to specifying
d13089
+.BR mount.nfs " -s " option.
d13089
+
d13089
 .SS "Options for NFS versions 2 and 3 only"
d13089
 Use these options, along with the options in the above subsection,
d13089
 for NFS versions 2 and 3 only.
d13089
diff --git a/utils/mount/stropts.c b/utils/mount/stropts.c
d13089
index 82b054a5..fa67a66f 100644
d13089
--- a/utils/mount/stropts.c
d13089
+++ b/utils/mount/stropts.c
d13089
@@ -339,11 +339,19 @@ static int nfs_verify_lock_option(struct mount_options *options)
d13089
 
d13089
 static int nfs_insert_sloppy_option(struct mount_options *options)
d13089
 {
d13089
-	if (!sloppy || linux_version_code() < MAKE_VERSION(2, 6, 27))
d13089
+	if (linux_version_code() < MAKE_VERSION(2, 6, 27))
d13089
 		return 1;
d13089
 
d13089
-	if (po_insert(options, "sloppy") == PO_FAILED)
d13089
-		return 0;
d13089
+	if (po_contains(options, "sloppy")) {
d13089
+		po_remove_all(options, "sloppy");
d13089
+		sloppy++;
d13089
+	}
d13089
+
d13089
+	if (sloppy) {
d13089
+		if (po_insert(options, "sloppy") == PO_FAILED)
d13089
+			return 0;
d13089
+	}
d13089
+
d13089
 	return 1;
d13089
 }
d13089
 
d13089