Skip to contentSkip to conversation

mount.nfs: move 'sloppy' option to beginning of the options

PATCH David Wysochanski 1 participant 1 message Jul 19, 2021 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw
Quoted 63 lines · Jianhong Yin

mount.nfs -o quota,sloppy still get regression fail, fix it and add sloppy item in nfs(5)

---
test log:
'''
[root@rhel-85-latest nfs-utils]# ./utils/mount/mount.nfs -oquota,sloppy localhost:/export /mnt/nfsmp -v mount.nfs: timeout set for Mon Jul 19 05:53:37 2021
mount.nfs: trying text-based options 'sloppy,vers=4.2,addr=::1,clientaddr=::1' localhost:/export on /mnt/nfsmp type nfs (quota,sloppy)

[root@rhel-85-latest nfs-utils]# umount /mnt/nfsmp/
[root@rhel-85-latest nfs-utils]# ./utils/mount/mount.nfs -oquota -s localhost:/export /mnt/nfsmp -v mount.nfs: timeout set for Mon Jul 19 05:54:05 2021
mount.nfs: trying text-based options 'sloppy,vers=4.2,addr=::1,clientaddr=::1' localhost:/export on /mnt/nfsmp type nfs (quota)

[root@rhel-85-latest nfs-utils]# ./utils/mount/mount.nfs -osloppy,quota,sloppy localhost:/export /mnt/nfsmp -v -s mount.nfs: timeout set for Mon Jul 19 05:57:21 2021
mount.nfs: trying text-based options 'sloppy,vers=4.2,addr=::1,clientaddr=::1'
localhost:/export on /mnt/nfsmp type nfs (sloppy,quota,sloppy)
'''

 utils/mount/mount.c | 4 ++++
 utils/mount/nfs.man | 7 +++++++
 2 files changed, 11 insertions(+)
utils/mount/mount.c +4 -0
index b98f9e00..dbe9edf6 100644
@@ -344,6 +344,10 @@ static void parse_opts(const char *options, int *flags, char **extra_opts)
 
                        /* end of option item or last item */
                        if (*p == '\0' || *(p + 1) == '\0') {
+                               if (strcmp(opt, "sloppy") == 0) {
+                                       ++sloppy;
+                                       continue;
+                               }
                                parse_opt(opt, flags, *extra_opts, len);
                                opt = NULL;
                        }
utils/mount/nfs.man +7 -1
index f98cb47d..f1b76936 100644
@@ -555,6 +555,13 @@ using the FS-Cache facility. See cachefilesd(8)
 and <kernel_source>/Documentation/filesystems/caching
 for detail on how to configure the FS-Cache facility.
 Default value is nofsc.
+.TP 1.5i
+.B sloppy
+The
+.B sloppy
+option is an alternative to specifying
+.BR mount.nfs " -s " option.
+
 .SS "Options for NFS versions 2 and 3 only"
 Use these options, along with the options in the above subsection,
 for NFS versions 2 and 3 only.
--
Quoted 2 lines

2.18.1

LGTM

Did this test to verify:

# for o in blah,vers=4.1,sec=sys,sloppy blah,vers=4.1,sloppy,sec=sys
sloppy,blah,vers=4.1,sec=sys vers=4.1,blah,sec=sys,sloppy
vers=4.1,blah,sloppy,sec=sys vers=4.1,sloppy,blah,sec=sys
sloppy,vers=4.1,blah,sec=sys sloppy,vers=4.1,sec=sys,blah; do
./utils/mount/mount.nfs -o $o 127.0.0.1:/exports /mnt/test; if [ $?
-ne 0 ]; then echo ERROR: on options $o; break; fi; umount /mnt/test;
done; echo SUCCESS on kernel $(uname -r) nfs-utils at $(git log
--oneline | head -1)
SUCCESS on kernel 5.12.15-300.fc34.x86_64 nfs-utils at f840d4c878f0
mount.nfs: move 'sloppy' option to beginning of the options