Bug 9346 - Directories on CIFS shares shown as ordinary files
Summary: Directories on CIFS shares shown as ordinary files
Status: NEW
Alias: None
Product: CifsVFS
Classification: Unclassified
Component: kernel fs (show other bugs)
Version: 3.x
Hardware: All Linux
: P5 major
Target Milestone: ---
Assignee: Steve French
QA Contact: cifs QA contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-11-01 19:13 UTC by Dominik Schramm
Modified: 2020-12-19 16:20 UTC (History)
6 users (show)

See Also:


Attachments
CIFS mount of remote server as seen through Samba share on Samba 3.2 server (954 bytes, application/octet-stream)
2012-11-01 19:13 UTC, Dominik Schramm
no flags Details
CIFS mount of remote server as seen through Samba share on Samba 3.6 server (2.34 KB, application/octet-stream)
2012-11-01 19:14 UTC, Dominik Schramm
no flags Details
local directory on Samba 3.6 server (954 bytes, application/octet-stream)
2012-11-01 19:15 UTC, Dominik Schramm
no flags Details
smbd -b (v3.6.9) (12.07 KB, text/plain)
2012-11-02 08:06 UTC, Dominik Schramm
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Dominik Schramm 2012-11-01 19:13:11 UTC
Created attachment 8129 [details]
CIFS mount of remote server as seen through Samba share on Samba 3.2 server

find_first2 in Samba 3.6.3 (Ubuntu 12.04) and 3.6.9 (latest stable on November 1st, self-compiled) presents a directory as an ordinary file (file attribute directory bit 0) if it resides on a CIFS mount. With directories local to the Samba server the directory bit is 1 as it should be.

This might also be a problem in mount.cifs!

I added as attachments tcpdumps (pcap format) for a connection to the samba 3.2 server and to the Samba 3.6 server for the CIFS and the local directories. If needed I can supply them in any export format Wiresharp or (I suppose) tcpdump offers.

(PCAP "")

root@log002:~# mount -t cifs
...
//sas003/testshare on /mnt/testshare type cifs (rw)
...
root@log002:~# ls -lai /mnt/testshare/
total 5
792352059440498915 drwxr-xr-x 1 root root    0 Nov  1 13:28 .
            917508 drwxr-xr-x 8 root root 4096 Nov  1 13:29 ..
             81745 drwxr-xr-x 0 root root    0 Nov  1 13:27 dir1
             81746 drwxr-xr-x 0 root root    0 Nov  1 13:28 dir2
             81747 -rwxr-xr-x 1 root root   15 Nov  1 13:27 file1.txt
             81748 -rwxr-xr-x 1 root root   22 Nov  1 13:28 file2.txt
root@log002:~# ls -lai /mnt/testshare/dir1
total 1
             81739 drwxr-xr-x 1 root root  0 Nov  1 13:27 .
792352059440498915 drwxr-xr-x 1 root root  0 Nov  1 13:28 ..
             81744 -rwxr-xr-x 1 root root 15 Nov  1 13:27 file_in_dir1.txt
root@log002:~# 

Note the difference between the inode numbers for dir1! However, when the share is mounted with the option "serverino", the inodes are okay, but Samba still behaves the same:

root@log002:~# mount.cifs //sas003/testshare /mnt/testshare -o serverino,user=administrator
root@log002:~# ls -lai /mnt/testshare/
total 5
792352059440498915 drwxr-xr-x 1 root root    0 Nov  1 13:28 .
            917508 drwxr-xr-x 8 root root 4096 Nov  1 13:29 ..
             81970 drwxr-xr-x 0 root root    0 Nov  1 13:27 dir1
             81971 drwxr-xr-x 0 root root    0 Nov  1 13:28 dir2
             81972 -rwxr-xr-x 1 root root   15 Nov  1 13:27 file1.txt
             81973 -rwxr-xr-x 1 root root   22 Nov  1 13:28 file2.txt
root@log002:~# ls -lai /mnt/testshare/dir1
total 1
             81970 drwxr-xr-x 1 root root  0 Nov  1 13:27 .
792352059440498915 drwxr-xr-x 1 root root  0 Nov  1 13:28 ..
             81974 -rwxr-xr-x 1 root root 15 Nov  1 13:27 file_in_dir1.txt
root@log002:~#

