Bug#638157: nfs-common: NFSv4 hung up other progams when the server disconnected.
Package: nfs-common
Version: 1:1.2.2-4
Severity: normal
When the network file server is shut down or disconnected, nfs daemon makes
other programs in client hung up when they access directories. Unless manually
unmount the directory by 'sudo umount -fl /media/nfs.'
Programs that shows hung up includes: df, ls, vlc, and etc. Opening files
freezes the program. autofs5 doesn't handle the server disconnection
gracefully.
Secondly it prevents pm-suspend putting the system in sleep mode.
Nov 27 17:24:46 theblue kernel: [66832.357238] [<ffffffffa051cc76>]
nfs_revalidate_inode+0x36/0x60 [nfs]
Nov 27 17:24:46 theblue kernel: [66832.357248] [<ffffffffa051d34f>]
nfs_getattr+0x5f/0x110 [nfs]
Nov 27 17:24:46 theblue kernel: [66832.357251] [<ffffffff811426fe>]
vfs_getattr+0x4e/0x80
Nov 27 17:24:46 theblue kernel: [66832.357254] [<ffffffff811427a0>]
vfs_fstatat+0x70/0x90
Nov 27 17:24:46 theblue kernel: [66832.357258] [<ffffffff810f141f>] ?
free_pages+0x4f/0x60
Nov 27 17:24:46 theblue kernel: [66832.357260] [<ffffffff8114289b>]
vfs_stat+0x1b/0x20
Nov 27 17:24:46 theblue kernel: [66832.357263] [<ffffffff811428c4>]
sys_newstat+0x24/0x50
Nov 27 17:24:46 theblue kernel: [66832.357267] [<ffffffff815309ab>]
system_call_fastpath+0x16/0x1b
I added extra options "nolock,_netdev,proto=tcp,hart" to fix pm-suspend and hung-up problem in /etc/fstab followed by:
# mini 192.168.1.101
mini:/archive /media/nfs nfs
nolock,_netdev,proto=tcp,hard,intr,rsize=8192,wsize
=8192 0 0
Also created a NFS mount daemon script that checks the server is alive.
/usr/local/bin/nfs-mount
#!/bin/bash
# 11/28/2011
# Trouble shooting of NFS hung by pm-suspend, df, other programs when NFS is dow
n.
# The hostname or IP-address of the fileserver:
# IP is 192.168.1.101
NFS="mini"
# Check every X seconds (60 is a good default):
INTERVAL=60
# The shares that need to be mounted:
SHARED_DIR="/archive"
MOUNT_DIR="/media/nfs"
while true; do
ping -c 1 "$NFS" &>/dev/null
if [ $? -eq 0 ]; then
# Fileserver is up.
logger "File server: $NFS is up."
# mount -t nfs ${NFS}:${SHARED_DIR} ${MOUNT_DIR}
mount ${NFS}:${SHARED_DIR}
else
# Fileserver is down.
logger "Fileserver: $NFS is down."
umount -fl ${MOUNT_DIR}
if [ $? -eq 0 ]; then
logger "$MOUNT_DIR" unmouted.
else
logger "$MOUNT_DIR" unmouting failed.
fi
fi
sleep $INTERVAL
done
## end of nfs-mount
-- System Information:
Debian Release: 6.0.3
APT prefers stable
APT policy: (1001, 'stable'), (650, 'testing'), (500, 'stable-updates')
Architecture: amd64 (x86_64)
Kernel: Linux 2.6.39amd64hp (SMP w/2 CPU cores; PREEMPT)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Versions of packages nfs-common depends on:
ii adduser 3.112+nmu2 add and remove users and groups
ii initscripts 2.88dsf-13.1 scripts for initializing and shutt
ii libc6 2.11.2-10 Embedded GNU C Library: Shared lib
ii libcap2 1:2.19-3 support for getting/setting POSIX.
ii libcomerr2 1.41.12-4stable1 common error description library
ii libevent-1.4-2 1.4.13-stable-1 An asynchronous event notification
ii libgssapi-krb5-2 1.8.3+dfsg-4squeeze2 MIT Kerberos runtime libraries - k
ii libgssglue1 0.1-4 mechanism-switch gssapi library
ii libk5crypto3 1.8.3+dfsg-4squeeze2 MIT Kerberos runtime libraries - C
ii libkrb5-3 1.8.3+dfsg-4squeeze2 MIT Kerberos runtime libraries
ii libnfsidmap2 0.23-2 An nfs idmapping library
ii librpcsecgss3 0.19-2 allows secure rpc communication us
ii libwrap0 7.6.q-19 Wietse Venema's TCP wrappers libra
ii lsb-base 3.2-23.2squeeze1 Linux Standard Base 3.2 init scrip
ii netbase 4.45 Basic TCP/IP networking system
ii portmap 6.0.0-2 RPC port mapper
ii ucf 3.0025+nmu1 Update Configuration File: preserv
nfs-common recommends no packages.
nfs-common suggests no packages.
-- no debconf information
Reply to: