Bug 4066 - Subdirectory contents are shown as identical to the root directory
Subdirectory contents are shown as identical to the root directory
Status: RESOLVED FIXED
Product: CifsVFS
Classification: Unclassified
Component: kernel fs
2.6
x86 Linux
: P3 normal
: ---
Assigned To: Steve French
:
: 4525 5176 5534 (view as bug list)
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2006-08-28 14:33 UTC by Josh Kelley
Modified: 2009-05-14 17:39 UTC (History)
4 users (show)

See Also:


Attachments
Packet trace of "ls '/smb/ashley/directory/Fall 2006/Directory'" (153.93 KB, application/octet-stream)
2006-08-28 14:35 UTC, Josh Kelley
no flags Details
Level 10 debug log of "ls '/smb/ashley/directory/Fall 2006/Directory'" (72.18 KB, application/octet-stream)
2006-08-28 14:36 UTC, Josh Kelley
no flags Details
Packet trace of "ls '/smb/ashley/directory/Fall 2006/Directory/Fall 2006/Directory'" (138.12 KB, application/octet-stream)
2006-08-28 14:37 UTC, Josh Kelley
no flags Details
Level 10 debug log of "ls '/smb/ashley/directory/Fall 2006/Directory/Fall 2006/Directory'" (72.42 KB, application/octet-stream)
2006-08-28 14:37 UTC, Josh Kelley
no flags Details
workaround patch for older cifs.ko (turns off DFS flag in request) (504 bytes, patch)
2008-08-28 17:56 UTC, Steve French
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Josh Kelley 2006-08-28 14:33:55 UTC
When mounting a Samba share using mount.cifs, the share root's contents are shown in place of a subdirectory's contents.  Subdirectories off of this pseudo-root work as usual.

In other words:
"ls /smb/ashley/directory" shows the contents of the root of \\ashley\directory, as expected.
"ls '/smb/ashley/directory/Fall 2006/Directory'" also shows the contents of the root of \\ashley\directory, which is incorrect.
"ls '/smb/ashley/directory/Fall 2006/Directory/Fall 2006/Directory'" shows the contents of \\ashley\directory\Fall 2006\Directory.

Both client and server are running Linux (CentOS 4.3) with Samba 3.0.23b.
Comment 1 Josh Kelley 2006-08-28 14:35:32 UTC
Created attachment 2111 [details]
Packet trace of "ls '/smb/ashley/directory/Fall 2006/Directory'"
Comment 2 Josh Kelley 2006-08-28 14:36:29 UTC
Created attachment 2112 [details]
Level 10 debug log of "ls '/smb/ashley/directory/Fall 2006/Directory'"
Comment 3 Josh Kelley 2006-08-28 14:37:09 UTC
Created attachment 2113 [details]
Packet trace of "ls '/smb/ashley/directory/Fall 2006/Directory/Fall 2006/Directory'"
Comment 4 Josh Kelley 2006-08-28 14:37:43 UTC
Created attachment 2114 [details]
Level 10 debug log of "ls '/smb/ashley/directory/Fall 2006/Directory/Fall 2006/Directory'"
Comment 5 Gerald (Jerry) Carter 2006-08-28 14:41:37 UTC
handing this to Steve as I'm skeptical it is a server bug.
Comment 6 Josh Kelley 2006-08-28 16:14:13 UTC
Upon further investigation, from what I can tell with my extremely limited knowledge of CIFS:  The bug does indeed appear to be with the linux-cifs client.  The linux-cifs client passes only the directory path ("\Fall 2006\Directory\..."), rather than server + share + directory path.  The Samba server tries to resolve \Fall 2006\Directory\... as a DFS share, so it parses out Fall 2006 as a nonexistent server, Directory as the share name, and the rest of the path as relative to the root of the Directory share.  A workaround is to disable DFS; the fix would be to have the linux-cifs client always include the hostname and share in filename requests while DFS is enabled.
Comment 7 Cillian Sharkey 2007-03-09 12:14:21 UTC
I get the same problem with mount.cifs 1.10 and a Win2003 server with DFS.

