View Issue Details

IDProjectCategoryView StatusLast Update
0006495CentOS-6cifs-utilspublic2013-10-08 16:57
Reporterdddoug 
PrioritynormalSeveritymajorReproducibilityalways
Status newResolutionopen 
Product Version6.4 
Target VersionFixed in Version 
Summary0006495: Cannot list directory contents of mounted DFS share
DescriptionI can mount the DFS namespace root but I cannot list contents of any of the shares.
Steps To ReproduceI have verified I can mount and read the shares from CentOS 6.4 if accessed directly without DFS. Also I have verfied I can access the DFS shares as expected from Windows clients.

I've tested with both krb5 and ntlm authentication styles. The mount command I use is:

[root@test ~]# mount.cifs //standalonedfs/namespace test -o fstype=cifs,sec=krb5,cruid=0

This mount command completes successfully. I can enter the test folder and list the shares. However I cannot ls the shared folder. I get the error:

[root@test ~]# ls test/sharedfolder
ls: cannot open directory test/sharedfolder: Invalid argument

If I try to mount directly to the shared folder, it treats the share as a prefix and I receive this error.

[root@test ~]# mount.cifs //standalonedfs/namespace/sharedfolder test -o fstype=cifs,sec=krb5,cruid=0 --verbose
mount.cifs kernel mount options: ip=10.140.1.37,unc=\\standalonedfs\namespace,fstype=cifs,sec=krb5,cruid=0,ver=1,user=root,prefixpath=sharedfolder,pass=********
mount error(22): Invalid argument
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)
Additional InformationI have tried changing the DFS server to only return fqdn in referrals but there was no change.

http://support.microsoft.com/kb/244380


Here is a strace of the ls command:

