Page 1 of 1

Samba: "kernel BUG at fs/cifs/cifs_dfs_ref.c:274!"

Posted: Mon Oct 11, 2010 4:01 pm
by ^rooker
[PROBLEM]
Accessing a mounted samba share caused segfaults and left the following errormessage in the kernel logs (dmesg):
kernel BUG at fs/cifs/cifs_dfs_ref.c:274!
Mounting other Windows shares using Samba was working flawlessly, though.

This happened on Debian Lenny (kernel 2.6.26, Samba 2:3.2.5-4lenny11)


[SOLUTION]
The affected, problematic Samba share was a DFS, and according to kernel-changelogs, the above problem should be fixed in kernel 2.6.29:
commit e4cce94c9c8797b08faf6a79396df4d175e377fa
Author: Igor Mammedov <niallain@gmail.com>
Date: Tue Feb 10 14:10:26 2009 +0300

[CIFS] Prevent OOPs when mounting with remote prefixpath.

Fixes OOPs with message 'kernel BUG at fs/cifs/cifs_dfs_ref.c:274!'.
Checks if the prefixpath in an accesible while we are still in cifs_mount
and fails with reporting a error if we can't access the prefixpath

Should fix Samba bugs 6086 and 5861 and kernel bug 12192
In order to upgrade Debian Lenny's kernel from 2.6.26 to >= 2.6.29, you can use the Debian backports. Follow the instructions in the Debian-backports-wiki and then install the new kernel:

Code: Select all

sudo apt-get -t lenny-backports install linux-image-2.6.32-bpo.5-686
(IMPORTANT: You have to select the right package for your system architecture (i586, amd64, i686, ...)

Now reboot and make sure you're running the new kernel, by typing:

Code: Select all

uname -a
The output should look like this:
Linux ferry-1 2.6.32-bpo.5-686 #1 SMP Sun Sep 19 21:11:32 UTC 2010 i686 GNU/Linux

Windows DFS

Posted: Mon Oct 11, 2010 4:22 pm
by ^rooker
Unfortunately, DFS causes all kinds of troubles (even in Windows<->Windows situations), and is extremely unreliable (at least from what I've seen).

That's why I'm not really surprised to run into even more, unnecessary problems when connecting to a Windows 2003 server DFS, using Samba. :(
(Why do people use Windows as a server anyway?? It's just not working...)

So here are additional problems I ran into when trying to connect from Debian Lenny to a Windows "server" 2k3:

Trying to mount the DFS share, returned:
mount error 11 = Resource temporarily unavailable
Refer to the mount.cifs(8) manual page (e.g.man mount.cifs)
Output of "dmesg" revealed more information:
[ 2646.859534] CIFS VFS: dns_resolve_server_name_to_ip: unable to resolve: XXX
[ 2646.859599] CIFS VFS: cifs_compose_mount_options: Failed to resolve server part of \\XXX\L to IP: -11
[ 2646.860006] CIFS VFS: cifs_mount failed w/return code = -11
It fails to resolve the server name, although I can ping the server by its name, and "nmblookup XXX" also works fine.

Others have the same problem, and it seems to be DFS again:
Cifs mount fails when DFS referrals are used by server, keyutils needed

According to the Ubuntu-bugreport, installing "keyutils" fixed the problem:

Code: Select all

apt-get install keyutils
Might make sense, since other entries e.g. on the samba mailing list, also relate resolving issues to "keyutils".

So I've followed information from the above samba mailing list entry and added the following 2 lines to /etc/request-key.conf:

Code: Select all

create  cifs.spnego     * * /usr/sbin/cifs.upcall %k
create  dns_resolver    * * /usr/sbin/cifs.upcall %k
The result on Debian Lenny looked like this:

Code: Select all

#OP     TYPE    DESCRIPTION     CALLOUT INFO    PROGRAM ARG1 ARG2 ARG3 ...
#====== ======= =============== =============== ===============================
create  user    debug:*         negate          /bin/keyctl negate %k 30 %S
create  user    debug:loop:*    *               |/bin/cat
create  user    debug:*         *               /usr/share/keyutils/request-key-debug.sh %k %d %c %S
negate  *       *               *               /bin/keyctl negate %k 30 %S
create  cifs.spnego     *   *   /usr/sbin/cifs.upcall %k
create  dns_resolver    *   *   /usr/sbin/cifs.upcall %k
Afterwards I was able to mount the DFS shares again.
Let's see how long it lasts... ;)