Suresh Jayaraman bdb97adcdf PATCH] cifs: fix broken mounts when a SSH tunnel is used (try #4)
One more try..

It seems there is a regression that got introduced while Jeff fixed
all the mount/umount races. While attempting to find whether a tcp
session is already existing, we were not checking whether the "port"
used are the same. When a second mount is attempted with a different
"port=" option, it is being ignored. Because of this the cifs mounts
that uses a SSH tunnel appears to be broken.

Steps to reproduce:

1. create 2 shares
# SSH Tunnel a SMB session
2. ssh -f -L 6111:127.0.0.1:445 root@localhost "sleep 86400"
3. ssh -f -L 6222:127.0.0.1:445 root@localhost "sleep 86400"
4. tcpdump -i lo 6111 &
5. mkdir -p /mnt/mnt1
6. mkdir -p /mnt/mnt2
7. mount.cifs //localhost/a /mnt/mnt1 -o username=guest,ip=127.0.0.1,port=6111
#(shows tcpdump activity on port 6111)
8. mount.cifs //localhost/b /mnt/mnt2 -o username=guest,ip=127.0.0.1,port=6222
#(shows tcpdump activity only on port 6111 and not on 6222

Fix by adding a check to compare the port _only_ if the user tries to
override the tcp port with "port=" option, before deciding that an
existing tcp session is found. Also, clean up a bit by replacing
if-else if by a switch statment while at it as suggested by Jeff.

Reviewed-by: Jeff Layton <jlayton@redhat.com>
Reviewed-by: Shirish Pargaonkar <shirishp@us.ibm.com>
Signed-off-by: Suresh Jayaraman <sjayaraman@suse.de>
Signed-off-by: Steve French <sfrench@us.ibm.com>
2009-09-01 17:08:48 +00:00
..
2009-07-12 12:22:34 -07:00
2009-06-11 21:36:14 -04:00
2009-07-12 12:24:07 -07:00
2009-06-11 21:36:01 -04:00
2009-07-12 12:22:34 -07:00
2009-07-12 12:22:34 -07:00
2009-06-24 08:15:24 -04:00
2009-07-14 12:28:43 -05:00
2009-06-17 00:36:36 -04:00
2009-07-12 12:22:34 -07:00
2009-07-12 12:22:34 -07:00
2009-07-12 12:22:34 -07:00
2009-07-12 12:22:34 -07:00
2009-07-12 12:22:34 -07:00
2009-07-12 12:22:34 -07:00
2009-07-12 12:22:34 -07:00
2009-05-22 18:40:59 +10:00
2009-07-10 19:18:59 -07:00
2009-07-12 12:22:34 -07:00
2009-06-15 21:44:43 -07:00
2009-07-12 12:22:34 -07:00
2009-06-15 21:44:43 -07:00
2009-07-12 12:22:34 -07:00
2009-06-11 21:36:13 -04:00
2009-06-11 21:36:12 -04:00
2009-07-30 17:31:23 +02:00
2009-07-12 12:22:34 -07:00
2009-06-11 21:36:07 -04:00
2009-07-12 12:22:34 -07:00
2009-06-17 00:36:37 -04:00
2009-07-12 12:22:34 -07:00
2009-06-18 13:03:46 -07:00
2009-06-30 18:55:58 -07:00
2008-12-31 18:07:43 -05:00
2009-01-03 11:45:54 -08:00
2009-07-01 11:14:28 -07:00
2009-07-12 12:22:34 -07:00
2009-07-12 12:22:34 -07:00
2009-06-11 21:36:06 -04:00
2009-06-18 13:03:41 -07:00
2009-07-12 12:22:34 -07:00
2009-03-31 23:00:26 -04:00
2009-08-07 14:38:29 -03:00
2009-06-11 21:36:07 -04:00
2009-07-14 12:34:17 +09:00
2009-06-11 21:36:11 -04:00
2009-04-07 08:31:16 -07:00
2009-04-20 23:02:52 -04:00
2009-02-18 15:37:53 -08:00
2009-06-11 21:36:02 -04:00