Thursday, June 18, 2015

CIFS error fixed by disabling OplockEnabled

CIFS VFS No response for cmd n mid…

On a few systems, I’ve noticed CIFS mounts have a tendency to lock up the system when transferring large files, or a shitload of small ones in quick succession. When this happens, the system may or may not completely lock up, and lines like these will appear in your syslog:
Aug 1 22:58:16 dreadnought kernel: CIFS VFS: No response to cmd 46 mid 25661 
Aug 1 22:58:16 dreadnought kernel: CIFS VFS: Send error in read = -11
Aug 1 22:58:16 dreadnought kernel: CIFS VFS: No response for cmd 50 mid 25664
Aug 1 22:58:16 dreadnought kernel: CIFS VFS: No response to cmd 47 mid 25663
Aug 1 22:58:20 dreadnought kernel: CIFS VFS: No response to cmd 47 mid 25662
Aug 1 22:58:20 dreadnought kernel: CIFS VFS: Write2 ret -11, written = 0
Aug 1 22:58:20 dreadnought kernel: CIFS VFS: Send error in read = -9
Aug 1 22:58:20 dreadnought kernel: CIFS VFS: Write2 ret -9, written = 0
Aug 1 22:59:52 dreadnought kernel: CIFS VFS: No writable handles for inode
Aug 1 23:00:29 dreadnought kernel: CIFS VFS: close with pending writes
Aug 1 23:00:36 dreadnought kernel: CIFS VFS: close with pending writes
Aug 1 23:01:16 dreadnought kernel: CIFS VFS: No writable handles for inode
Aug 1 23:02:28 dreadnought kernel: CIFS VFS: close with pending writes
Aug 1 23:03:23 dreadnought kernel: CIFS VFS: close with pending writes
Aug 1 23:03:44 dreadnought kernel: CIFS VFS: close with pending writes
Aug 1 23:05:35 dreadnought kernel: CIFS VFS: No writable handles for inode
Aug 1 23:06:18 dreadnought kernel: CIFS VFS: close with pending writes
Aug 1 23:06:35 dreadnought kernel: CIFS VFS: close with pending writes
Aug 1 23:06:46 dreadnought kernel: CIFS VFS: No writable handles for inode
Aug 1 23:06:46 dreadnought kernel: CIFS VFS: close with pending writes
Aug 1 23:07:02 dreadnought kernel: CIFS VFS: close with pending writes
Aug 1 23:07:46 dreadnought kernel: CIFS VFS: server not responding
I found a workaround which involves disabling Opportunistic Locking. This will have a small performance impact, but at least the thing wont hang up and use 100% CPU for no goddamn reason. Yes, this article has an angry tone, because this issue has eaten way too much of my time today.
To disable Opportunistic Locking, you have to set the contents of the file “/proc/fs/cifs/OplockEnabled” to 0. This file only exists after the cifs module has been loaded, and will be replaced if the module is unloaded and reloaded. Thus, I configured my /etc/rc.local script (use whatever equivalent your distro has to a startup script) to both load the cifs module and set the contents of said file:
# cifs client workaround
modprobe cifs
echo 0 > /proc/fs/cifs/OplockEnabled
There you go.

No comments:

Post a Comment