/tmp/noncifs/ is a local directory, and Samba serves it fine:

root@log002:~# ls -lai /tmp/noncifs/
total 24
156 drwxr-xr-x 4 root root 4096 Nov  1 19:18 .
 13 drwxrwxrwt 6 root root 4096 Nov  1 19:17 ..
157 drwxr-xr-x 2 root root 4096 Nov  1 13:27 dir1
159 drwxr-xr-x 2 root root 4096 Nov  1 13:28 dir2
160 -rwxr-xr-x 1 root root   15 Nov  1 13:27 file1.txt
161 -rwxr-xr-x 1 root root   22 Nov  1 13:28 file2.txt
root@log002:~# ls -lai /tmp/noncifs/dir1
total 12
157 drwxr-xr-x 2 root root 4096 Nov  1 13:27 .
156 drwxr-xr-x 4 root root 4096 Nov  1 19:18 ..
158 -rwxr-xr-x 1 root root   15 Nov  1 13:27 file_in_dir1.txt
root@log002:~#
Comment 1 Dominik Schramm 2012-11-01 19:14:25 UTC
Created attachment 8130 [details]
CIFS mount of remote server as seen through Samba share on Samba 3.6 server
Comment 2 Dominik Schramm 2012-11-01 19:15:05 UTC
Created attachment 8131 [details]
local directory on Samba 3.6 server
Comment 3 Dominik Schramm 2012-11-02 08:06:02 UTC
Created attachment 8132 [details]
smbd -b (v3.6.9)
Comment 4 Dominik Schramm 2012-11-02 08:10:54 UTC
I put the very long output of "smbd -b" into an attachment.

I've just realized that cifs-utils is in its own project now; I'll try to compile the latest version of mount.cifs and try again with that.

Here is the smb.conf used for the test cases mentioned above:

[global]
    netbios name = log002
    workgroup = INTERNAL
    server string = Log+Share Access
    pid directory = /var/run/samba
    lock directory = /var/cache/samba
    max log size = 0
    log file = /var/log/samba/%m.log
    log level = 10 smb:10 acls:10 ntlm:0
    debug timestamp = yes
    debug prefix timestamp = yes
    debug pid = yes
    encrypt passwords = yes
    bind interfaces only = yes
    interfaces = 10.18.16.82/255.255.248.0
    socket address = 10.18.16.82
    private dir = /etc/samba/private.nexmart
    username map = /etc/samba/private.nexmart/smbusers
    # smb passwd file = /etc/samba/private.nexmart/smbpasswd
    # passdb backend = tdbsam:/var/lib/samba/passdb.tdb

    # level2 oplocks = yes
    posix locking = yes
    # oplocks = no
    # kernel oplocks = yes
    dead time = 15
    getwd cache = no

    mangled names = no
    hide unreadable = yes

    usershare path = /var/run/samba/usershares
    security = share
    socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192
    load printers = no

    wide links = yes
    allow insecure wide links = yes
    follow symlinks = yes
    unix extensions = yes

[noncifs]
    comment = Test Share (non-CIFS)
    browseable = yes
    writable = no
    public = yes
    guest ok = yes
    path = /tmp/noncifs
    force user = root
    force group = root
    oplocks = yes
    locking = no
    blocking locks = no

[testthis]
    comment = Test Share on sas003
    browseable = yes
    writable = no
    public = yes
    guest ok = yes
    path = /mnt/testshare
    force user = root
    force group = root
    oplocks = yes
    locking = no
    blocking locks = no
Comment 5 Dominik Schramm 2012-11-02 08:27:53 UTC
I compiled cifs-utils, especially mount.cifs, version 5.7 from scratch. The resulting behavior of Samba is the same as before!

root@log002:~/cifs-utils-5.7# /sbin/mount.cifs -V
mount.cifs version: 5.7
root@log002:~/cifs-utils-5.7#

root@log002:~/cifs-utils-5.7# /sbin/mount.cifs //sas003/testshare /mnt/testshare -o serverino,user=administrator
Password for administrator@//sas003/testshare:
root@log002:~/cifs-utils-5.7#

