mirror of
https://github.com/samba-team/samba.git
synced 2025-01-11 05:18:09 +03:00
8b58fe2489
overkill since 1, we now kill the tcpconnections for lockd in 60.nfs 2, rpc.statd on linux sends out the notifications using the wrong interface anyway which breaks a lot of clients including linux ! use our own smnotify tool instead of sm-notify (This used to be ctdb commit 0163ad0ec01be6189a98ea91e5cec40f6750218f)
50 lines
1.5 KiB
Bash
Executable File
50 lines
1.5 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
# this script needs to be installed so that statd points to it with the -H
|
|
# command line argument. The easiest way to do that is to put something like this in
|
|
# /etc/sysconfig/nfs:
|
|
# STATD_HOSTNAME="myhostname -H /etc/ctdb/statd-callout"
|
|
|
|
. /etc/ctdb/functions
|
|
loadconfig nfs
|
|
|
|
[ -z "$STATD_SHARED_DIRECTORY" ] && exit 0
|
|
|
|
[ -d $STATD_SHARED_DIRECTORY ] || exit 0
|
|
|
|
case "$1" in
|
|
add-client)
|
|
for f in `/bin/ls /etc/ctdb/state/statd/ip/*`; do
|
|
ip=`/bin/basename $f`
|
|
[ -d $STATD_SHARED_DIRECTORY/$ip ] || /bin/mkdir $STATD_SHARED_DIRECTORY/$ip
|
|
/bin/touch $STATD_SHARED_DIRECTORY/$ip/sm/$2
|
|
done
|
|
;;
|
|
del-client)
|
|
for f in `/bin/ls /etc/ctdb/state/statd/ip/*`; do
|
|
ip=`/bin/basename $f`
|
|
/bin/rm -f $STATD_SHARED_DIRECTORY/$ip/sm/$2
|
|
done
|
|
;;
|
|
notify)
|
|
# send out notifications to any additional ips we now serve
|
|
for f in `/bin/ls /etc/ctdb/state/statd/ip/*`; do
|
|
ip=`/bin/basename $f`
|
|
[ -d $STATD_SHARED_DIRECTORY/$ip ] && [ -x /usr/bin/smnotify ] && {
|
|
/bin/rm -rf /tmp/statd/$ip
|
|
/bin/mkdir -p /tmp/statd/$ip
|
|
/bin/cp $STATD_SHARED_DIRECTORY/$ip/sm/* /tmp/statd/$ip
|
|
for g in `/bin/ls /tmp/statd/$ip/*`; do
|
|
client=`/bin/basename $g`
|
|
# send the notifications twice so we force the other
|
|
# end to recognice a state change has occured and that
|
|
# it MUST reclaim the locks.
|
|
#
|
|
/usr/bin/smnotify --client=$client --ip=$ip --server=$ip --stateval=4
|
|
/usr/bin/smnotify --client=$client --ip=$ip --server=$ip --stateval=5
|
|
done
|
|
}
|
|
done
|
|
;;
|
|
esac
|