2021-07-19 17:04:58

by David Wysochanski

[permalink] [raw]
Subject: Re: [PATCH] mount.nfs: move 'sloppy' option to beginning of the options

On Mon, Jul 19, 2021 at 6:03 AM Jianhong Yin <[email protected]> wrote:
>
> mount.nfs -o quota,sloppy still get regression fail, fix it
> and add sloppy item in nfs(5)
>
> Signed-off-by: Jianhong Yin <[email protected]>
> ---
> 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(+)
>
> diff --git a/utils/mount/mount.c b/utils/mount/mount.c
> index b98f9e00..dbe9edf6 100644
> --- a/utils/mount/mount.c
> +++ b/utils/mount/mount.c
> @@ -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;
> }
> diff --git a/utils/mount/nfs.man b/utils/mount/nfs.man
> index f98cb47d..f1b76936 100644
> --- a/utils/mount/nfs.man
> +++ b/utils/mount/nfs.man
> @@ -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.
> --
> 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


Reviewed-and-tested-by: Dave Wysochanski <[email protected]>