root@log002:~/cifs-utils-5.7# ls -lai /mnt/testshare/
total 5
792352059440498915 drwxr-xr-x 1 root root    0 Nov  1 13:28 .
            917508 drwxr-xr-x 8 root root 4096 Nov  1 13:29 ..
             82015 drwxr-xr-x 0 root root    0 Nov  1 13:27 dir1
             82016 drwxr-xr-x 0 root root    0 Nov  1 13:28 dir2
             82017 -rwxr-xr-x 1 root root   15 Nov  1 13:27 file1.txt
             82018 -rwxr-xr-x 1 root root   22 Nov  1 13:28 file2.txt
root@log002:~/cifs-utils-5.7# ls -lai /mnt/testshare/dir1
total 1
             82015 drwxr-xr-x 1 root root  0 Nov  1 13:27 .
792352059440498915 drwxr-xr-x 1 root root  0 Nov  1 13:28 ..
             82019 -rwxr-xr-x 1 root root 15 Nov  1 13:27 file_in_dir1.txt
root@log002:~/cifs-utils-5.7#
Comment 6 Dominik Schramm 2012-11-03 10:46:37 UTC
The problem is also reproducible using Samba 4.0.0beta8.

Here's what the share looks like on Windows BTW:

C:\>dir \\10.18.16.82\testthis
 Datenträger in Laufwerk \\10.18.16.82\testthis: ist testthis
 Volumeseriennummer: 2CC5-381F

 Verzeichnis von \\10.18.16.82\testthis

01.11.2012  13:28    <DIR>          .
01.11.2012  13:29    <DIR>          ..
01.11.2012  13:27                 0 dir1
01.11.2012  13:28                 0 dir2
01.11.2012  13:27                15 file1.txt
01.11.2012  13:28                22 file2.txt
               4 Datei(en)             37 Bytes
               2 Verzeichnis(se),  3.271.406.592 Bytes frei

C:\>

smbclient (v3.x and v4.0.0beta8 behave the same) on the Samba server displays:

root@log002:~# /usr/local/samba4/bin/smbclient //log002/testthis -U dominik.schramm
Enter dominik.schramm's password:
Domain=[INTERNAL] OS=[Unix] Server=[Samba 4.0.0beta8]
smb: \> dir
  .                                   D        0  Thu Nov  1 13:28:24 2012
  ..                                  D        0  Thu Nov  1 13:29:23 2012
  dir1                                         0  Thu Nov  1 13:27:59 2012
  dir2                                         0  Thu Nov  1 13:28:04 2012
  file1.txt                           A       15  Thu Nov  1 13:27:43 2012
  file2.txt                           A       22  Thu Nov  1 13:28:32 2012

                64636 blocks of size 131072. 24958 blocks available
smb: \> 
root@log002:~#
Comment 7 Dominik Schramm 2012-11-03 11:48:29 UTC
Well, well, well, it's not a regression. I tested the access with Samba 3.0.37 and 3.2.15. In both cases, the result is the same: directories being recognized/displayed as files. 

I suppose this means that this is not at all a Samba bug.

***
Could you at least point me into the right direction? Would it be sensible to test for a bug in cifs-utils, or must this be a bug in the kernel's CIFS implementation?
***
Comment 8 Dominik Schramm 2012-11-04 15:57:01 UTC
I made several other tests: I ran Samba versions 3.6.9 and 3.2 on a newly compiled Linux kernel 3.6.5 with a brandnew cifs VFS module. The result is the same: the CIFS mount directory looks good on the Samba server (with the exception of the hard links number), but the Windows client accessing the Samba share sees only four plain files, not two directories and two ordinary files:

root@log002:~# uname -a
Linux log002 3.6.5DOS #12 SMP Sun Nov 4 15:09:14 CET 2012 x86_64 x86_64 x86_64 GNU/Linux
root@log002:~# mount.cifs -V
mount.cifs version: 5.7
root@log002:~# mount.cifs //sas003/testshare /mnt/testshare -o serverino,user=administrator
Password for administrator@//sas003/testshare:
root@log002:~# ls -lai /mnt/testshare/
total 5
792352059440498915 drwxr-xr-x 2 root root    0 Nov  1 13:28 .
            917508 drwxr-xr-x 8 root root 4096 Nov  1 13:29 ..
                 3 drwxr-xr-x 0 root root    0 Nov  1 13:27 dir1
                 4 drwxr-xr-x 0 root root    0 Nov  1 13:28 dir2
                 5 -rwxr-xr-x 1 root root   15 Nov  1 13:27 file1.txt
                 6 -rwxr-xr-x 1 root root   22 Nov  1 13:28 file2.txt
