Hide Forgot
Created attachment 833233 [details] proposed fix Description of problem: The check for 'vers=4' that was added by commit fa7e3e2 (mount_nfs.so to honor explicit NFSv4 requests) isn't restrictive enough, and matches '-v' if it's present in the option string. This results in a v4-only probe (and in the event that the server does not have v4 enabled, a mount failure, breaking existing maps). Version-Release number of selected component (if applicable): autofs-5.0.5-88.el6 How reproducible: Always Steps to Reproduce: 1.Create a map that has a -v in the options, e.g. [root@rhel6u5 ~]# cat /etc/auto.master /- /etc/auto.direct [root@rhel6u5 ~]# cat /etc/auto.direct /nfs -v nfs.smayhew.test:/export 2. Disable NFSv4 on the NFS server: [root@nfs ~]# grep ^RPCNFSDARGS /etc/sysconfig/nfs RPCNFSDARGS="-N 4" 3. Trigger the mount: [root@rhel6u5 ~]# ls /nfs ls: cannot open directory /nfs: No such file or directory Actual results: Dec 5 10:54:25 rhel6u5 automount[1584]: handle_packet: type = 5 Dec 5 10:54:25 rhel6u5 automount[1584]: handle_packet_missing_direct: token 2, name /nfs, request pid 1597 Dec 5 10:54:25 rhel6u5 automount[1584]: attempting to mount entry /nfs Dec 5 10:54:25 rhel6u5 automount[1584]: lookup_mount: lookup(file): looking up /nfs Dec 5 10:54:25 rhel6u5 automount[1584]: lookup_mount: lookup(file): /nfs -> -v#011nfs.smayhew.test:/export Dec 5 10:54:25 rhel6u5 automount[1584]: parse_mount: parse(sun): expanded entry: -v#011nfs.smayhew.test:/export Dec 5 10:54:25 rhel6u5 automount[1584]: parse_mount: parse(sun): gathered options: v Dec 5 10:54:25 rhel6u5 automount[1584]: parse_mount: parse(sun): dequote("nfs.smayhew.test:/export") -> nfs.smayhew.test:/export Dec 5 10:54:25 rhel6u5 automount[1584]: parse_mount: parse(sun): core of entry: options=v, loc=nfs.smayhew.test:/export Dec 5 10:54:25 rhel6u5 automount[1584]: sun_mount: parse(sun): mounting root /nfs, mountpoint /nfs, what nfs.smayhew.test:/export, fstype nfs, options v Dec 5 10:54:25 rhel6u5 automount[1584]: mount_mount: mount(nfs): root=/nfs name=/nfs what=nfs.smayhew.test:/export, fstype=nfs, options=v Dec 5 10:54:25 rhel6u5 automount[1584]: mount_mount: mount(nfs): nfs options="v", nobind=0, nosymlink=0, ro=0 Dec 5 10:54:25 rhel6u5 automount[1584]: get_nfs_info: called with host nfs.smayhew.test(192.168.122.179) proto 6 version 0x40 Dec 5 10:54:25 rhel6u5 automount[1584]: mount(nfs): no hosts available Dec 5 10:54:25 rhel6u5 automount[1584]: dev_ioctl_send_fail: token = 2 Dec 5 10:54:25 rhel6u5 automount[1584]: failed to mount /nfs Expected results: Dec 5 11:01:46 rhel6u5 automount[4408]: handle_packet: type = 5 Dec 5 11:01:46 rhel6u5 automount[4408]: handle_packet_missing_direct: token 5, name /nfs, request pid 4417 Dec 5 11:01:46 rhel6u5 automount[4408]: attempting to mount entry /nfs Dec 5 11:01:46 rhel6u5 automount[4408]: lookup_mount: lookup(file): looking up /nfs Dec 5 11:01:46 rhel6u5 automount[4408]: lookup_mount: lookup(file): /nfs -> -v#011nfs.smayhew.test:/export Dec 5 11:01:46 rhel6u5 automount[4408]: parse_mount: parse(sun): expanded entry: -v#011nfs.smayhew.test:/export Dec 5 11:01:46 rhel6u5 automount[4408]: parse_mount: parse(sun): gathered options: v Dec 5 11:01:46 rhel6u5 automount[4408]: parse_mount: parse(sun): dequote("nfs.smayhew.test:/export") -> nfs.smayhew.test:/export Dec 5 11:01:46 rhel6u5 automount[4408]: parse_mount: parse(sun): core of entry: options=v, loc=nfs.smayhew.test:/export Dec 5 11:01:46 rhel6u5 automount[4408]: sun_mount: parse(sun): mounting root /nfs, mountpoint /nfs, what nfs.smayhew.test:/export, fstype nfs, options v Dec 5 11:01:46 rhel6u5 automount[4408]: mount_mount: mount(nfs): root=/nfs name=/nfs what=nfs.smayhew.test:/export, fstype=nfs, options=v Dec 5 11:01:46 rhel6u5 automount[4408]: mount_mount: mount(nfs): nfs options="v", nobind=0, nosymlink=0, ro=0 Dec 5 11:01:46 rhel6u5 automount[4408]: get_nfs_info: called with host nfs.smayhew.test(192.168.122.179) proto 6 version 0x20 Dec 5 11:01:46 rhel6u5 automount[4408]: get_nfs_info: nfs v3 rpc ping time: 0.000633 Dec 5 11:01:46 rhel6u5 automount[4408]: get_nfs_info: host nfs.smayhew.test cost 633 weight 0 Dec 5 11:01:46 rhel6u5 automount[4408]: get_nfs_info: called with host nfs.smayhew.test(192.168.122.179) proto 17 version 0x20 Dec 5 11:01:46 rhel6u5 automount[4408]: get_nfs_info: nfs v3 rpc ping time: 0.000664 Dec 5 11:01:46 rhel6u5 automount[4408]: get_nfs_info: host nfs.smayhew.test cost 663 weight 0 Dec 5 11:01:46 rhel6u5 automount[4408]: prune_host_list: selected subset of hosts that support NFS3 over TCP Dec 5 11:01:46 rhel6u5 automount[4408]: mount_mount: mount(nfs): calling mkdir_path /nfs Dec 5 11:01:46 rhel6u5 automount[4408]: mount_mount: mount(nfs): calling mount -t nfs -s -o v nfs.smayhew.test:/export /nfs Dec 5 11:01:46 rhel6u5 automount[4408]: mount(nfs): mounted nfs.smayhew.test:/export on /nfs Dec 5 11:01:46 rhel6u5 automount[4408]: dev_ioctl_send_ready: token = 5 Dec 5 11:01:46 rhel6u5 automount[4408]: mounted /nfs Additional info:
(In reply to Scott Mayhew from comment #0) ... > Steps to Reproduce: > 1.Create a map that has a -v in the options, e.g. > [root@rhel6u5 ~]# cat /etc/auto.master > /- /etc/auto.direct > [root@rhel6u5 ~]# cat /etc/auto.direct > /nfs -v nfs.smayhew.test:/export > > 2. Disable NFSv4 on the NFS server: > [root@nfs ~]# grep ^RPCNFSDARGS /etc/sysconfig/nfs > RPCNFSDARGS="-N 4" > > 3. Trigger the mount: > [root@rhel6u5 ~]# ls /nfs > ls: cannot open directory /nfs: No such file or directory > I left out the fact that the client is configured to use NFSv3 instead of v4: [root@rhel6u5 ~]# egrep -v "^(#|$)" /etc/nfsmount.conf [ NFSMount_Global_Options ] Defaultvers=3 Nfsvers=3 [root@rhel6u5 ~]# grep "^MOUNT" /etc/sysconfig/autofs MOUNT_NFS_DEFAULT_PROTOCOL=3
Created attachment 841138 [details] Patch - fix options compare I think there's a rick of this happening in lots of options comparisons. Do you think this would be a better patch?
(In reply to Ian Kent from comment #4) > Created attachment 841138 [details] > Patch - fix options compare > > I think there's a rick of this happening in lots of options > comparisons. > > Do you think this would be a better patch? btw, it's against upstream atm. so it might not quite apply.
(In reply to Ian Kent from comment #5) > (In reply to Ian Kent from comment #4) > > Created attachment 841138 [details] > > Patch - fix options compare > > > > I think there's a rick of this happening in lots of options > > comparisons. > > > > Do you think this would be a better patch? Yes, that's better. > btw, it's against upstream atm. so it might not quite apply. It does if you backport the following commits first 61e6b979 3513eae4 62793cd9 I've also backported it w/out the above commits and can attach that version if you'd like.
(In reply to Scott Mayhew from comment #6) > (In reply to Ian Kent from comment #5) > > (In reply to Ian Kent from comment #4) > > > Created attachment 841138 [details] > > > Patch - fix options compare > > > > > > I think there's a rick of this happening in lots of options > > > comparisons. > > > > > > Do you think this would be a better patch? > > Yes, that's better. Good, then we will go with it. > > > btw, it's against upstream atm. so it might not quite apply. > > It does if you backport the following commits first > > 61e6b979 > 3513eae4 > 62793cd9 > > I've also backported it w/out the above commits and can attach that version > if you'd like. I'd prefer to backport the dependent patches (assuming I haven't done some for other bugs) because they no doubt fix things that need fixing as well. I'll get onto this when I return from leave. Ian
(In reply to Scott Mayhew from comment #0) > Created attachment 833233 [details] > proposed fix > > Description of problem: > The check for 'vers=4' that was added by commit fa7e3e2 (mount_nfs.so to > honor explicit NFSv4 requests) isn't restrictive enough, and matches > '-v' if it's present in the option string. This results in a v4-only > probe (and in the event that the server does not have v4 enabled, a > mount failure, breaking existing maps). > > Version-Release number of selected component (if applicable): > autofs-5.0.5-88.el6 > > How reproducible: > Always > > Steps to Reproduce: > 1.Create a map that has a -v in the options, e.g. > [root@rhel6u5 ~]# cat /etc/auto.master > /- /etc/auto.direct > [root@rhel6u5 ~]# cat /etc/auto.direct > /nfs -v nfs.smayhew.test:/export > > 2. Disable NFSv4 on the NFS server: > [root@nfs ~]# grep ^RPCNFSDARGS /etc/sysconfig/nfs > RPCNFSDARGS="-N 4" > > 3. Trigger the mount: > [root@rhel6u5 ~]# ls /nfs > ls: cannot open directory /nfs: No such file or directory Hi Scott Mayhew I can not reproduce this bug with same step in RHEL6.5 could you help me review the test code? : http://pkgs.devel.redhat.com/cgit/tests/autofs/tree/Regression/bz1038696-breaks-maps-that-have-v-options/runtest.sh
Created attachment 868391 [details] Patch - fix fix options compare Fix a problem caused by not properly handling passed length of 0.
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. http://rhn.redhat.com/errata/RHBA-2014-1587.html