[root@test ~]# ls test/SOUND48_C_02
ls: cannot open directory test/SOUND48_C_02: Invalid argument
[root@test ~]# strace ls test/SOUND48_C_02
execve("/bin/ls", ["ls", "test/SOUND48_C_02"], [/* 28 vars */]) = 0
brk(0) = 0x1efc000
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f8e45f6c000
access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=41709, ...}) = 0
mmap(NULL, 41709, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f8e45f61000
close(3) = 0
open("/lib64/libselinux.so.1", O_RDONLY) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0PX@\2606\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=124624, ...}) = 0
mmap(0x36b0400000, 2221912, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x36b0400000
mprotect(0x36b041d000, 2093056, PROT_NONE) = 0
mmap(0x36b061c000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1c000) = 0x36b061c000
mmap(0x36b061e000, 1880, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x36b061e000
close(3) = 0
open("/lib64/librt.so.1", O_RDONLY) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0@!\0\2606\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=47064, ...}) = 0
mmap(0x36b0000000, 2128816, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x36b0000000
mprotect(0x36b0007000, 2093056, PROT_NONE) = 0
mmap(0x36b0206000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x6000) = 0x36b0206000
close(3) = 0
open("/lib64/libcap.so.2", O_RDONLY) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0000\23\0\2616\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=19016, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f8e45f60000
mmap(0x36b1000000, 2111776, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x36b1000000
mprotect(0x36b1004000, 2093056, PROT_NONE) = 0
mmap(0x36b1203000, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x3000) = 0x36b1203000
close(3) = 0
open("/lib64/libacl.so.1", O_RDONLY) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\200\36\300\2626\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=33816, ...}) = 0
mmap(0x36b2c00000, 2126416, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x36b2c00000
mprotect(0x36b2c07000, 2093056, PROT_NONE) = 0
mmap(0x36b2e06000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x6000) = 0x36b2e06000
close(3) = 0
open("/lib64/libc.so.6", O_RDONLY) = 3
read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\360\355\1\2576\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=1922152, ...}) = 0
mmap(0x36af000000, 3745960, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x36af000000
mprotect(0x36af18a000, 2093056, PROT_NONE) = 0
mmap(0x36af389000, 20480, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x189000) = 0x36af389000
mmap(0x36af38e000, 18600, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x36af38e000
close(3) = 0
open("/lib64/libdl.so.2", O_RDONLY) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\340\r\300\2566\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=22536, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f8e45f5f000
mmap(0x36aec00000, 2109696, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x36aec00000
mprotect(0x36aec02000, 2097152, PROT_NONE) = 0
mmap(0x36aee02000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x2000) = 0x36aee02000
close(3) = 0
open("/lib64/libpthread.so.0", O_RDONLY) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0`\\@\2576\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=145720, ...}) = 0
mmap(0x36af400000, 2212768, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x36af400000
mprotect(0x36af417000, 2097152, PROT_NONE) = 0
mmap(0x36af617000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x17000) = 0x36af617000
mmap(0x36af619000, 13216, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x36af619000
close(3) = 0
open("/lib64/libattr.so.1", O_RDONLY) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\200\23\0\2646\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=21152, ...}) = 0
mmap(0x36b4000000, 2113888, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x36b4000000
mprotect(0x36b4004000, 2093056, PROT_NONE) = 0
mmap(0x36b4203000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x3000) = 0x36b4203000
close(3) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f8e45f5e000
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f8e45f5c000
arch_prctl(ARCH_SET_FS, 0x7f8e45f5c7a0) = 0
mprotect(0x36b061c000, 4096, PROT_READ) = 0
mprotect(0x36b0206000, 4096, PROT_READ) = 0
mprotect(0x36b2e06000, 4096, PROT_READ) = 0
mprotect(0x36af389000, 16384, PROT_READ) = 0
mprotect(0x36aee02000, 4096, PROT_READ) = 0
mprotect(0x36aea1f000, 4096, PROT_READ) = 0
mprotect(0x36af617000, 4096, PROT_READ) = 0
mprotect(0x36b4203000, 4096, PROT_READ) = 0
munmap(0x7f8e45f61000, 41709) = 0
set_tid_address(0x7f8e45f5ca70) = 2196
set_robust_list(0x7f8e45f5ca80, 0x18) = 0
futex(0x7fff34a8c52c, FUTEX_WAKE_PRIVATE, 1) = 0
futex(0x7fff34a8c52c, FUTEX_WAIT_BITSET_PRIVATE|FUTEX_CLOCK_REALTIME, 1, NULL, 7f8e45f5c7a0) = -1 EAGAIN (Resource temporarily unavailable)
rt_sigaction(SIGRTMIN, {0x36af405ae0, [], SA_RESTORER|SA_SIGINFO, 0x36af40f500}, NULL, 8) = 0
rt_sigaction(SIGRT_1, {0x36af405b70, [], SA_RESTORER|SA_RESTART|SA_SIGINFO, 0x36af40f500}, NULL, 8) = 0
rt_sigprocmask(SIG_UNBLOCK, [RTMIN RT_1], NULL, 8) = 0
getrlimit(RLIMIT_STACK, {rlim_cur=10240*1024, rlim_max=RLIM_INFINITY}) = 0
statfs("/selinux", {f_type=0xf97cff8c, f_bsize=4096, f_blocks=0, f_bfree=0, f_bavail=0, f_files=0, f_ffree=0, f_fsid={0, 0}, f_namelen=255, f_frsize=4096}) = 0
brk(0) = 0x1efc000
brk(0x1f1d000) = 0x1f1d000
open("/usr/lib/locale/locale-archive", O_RDONLY) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=99158576, ...}) = 0
mmap(NULL, 99158576, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f8e400cb000
close(3) = 0
ioctl(1, SNDCTL_TMR_TIMEBASE or TCGETS, {B38400 opost isig icanon echo ...}) = 0
ioctl(1, TIOCGWINSZ, {ws_row=24, ws_col=80, ws_xpixel=720, ws_ypixel=528}) = 0
stat("test/SOUND48_C_02", {st_mode=S_IFDIR|0711, st_size=0, ...}) = 0
open("test/SOUND48_C_02", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = -1 EINVAL (Invalid argument)
open("/usr/share/locale/locale.alias", O_RDONLY) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=2512, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f8e45f6b000
read(3, "# Locale name alias data base.\n#"..., 4096) = 2512
read(3, "", 4096) = 0
close(3) = 0
munmap(0x7f8e45f6b000, 4096) = 0
open("/usr/share/locale/en_US.UTF-8/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en_US.utf8/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en_US/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en.UTF-8/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en.utf8/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en/LC_MESSAGES/coreutils.mo", O_RDONLY) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=435, ...}) = 0
mmap(NULL, 435, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f8e45f6b000
close(3) = 0
write(2, "ls: ", 4ls: ) = 4
write(2, "cannot open directory test/SOUND"..., 39cannot open directory test/SOUND48_C_02) = 39
open("/usr/share/locale/en_US.UTF-8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en_US.utf8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en_US/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en.UTF-8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en.utf8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
write(2, ": Invalid argument", 18: Invalid argument) = 18
write(2, "\n", 1
) = 1
close(1) = 0
close(2) = 0
exit_group(2) = ?
TagsNo tags attached.

Activities

dddoug

dddoug

2013-06-10 18:54

reporter   ~0017545

kernel.x86_64 2.6.32-358.6.2.el6
cifs-utils.x86_64 4.8.1-18.el6
jfn

jfn

2013-10-08 15:42

reporter   ~0018167

I was able to mount a DFS share following the steps below. This was gleaned from the instructions at http://mikemstech.blogspot.be/2012/10/how-to-mount-dfs-share-in-linux.html

1. Make sure "yum install samba-client cifs-utils".


2. Create /etc/request-key.d/dns_resolver.conf with the following
contents:

create dns_resolver * * /usr/sbin/cifs.upcall %k


3. And just mount the share the usual way with something similar to

mount -t cifs //standalonedfs/namespace /mnt -o ro,username=windows_username


As an additional feature, I am also able to specify a folder deeper in the share tree as the source service. For instance, instead of "//standalonedfs/namespace" I can use "//standalonedfs/namespace/deeper/folder".

I take no credit for this solution. I just found it on the net. It worked for me.
dddoug

dddoug

2013-10-08 16:57

reporter   ~0018168

Thanks. dns_resolver was part of the solution and also I found that actimeo=0 is needed to reliably use ls on DFS.

via Steve French of linux-cifs list:

This is a tough issue - if you are doing an ls immediately followed by
a cd into the dfs link. We plan to ask Microsoft next week if they
have any ideas how to detect the following sequence - ls of directory
which contains dfs link (client caches the dfs link for one second
thinking it is a directory), client cd into directory. The problem
we have is that many variants of "ls" can potentially cause 1000s of
stat calls to be sent over the network for one ls (queyrpathinfo or
open/query/close) if we don't cache the output of readdir (SMB
FindFirst/FindNext), but if we do cache then we can mistake a
directory for a dfs link. If that is the problem that you are running
into - the obvious solution is to turn off metadata attribute caching
(set actimeo=0 on mount). Jeff suggested a patch which would prevent
us from caching information on directories which is returned from
FindFirst but that could cause a substantial degradation in
performance - and we have not researched the alternatives (higher
levels of FindFirst and QueryDir that may return hints we can use to
decide whether to cache such as different "LinkCount" or EA size or
some such).

Issue History

Date Modified Username Field Change
2013-06-10 18:36 dddoug New Issue
2013-06-10 18:54 dddoug Note Added: 0017545
2013-10-08 15:42 jfn Note Added: 0018167
2013-10-08 16:57 dddoug Note Added: 0018168