Red Hat Bugzilla – Bug 490887
CIFS: kernel panic if mounting a symlink
Last modified: 2014-06-18 03:38:48 EDT
OpenVZ linux kernel team has found that mounting CIFS subdirectory (allowed by POSIX extensions enabled by default) which is a symlink on the CIFS server leads to the kernel panic.
* assume server HOSTNAME shares the directory A via CIFS
* assume A has a symlink S inside
* following commands will crash the client node:
# mount -t cifs //HOSTNAME/A/S /mnt
# cd /mnt
1) This crash can be avoided by disabling POSIX extensions before mounting:
# modprobe cifs
# echo 0 > /proc/fs/cifs/LinuxExtensionsEnabled
2) Another workaround:
CIFS POSIX extensions can be disabled for single mount by undocumnted option "nounix":
# mount -t cifs //HOSTNAME/A/S /mnt -o nounix
3) The long-term workaround might be in disabling by default POSIX extensions in kernel:
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c
index 4c1c4f3..0005d16 100644
@@ -63,7 +63,7 @@ int cifsERROR = 1;
int traceSMB = 0;
unsigned int oplockEnabled = 1;
unsigned int experimEnabled = 0;
-unsigned int linuxExtEnabled = 1;
+unsigned int linuxExtEnabled = 0;
unsigned int lookupCacheEnabled = 1;
unsigned int multiuser_mount = 0;
unsigned int extended_security = CIFSSEC_DEF;
Hope this helps.
This seems to be fixed in the latest series of patches that I have queued up for RHEL5. The latest patchset makes the kernel return an error when you try to mount a symlink like this (-EINVAL, I think). Most likely, it got fixed when some other problems with directly mounting DFS referrals got fixed.
If you have someplace you can do so, could you confirm whether you're still able to reproduce this with the test kernels I have here:
Confirm, this issue is fixed in 2.6.18-135.el5.jtltest.69 kernel.
# uname -a
Linux hostname 2.6.18-135.el5.jtltest.69 #1 SMP Wed Mar 18 11:25:06 EDT 2009 x86_64 x86_64 x86_64 GNU/Linux
# mount -t cifs //host/dir/symlink /mnt
mount error 22 = Invalid argument
Refer to the mount.cifs(8) manual page (e.g.man mount.cifs)
Thank you, hope this will be included into release kernel soon.
*** This bug has been marked as a duplicate of bug 465143 ***