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

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