Skip to content

Commit

Permalink
Medium: nfsserver: fix monitor for systemd
Browse files Browse the repository at this point in the history
use the number of nfsd threads for monitor instead of systemctl when using systemctl and running nfsd process.
The systemctl doesn't monitor the running kernel process like nfsd.
So if nfsd process is failure, nfsserver_monitor doesn't detect it.
  • Loading branch information
ytakeshita committed Feb 3, 2016
1 parent 0174fb1 commit 5b7476a
Showing 1 changed file with 33 additions and 1 deletion.
34 changes: 33 additions & 1 deletion heartbeat/nfsserver
Original file line number Diff line number Diff line change
Expand Up @@ -293,10 +293,42 @@ v3locking_exec()
fi
}

nfsserver_systemd_monitor()
{
local threads_num
local rc

nfs_exec is-active
rc=$?

# Now systemctl is-active can't detect the failure of kernel process like nfsd.
# So, if the return value of systemctl is-active is 0, check the threads number
# to make sure the process is running really.
# /proc/fs/nfsd/threads has the numbers of the nfsd threads.
if [ $rc -eq 0 ]; then
threads_num=`cat /proc/fs/nfsd/threads 2>/dev/null`
if [ $? -eq 0 ]; then
if [ $threads_num -gt 0 ]; then
return $OCF_SUCCESS
else
return 3
fi
else
return $OCF_ERR_GENERIC
fi
fi

return $rc
}

nfsserver_monitor ()
{
set_exec_mode
fn=`mktemp`
nfs_exec status > $fn 2>&1
case $EXEC_MODE in
1) nfs_exec status > $fn 2>&1;;
[23]) nfsserver_systemd_monitor > $fn 2>&1;;
esac
rc=$?
ocf_log debug "$(cat $fn)"
rm -f $fn
Expand Down

0 comments on commit 5b7476a

Please sign in to comment.