Bug 7293 - Can't access opaque symlinks (unix extensions=off) pointing to another Samba mount
Summary: Can't access opaque symlinks (unix extensions=off) pointing to another Samba ...
Status: NEW
Alias: None
Product: Samba 3.4
Classification: Unclassified
Component: File services (show other bugs)
Version: 3.4.7
Hardware: x64 Linux
: P3 normal
Target Milestone: ---
Assignee: Volker Lendecke
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-03-25 09:22 UTC by Guillaume Boudreau
Modified: 2010-03-25 09:25 UTC (History)
0 users

See Also:


Attachments
Access to file2 failed (1.31 KB, text/plain)
2010-03-25 09:23 UTC, Guillaume Boudreau
no flags Details
Access to file2 works (1.31 KB, text/plain)
2010-03-25 09:24 UTC, Guillaume Boudreau
no flags Details
Access to file2 failed (967 bytes, text/plain)
2010-03-25 09:25 UTC, Guillaume Boudreau
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Guillaume Boudreau 2010-03-25 09:22:29 UTC
Computer A runs my samba server. Has unix extensions = off, wide links = on (don't think this one matters with unix extensions off...)
This way, if I have a symlink on my shares, clients see it as a normal file, not as a symlink.
This works fine, even for symlinks to files outside the shares paths.
Except when the symlink points to a file that is on a CIFS mount.

So say I have computer B (running Mac OS X) that shares something using Samba. I mount such share on computer A, in /mnt/hdd-air.
Then, on a share of computer A, I create a symlink to a file in /mnt/hdd-air:
ln -s /mnt/hdd-air/gh/TimeMachine/file2 /mnt/hdd0/shares/TimeMachine/file2

If I mount my TimeMachine share (on computer A or any other computer), file2 is listed, but I can't access it.

That is, it can't be accessed UNLESS the file was accessed successfully in the last second!

Here's a test case I created on computer A:

# This is my /mnt/hdd-air share; I tried various mount options, and I always have the problem.
[gb@hda TimeMachine]$ grep hdd-air /etc/fstab
//192.168.155.5/gb /mnt/hdd-air cifs credentials=/home/gb/.smb_credentials,uid=500,gid=100,file_mode=0666,dir_mode=0777,hard,_netdev 0 0

# Now I created 3 symlinks to various targets on my TimeMachine share.
[gb@hda TimeMachine]$ ls -l
lrwxrwxrwx 1 gb users   30 2010-03-24 17:04 file1 -> /mnt/hdd0/gh/TimeMachine/file1
lrwxrwxrwx 1 gb users   33 2010-03-24 17:05 file2 -> /mnt/hdd-air/gh/TimeMachine/file2
lrwxrwxrwx 1 gb users   30 2010-03-24 17:08 file3 -> /mnt/hdd1/gh/TimeMachine/file3

# We can see here that I can access all 3 files here, as expected.
[gb@hda TimeMachine]$ cat file*
1
2
3

# Here's the targets of my symlinks
[gb@hda TimeMachine]$ mount | grep -E "/mnt/hdd0|/mnt/hdd1|/mnt/hdd-air"
/dev/sda6 on /mnt/hdd0 type ext3 (rw)
/dev/sdf1 on /mnt/hdd1 type ext3 (rw)
//192.168.155.5/gb on /mnt/hdd-air type cifs (rw,mand)

# Now, I mounted my TimeMachine share locally to ease testing...
[gb@hda TimeMachine]$ cd /mnt/samba/TimeMachine/

# file2 looks fine
[gb@hda TimeMachine]$ ls -l
-rw-rw---- 1 gb   users    2 2010-03-24 17:05 file1
-rw-rw---- 0 gb   users    2 2010-03-24 17:05 file2
-rw-rw---- 1 gb   users    2 2010-03-24 17:08 file3

# But can't be accessed
[gb@hda TimeMachine]$ cat file*
1
cat: file2: No such file or directory
3

# But there is no problem if the file was successfully accessed in the last second!
[gb@hda TimeMachine]$ date; cat /mnt/hdd0/shares/TimeMachine/file*; date; cat /mnt/samba/TimeMachine/file*; date; cat /mnt/samba/TimeMachine/file*; sleep 1; cat /mnt/samba/TimeMachine/file*
Wed Mar 24 18:24:45 EDT 2010
1
2
3
Wed Mar 24 18:24:45 EDT 2010
1
2
3
Wed Mar 24 18:24:45 EDT 2010
1
2
3
Wed Mar 24 18:24:46 EDT 2010
1
cat: /mnt/samba/TimeMachine/file2: No such file or directory
3

As you can see, file2 works fine through my share until I wait 1 second after the last successful access, at which point the file becomes unaccessible.

I also tried to access /mnt/samba/TimeMachine/file2 in an infinite loop after accessing /mnt/hdd0/shares/TimeMachine/file2 once, and it works fine.
file2 accessed through the share will work fine until I stop the loop, wait 1 second, and then try to access it again!

I've set log level = 3 and traced what happens when I can and can't access the file. I'll attach both files.

System info:
[gb@hda ~]$ rpm -q samba
samba-3.4.7-58.fc12.x86_64
[gb@hda ~]$ uname -a
Linux hda.home.com 2.6.32.9-70.fc12.x86_64 #1 SMP Wed Mar 3 04:40:41 UTC 2010 x86_64 x86_64 x86_64 GNU/Linux
Comment 1 Guillaume Boudreau 2010-03-25 09:23:13 UTC
Created attachment 5539 [details]
Access to file2 failed
Comment 2 Guillaume Boudreau 2010-03-25 09:24:47 UTC
Created attachment 5540 [details]
Access to file2 works
Comment 3 Guillaume Boudreau 2010-03-25 09:25:39 UTC
Created attachment 5541 [details]
Access to file2 failed