Bug 1038696 - autofs-5.0.5-88.el6 breaks maps that have a -v in the options
Summary: autofs-5.0.5-88.el6 breaks maps that have a -v in the options
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: autofs
Version: 6.5
Hardware: All
OS: Linux
urgent
urgent
Target Milestone: rc
: ---
Assignee: Ian Kent
QA Contact: JianHong Yin
URL:
Whiteboard:
Depends On:
Blocks: 1067774 1132761
TreeView+ depends on / blocked
 
Reported: 2013-12-05 16:10 UTC by Scott Mayhew
Modified: 2018-12-09 17:20 UTC (History)
8 users (show)

Fixed In Version: autofs-5.0.5-90
Doc Type: Bug Fix
Doc Text:
Previously, the automount daemon did not take the length of an option into account when checking the mount option string. Due to this probelm, incorrect comparisons could occur, such as a "-v" option being incorrectly seen as "vers=4". As a consequence, the mount probes did not include NFSv3 when "-v" was used, and under some circumstances, the mounts were not created properly. With this update, the option matching has been changed to be more specific, and the problem no longer occurs.
Clone Of:
: 1132761 (view as bug list)
Environment:
Last Closed: 2014-10-14 08:14:32 UTC
Target Upstream Version:


Attachments (Terms of Use)
proposed fix (1.28 KB, patch)
2013-12-05 16:10 UTC, Scott Mayhew
no flags Details | Diff
Patch - fix options compare (7.87 KB, patch)
2013-12-24 07:44 UTC, Ian Kent
no flags Details | Diff
Patch - fix fix options compare (1.05 KB, patch)
2014-02-27 09:14 UTC, Ian Kent
no flags Details | Diff


Links
System ID Priority Status Summary Last Updated
Red Hat Knowledge Base (Solution) 633883 None None None Never
Red Hat Product Errata RHBA-2014:1587 normal SHIPPED_LIVE autofs bug fix update 2014-10-14 01:39:54 UTC

Description Scott Mayhew 2013-12-05 16:10:00 UTC
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:

Comment 3 Scott Mayhew 2013-12-05 16:47:43 UTC
(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

Comment 4 Ian Kent 2013-12-24 07:44:52 UTC
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?

Comment 5 Ian Kent 2013-12-24 07:45:51 UTC
(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.

Comment 6 Scott Mayhew 2014-01-02 20:22:05 UTC
(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.

Comment 7 Ian Kent 2014-01-12 05:33:29 UTC
(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

Comment 12 JianHong Yin 2014-02-25 10:53:31 UTC
(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

Comment 13 Ian Kent 2014-02-27 09:14:30 UTC
Created attachment 868391 [details]
Patch - fix fix options compare

Fix a problem caused by not properly handling passed length of 0.

Comment 20 errata-xmlrpc 2014-10-14 08:14:32 UTC
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


Note You need to log in before you can comment on or make changes to this bug.