root@log002:~# ls -lai /mnt/testshare/dir1
total 1
                 3 drwxr-xr-x 2 root root  0 Nov  1 13:27 .
792352059440498915 drwxr-xr-x 2 root root  0 Nov  1 13:28 ..
                 7 -rwxr-xr-x 1 root root 15 Nov  1 13:27 file_in_dir1.txt
root@log002:~# stat /mnt/testshare/dir1
  File: `/mnt/testshare/dir1'
  Size: 0               Blocks: 0          IO Block: 16384  directory
Device: 13h/19d Inode: 3           Links: 2
Access: (0755/drwxr-xr-x)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2012-11-04 16:50:36.564250000 +0100
Modify: 2012-11-01 13:27:59.035250000 +0100
Change: 2012-11-01 13:27:59.035250000 +0100
 Birth: -
root@log002:~#
root@log002:~# smbclient //log002/testthis
Enter root's password: (empty)
Domain=[INTERNAL] OS=[Unix] Server=[Samba 3.6.3]
Server not using user level security and no password supplied.
smb: \> dir
  .                                   D        0  Thu Nov  1 13:28:24 2012
  ..                                  D        0  Thu Nov  1 13:29:23 2012
  dir1                                         0  Thu Nov  1 13:27:59 2012
  dir2                                         0  Thu Nov  1 13:28:04 2012
  file1.txt                           A       15  Thu Nov  1 13:27:43 2012
  file2.txt                           A       22  Thu Nov  1 13:28:32 2012

                64636 blocks of size 131072. 24954 blocks available
smb: \> cd dir1
smb: \dir1\> dir
  .                                   D        0  Thu Nov  1 13:27:59 2012
  ..                                  D        0  Thu Nov  1 13:28:24 2012
  file_in_dir1.txt                    A       15  Thu Nov  1 13:27:43 2012

                64636 blocks of size 131072. 24954 blocks available
smb: \dir1\>
root@log002:~#

***
This is something, in my opinion, that should be fixed inside Samba, which is currently unusable for us. Both ls and stat report "dir1" as being a directory, however Samba presents it as an ordinary file, as shown by the smbclient session above.

I changed the importance from "Regression" to "Major".
***
Comment 9 Dominik Schramm 2012-11-06 07:38:36 UTC
I tried out a workaround: by patching fs/cifs/inode.c (affecting the CIFS mount on the Samba server, which is then reexported by Samba) to make the number of hard links for a directory always 2 (regardless of the number of subdirectories) instead of always 0 (this is the current behavior of kernel module cifs). Samba then recognizes directories as directories and delivers them correctly to the client.

However, I still think that Samba should rely on other things than hard link number to determine the directory status of a file system object. I can't find the place in Samba where this is done, though, otherwise I would suggest a Samba patch!

$ diff -bBc linux-3.6.5_ORIG/fs/cifs/inode.c linux-3.6.5/fs/cifs/inode.c
*** linux-3.6.5_ORIG/fs/cifs/inode.c 2012-10-31 18:11:22.000000000 +0100
--- linux-3.6.5/fs/cifs/inode.c 2012-11-05 13:53:28.801008518 +0100
***************
*** 132,137 ****
--- 132,140 ----
        inode->i_mtime = fattr->cf_mtime;
        inode->i_ctime = fattr->cf_ctime;
        inode->i_rdev = fattr->cf_rdev;
+       if (fattr->cf_cifsattrs & ATTR_DIRECTORY)
+               set_nlink(inode, 2);
+       else
                set_nlink(inode, fattr->cf_nlink);
        inode->i_uid = fattr->cf_uid;
        inode->i_gid = fattr->cf_gid;
$
Comment 10 timwetter 2012-11-10 01:48:03 UTC
I have the same issue on fedora 17:

uname -a 
3.6.6-1.fc17.x86_64 #1 SMP Mon Nov 5 21:59:35 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux

rpm -qa | grep ^samba-
samba-client-3.6.8-95.fc17.1.x86_64
samba-3.6.8-95.fc17.1.x86_64
samba-swat-3.6.8-95.fc17.1.x86_64
samba-common-3.6.8-95.fc17.1.x86_64
samba-domainjoin-gui-3.6.8-95.fc17.1.x86_64
samba-winbind-3.6.8-95.fc17.1.x86_64
samba-winbind-krb5-locator-3.6.8-95.fc17.1.x86_64
samba-winbind-clients-3.6.8-95.fc17.1.x86_64
samba-doc-3.6.8-95.fc17.1.x86_64

I'll try the workaround from Dominik Schramm (Comment 9), but I don't know if I get the kernel recompiled on fc17. Or how to recompile only the cifs-module?
Comment 11 timwetter 2012-11-11 00:50:26 UTC
structure:
windows computer with shared folder -> mount share on linux computer to local folder -> share this (local) folder with samba -> access this samba share with third comnputers

i have recompiled the self-patched kernel module "cifs" from package "kernel-3.6.6-1.fc17.src.rpm" as described by Dominik Schramm.

the result:

- i can mount a windows (samba) share on linux.
  mount -t cifs -o .... //192.168.100.1/Bla /media/Serverdata

- i can share this to a linux folder mounted share with samba server again.
  [ServerData]
    comment = Serverdata from linux
    browseable = yes
    writable = yes
    public = yes
    guest ok = yes
    path = /media/Serverdata
    force user = root
    force group = root

- access with third computers:
  before patching: folders on the mounted cifs share were shown as files from samba server

  after patching: folders on the mounted cifs share are shown as folders from samba server
Comment 12 J Peters 2013-04-03 17:09:30 UTC
This issue is present in OL6u4.

Details for OL6u4 CIFS and Samba packaging,

[root@OL6u4 ~]# rpm -qi cifs-utils
Name : cifs-utils Relocations: (not relocatable)
Version : 4.8.1 Vendor: Oracle America
Release : 18.el6 Build Date: Wed 19 Dec 2012 11:15:16 PM MST
Install Date: Thu 07 Mar 2013 01:40:03 PM MST Build Host: ca-buildj3.us.oracle.com
Group : System Environment/Daemons Source RPM: cifs-utils-4.8.1-18.el6.src.rpm
Size : 138662 License: GPLv3
Signature : RSA/8, Thu 20 Dec 2012 11:52:49 PM MST, Key ID 72f97b74ec551f03
URL : http://linux-cifs.samba.org/cifs-utils/
Summary : Utilities for mounting and managing CIFS mounts
Description :
The SMB/CIFS protocol is a standard file sharing protocol widely deployed
on Microsoft Windows machines. This package contains tools for mounting
shares on Linux using the SMB/CIFS protocol. The tools in this package
work in conjunction with support in the kernel to allow one to mount a
SMB/CIFS share onto a client and use it as if it were a standard Linux
file system.

[root@OL6u4 ~]# rpm -qi samba
Name : samba Relocations: (not relocatable)
Version : 3.6.9 Vendor: Oracle America
Release : 151.el6 Build Date: Sat 23 Feb 2013 08:24:36 AM MST
Install Date: Thu 07 Mar 2013 03:10:20 PM MST Build Host: ca-build19.us.oracle.com
Group : System Environment/Daemons Source RPM: samba-3.6.9-151.el6.src.rpm
Size : 18601349 License: GPLv3+ and LGPLv3+
Signature : RSA/8, Sun 24 Feb 2013 01:37:56 AM MST, Key ID 72f97b74ec551f03
URL : http://www.samba.org/
Summary : Server and Client software to interoperate with Windows machines
Description :

Samba is the suite of programs by which a lot of PC-related machines
share files, printers, and other information (such as lists of
available files and printers). The Windows NT, OS/2, and Linux
operating systems support this natively, and add-on packages can
enable the same thing for DOS, Windows, VMS, UNIX of all kinds, MVS,
and more. This package provides an SMB/CIFS server that can be used to
provide network services to SMB/CIFS clients.
Samba uses NetBIOS over TCP/IP (NetBT) protocols and does NOT
need the NetBEUI (Microsoft Raw NetBIOS frame) protocol.

[root@OL6u4 ~]# modinfo cifs
filename: /lib/modules/2.6.39-400.17.1.el6uek.x86_64/kernel/fs/cifs/cifs.ko
version: 1.74
description: VFS to access servers complying with the SNIA CIFS Specification e.g. Samba and Windows
license: GPL
author: Steve French <sfrench@us.ibm.com>
srcversion: F9729A66029DE5FBE62B669
depends:
vermagic: 2.6.39-400.17.1.el6uek.x86_64 SMP mod_unload modversions
parm: CIFSMaxBufSize:Network buffer size (not including header). Default: 16384 Range: 8192 to 130048 (int)
parm: cifs_min_rcv:Network buffers in pool. Default: 4 Range: 1 to 64 (int)
parm: cifs_min_small:Small network buffers in pool. Default: 30 Range: 2 to 256 (int)
parm: cifs_max_pending:Simultaneous requests to server. Default: 50 Range: 2 to 256 (int)
parm: echo_retries:Number of echo attempts before giving up and reconnecting server. Default: 5. 0 means never reconnect. (ushort)

OL6u3 does not have this issue.

Details for OL6u3 CIFS and Samba packaging,

[root@OL6u3 ~]# rpm -qi cifs-utils
Name        : cifs-utils                   Relocations: (not relocatable)
Version     : 4.8.1                             Vendor: Oracle America
Release     : 10.el6                        Build Date: Wed 20 Jun 2012 07:25:27 PM MDT
Install Date: Tue 02 Apr 2013 02:19:32 PM MDT      Build Host: ca-build19.us.oracle.com
Group       : System Environment/Daemons    Source RPM: cifs-utils-4.8.1-10.el6.src.rpm
Size        : 85891                            License: GPLv3
Signature   : RSA/8, Fri 22 Jun 2012 03:00:21 PM MDT, Key ID 72f97b74ec551f03
URL         : http://linux-cifs.samba.org/cifs-utils/
Summary     : Utilities for mounting and managing CIFS mounts
Description :
The SMB/CIFS protocol is a standard file sharing protocol widely deployed
on Microsoft Windows machines. This package contains tools for mounting
shares on Linux using the SMB/CIFS protocol. The tools in this package
work in conjunction with support in the kernel to allow one to mount a
SMB/CIFS share onto a client and use it as if it were a standard Linux
file system.

[root@OL6u3 ~]# rpm -qi samba
Name        : samba                        Relocations: (not relocatable)
Version     : 3.5.10                            Vendor: Oracle America
Release     : 125.el6                       Build Date: Thu 21 Jun 2012 05:13:28 AM MDT
Install Date: Tue 02 Apr 2013 02:19:02 PM MDT      Build Host: ca-build19.us.oracle.com
Group       : System Environment/Daemons    Source RPM: samba-3.5.10-125.el6.src.rpm
Size        : 18257410                         License: GPLv3+ and LGPLv3+
Signature   : RSA/8, Fri 22 Jun 2012 03:00:35 PM MDT, Key ID 72f97b74ec551f03
URL         : http://www.samba.org/
Summary     : Server and Client software to interoperate with Windows machines
Description :

Samba is the suite of programs by which a lot of PC-related machines
share files, printers, and other information (such as lists of
available files and printers). The Windows NT, OS/2, and Linux
operating systems support this natively, and add-on packages can
enable the same thing for DOS, Windows, VMS, UNIX of all kinds, MVS,
and more. This package provides an SMB/CIFS server that can be used to
provide network services to SMB/CIFS clients.
Samba uses NetBIOS over TCP/IP (NetBT) protocols and does NOT
need the NetBEUI (Microsoft Raw NetBIOS frame) protocol.

[root@OL6u3 ~]# modinfo cifs
filename:       /lib/modules/2.6.39-200.24.1.el6uek.x86_64/kernel/fs/cifs/cifs.ko
version:        1.74
description:    VFS to access servers complying with the SNIA CIFS Specification e.g. Samba and Windows
license:        GPL
author:         Steve French <sfrench@us.ibm.com>
srcversion:     B8A5D216E18678EF304760A
depends:
vermagic:       2.6.39-200.24.1.el6uek.x86_64 SMP mod_unload modversions
parm:           CIFSMaxBufSize:Network buffer size (not including header). Default: 16384 Range: 8192 to 130048 (int)
parm:           cifs_min_rcv:Network buffers in pool. Default: 4 Range: 1 to 64 (int)
parm:           cifs_min_small:Small network buffers in pool. Default: 30 Range: 2 to 256 (int)
parm:           cifs_max_pending:Simultaneous requests to server. Default: 50 Range: 2 to 256 (int)
parm:           echo_retries:Number of echo attempts before giving up and reconnecting server. Default: 5. 0 means never reconnect. (ushort)
Comment 13 Ihryll 2013-04-11 10:05:55 UTC
Is there some investigation to verify if it's a cifs-util or kernel module bug related ?
Comment 14 Dominik Schramm 2013-04-12 07:43:45 UTC
(In reply to comment #13)
> Is there some investigation to verify if it's a cifs-util or kernel module bug
> related ?

Yes, there is. See comments 12 and 9 especially, and the link to the kernel bugzilla. The fact that the hard-link count is wrong is a kernel module bug (cifs).

However, I consider it a Samba bug that Samba bases determining the file system object type on the hard-link count!
Comment 15 Frieder Buerzele 2013-04-24 16:00:00 UTC
I can confirm this bug hitting us.

our setup:

* server1 exports the share /path/share_server1
* server2 mounts this share from samba server1 with cifs on
  /path/share_server2/mt_share_server1
* server2 exports the share /path/share_server2
* windows xp/7 client mounts the share 'share_server2'
  from samba server2.

->> Result: windows is only able to see files instead of directories
  below 'share_server2/mt_share_server1'

Samba version used on:
* server1 samba: version 3.6.12-44.el5
* server2 samba: version 3.6.12 (gentoo)
Comment 16 Rob Janssen 2013-06-19 01:50:08 UTC
I can confirm too.

Setup:

Host A: Windows 2003 X64
Host B: Debian
Host C: Windows 8 X64

media:~# uname -a
Linux media 3.2.0-4-686-pae #1 SMP Debian 3.2.46-1 i686 GNU/Linux
media:~# mount.cifs -V
mount.cifs version: 5.5
media:~# modinfo cifs
filename:       /lib/modules/3.2.0-4-686-pae/kernel/fs/cifs/cifs.ko
version:        1.76
description:    VFS to access servers complying with the SNIA CIFS Specification e.g. Samba and Windows
license:        GPL
author:         Steve French <sfrench@us.ibm.com>
srcversion:     8D1CA839678EA581DF1BE08
depends:        fscache
intree:         Y
vermagic:       3.2.0-4-686-pae SMP mod_unload modversions 686 
parm:           CIFSMaxBufSize:Network buffer size (not including header). Default: 16384 Range: 8192 to 130048 (int)
parm:           cifs_min_rcv:Network buffers in pool. Default: 4 Range: 1 to 64 (int)
parm:           cifs_min_small:Small network buffers in pool. Default: 30 Range: 2 to 256 (int)
parm:           cifs_max_pending:Simultaneous requests to server. Default: 32767 Range: 2 to 32767. (int)
parm:           echo_retries:Number of echo attempts before giving up and reconnecting server. Default: 5. 0 means never reconnect. (ushort)
parm:           enable_oplocks:Enable or disable oplocks (bool). Default:y/Y/1 (bool)

All directories show up as files :(
Comment 17 Victor Ashik 2013-06-26 14:42:50 UTC
I can confirm this bug in Samba 3.6.3-2ubuntu2.6 (12.04) and Samba 4.0.6-1 ArchiLinux (up to date). I did some network packet capturing and have found that Samba is loosing file attribute 0x10 indicating directories.
Comment 18 staskorz 2013-11-19 15:12:27 UTC
The related bug report (52791) in kernel.org's bugzilla (https://bugzilla.kernel.org/show_bug.cgi?id=52791) was closed as "will not fix", saying it's a Samba bug, quoting:

This appears to be a samba bug. It should be testing with S_ISDIR(). Setting up i_nlink might be nice but you would have to set it correctly to account for all the subdirectories or it'll confuse other software much of which treats "0" as "undefined" and avoids optimisations.


Also 2.6.32 is a completely obsolete kernel!

Closing as will not fix, but if you do cook up a full patch that gets i_nlink right for the subdirectory count then go for it.
--

Following is the link for the closing comment:

https://bugzilla.kernel.org/show_bug.cgi?id=52791#c3
Comment 19 soubok 2013-12-29 19:17:05 UTC
I confirm the bug with samba 3.6.6 -> cifs 5.5 -> windows XP
Please can you help me to locate the place in the code where samba uses hard-link count to determine if a file system object is a directory.
Thanks.