To get access to \\myserver\myshare\myfile mounted on /mnt,
I have to use /mnt/x/x/myfile (where "x" can be any random string)
Comment 8 Jason Haar 2007-04-30 13:48:25 UTC
This is a "me too" - but with a twist.

We have a Win2K3 DFS server that maps ONE directory "/server1/share/archive" to another server "//server2/share2/archive". All the rest of server1 is local.

However, if I connect using mount.cifs under 2.6.19+, I can't correctly list/access any directory under //server1/share/ - i.e. "ls -l /server1/share/dir/" returns the dir listing from "/server1/share".

The twist is that it works fine with a 2.6.18 kernel - only the newer ones have this problem. I can reboot into 2.6.18, do the listing successfully, then reboot into a pure 2.6.20 kernel and the listing will be incorrect.

Sounds like some changes occurred in 2.6.19+ that broke this?

Thanks

Jason
Comment 9 Steve French 2008-08-28 16:50:13 UTC
The bugs (the fixes for either of which should resolve your problem) are:
Linux CIFS client was setting SMBFLG2_DFS when server claimed to support it, but we weren't sending a path beginning with a UNC name (ie we should have been sending \\server\share\path) - some server handle it but not this version of Samba.

Samba 3.0 server was not recognizing a path coming in with the DFS flag but that lacked the path prefix (I believe that the server is also fixed now).
Comment 10 Steve French 2008-08-28 16:53:59 UTC
The fix in mainline for this was:

commit 646dd539878a194bc14b104621c0b2b33587e40f
Author: Steve French <sfrench@us.ibm.com>
Date:   Thu May 15 01:50:56 2008 +0000

    [CIFS] Fix paths when share is in DFS to include proper prefix
    
    Some versions of Samba (3.2-pre e.g.) are stricter about checking to
    make sure that paths in DFS name spaces are sent in the form 
    \\server\share\dir\subdir ... instead of \dir\subdir
    
    Acked-by: Jeff Layton <jlayton@redhat.com>
    Signed-off-by: Steve French <sfrench@us.ibm.com>
Comment 11 Steve French 2008-08-28 17:53:10 UTC
This was fixed on the cifs kernel client in 2.6.26 (version 1.53 of cifs.ko), 2.6.26-rc4 to be precise.  IIRC a Samba server workaround for this was also fixed/added in late May so that the server (as it used to do) no longer tried to parse server names out of DFS paths when they look wrong.   For older cifs, an easy fix for this would be to simply turn off the DFS flag on SMB requests on older cifs (current cifs since 2.6.26 kernel supports DFS).  See attached patch for a quick fix for a fix for older (pre-2.6.26 kernel version of cifs) cifs versions.
Comment 12 Steve French 2008-08-28 17:54:59 UTC
Forgot to mention another workaround - if the server (as Samba does by default via smb.conf) can be configured to report that it does not support DFS then this also avoids the problem.
Comment 13 Steve French 2008-08-28 17:56:57 UTC
Created attachment 3514 [details]
workaround patch for older cifs.ko (turns off DFS flag in request)
Comment 14 Steve French 2008-08-28 17:57:56 UTC
Fixed in 2.6.26-rc4 and later.  Workarounds provided.  Patch for older cifs provided.  Server workaround fix also available for some servers.
Comment 15 Steve French 2008-09-04 13:26:10 UTC
*** Bug 5176 has been marked as a duplicate of this bug. ***
Comment 16 Steve French 2009-05-13 16:27:14 UTC
*** Bug 5534 has been marked as a duplicate of this bug. ***
Comment 17 Steve French 2009-05-14 17:39:06 UTC
*** Bug 4525 has been marked as a duplicate of this bug. ***