Re-export of smb mounted share displays incorrect filetype

Jim McDonough jmcd at
Fri Aug 23 08:55:54 MDT 2013

On Thu, Aug 22, 2013 at 6:43 PM, Dion Stempfley
<dion.stempfley at> wrote:
> I have an application  that requires me to mount an SMB share from a
> netdisk and then re-export it with samba to other systems.  I know that
> sounds convoluted, but that's what I am working with.
> Has anyone had any success with this type of configuration?  I've seen
> notes in the archive about other filesystems like nfs but not smb.
> The linux system I am using is Fedora release 19.  The client systems:
> Windows, Mac OS X, or Linux all have problems when they map the shared
> drive from linux.
> The mount of the files from the netdisk to the linux system work fine.
>  Here is my /etc/fstab entry:
> //netdisk1/dion /mnt/dion cifs
> uid=1000,gid=1000,dir_mode=0777,file_mode=0777,iocharset=utf8,
> credentials=/etc/samba/credentials/,auto 0 0
> Then the filesystem is shared in the smb.conf as:
> [dion]
> path = /mnt/dion
> read only = No
> browsable = Yes
> guest ok = no
> force user = nobody
> When I map the dion share from a windows system, all of the directories
> look like files.  I can create a directory, but it will also look like a
> zero length file.  From a command prompt, I can cd to one of the
> directories, but windows explorer will not.
> Here is the output from a cmd.exe on a windows file system:
> Z:\>mkdir test
> Z:\>dir
>  Volume in drive Z is dion
>  Volume Serial Number is 476A-1FC3
>  Directory of Z:\
> 08/10/2013  12:18 PM    <DIR>          .
> 07/15/2013  01:42 PM    <DIR>          ..
> 06/27/2013  04:56 PM                 0 Troubleshooting
> 11/22/2012  12:39 AM                 0 .bash_history
> 08/20/2013  05:57 PM                 0 Documents
> 06/27/2013  02:11 PM                 0 Network Trash Folder
> 06/27/2013  04:57 PM                 0 Tools
> 08/22/2013  05:45 PM                 0 test
> 06/27/2013  02:11 PM                 0 Temporary Items
> 06/27/2013  04:56 PM                 0 .ssh
>                8 File(s)          0 bytes
>                2 Dir(s)  1,982,047,387,648 bytes free
> Z:\>
> I'm kind of out of ideas for where to look.  It seems like it should work
> but it doesn't.

Yah, I'm currently working on this one.  The problem comes from two
places: first, we refuse to continue to create the dos modebits
because the st_nlink from stat() comes back with 0.  However, cifsfs
itself shouldn't be causing this, but somehow it's happening.

When running the stat command, the directory will have the directory
bit on, plus number of links will read 1, which should be sufficient.
but upon examining an strace of this, the stat command calls lstat(),
while smbd calls stat(), resulting in what appears to be conflicting

This can be reproduced using only smbd, cifs, and smbclient.  Turning
off unix extensions on the cifs mount will trigger it.  connecting to
the re-exported smbd with smbclient, doing an "ls" will show the bug.
However, doing an "ls <dirname> will not.

I'm currently at a conference but should be back to it next week.

Jim McDonough
Samba Team
SUSE labs
jmcd at samba dot org
jmcd at themcdonoughs dot org

More information about the samba-technical mailing list