1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-12 09:18:10 +03:00

merged from ronnie

(This used to be ctdb commit 21a9cf2883deb63ced58a4eb066d2d2d08cb5394)
This commit is contained in:
Andrew Tridgell 2007-06-01 13:29:11 +10:00
commit 55eeda3f22
2 changed files with 25 additions and 14 deletions

View File

@ -41,6 +41,9 @@ case $cmd in
echo "Failed to add $ip/$maskbits on dev $iface" echo "Failed to add $ip/$maskbits on dev $iface"
exit 1 exit 1
} }
echo $ip >> /etc/ctdb/taken_ips
echo $ip >> /etc/ctdb/changed_ips
# if we have a local arp entry for this IP then remove it # if we have a local arp entry for this IP then remove it
/sbin/arp -d $ip 2> /dev/null /sbin/arp -d $ip 2> /dev/null
@ -65,19 +68,27 @@ case $cmd in
# if we have a local arp entry for this IP then remove it # if we have a local arp entry for this IP then remove it
/sbin/arp -d $ip 2> /dev/null /sbin/arp -d $ip 2> /dev/null
echo $ip >> /etc/ctdb/released_ips echo $ip >> /etc/ctdb/released_ips
echo $ip >> /etc/ctdb/changed_ips
/bin/rm -f /etc/ctdb/ip.$ip /bin/rm -f /etc/ctdb/ip.$ip
exit 0 exit 0
;; ;;
recovered) recovered)
# restart any services as necessary, like NFS # if we have taken or released any ips we must send out
# # statd notifications to recover lost nfs locks
[ -x /etc/ctdb/statd-callout ] && /etc/ctdb/statd-callout copy [ -x /etc/ctdb/statd-callout ] && [ -f /etc/ctdb/changed_ips ] && {
/etc/ctdb/statd-callout notify &
} >/dev/null 2>&1
# restart NFS to ensure that all TCP connections to the released ip
# are closed
[ -f /etc/ctdb/released_ips ] && { [ -f /etc/ctdb/released_ips ] && {
( /sbin/service nfs status > /dev/null 2>&1 && ( /sbin/service nfs status > /dev/null 2>&1 &&
/sbin/service nfs restart > /dev/null 2>&1 ) & /sbin/service nfs restart > /dev/null 2>&1 ) &
} > /dev/null 2>&1 } > /dev/null 2>&1
/bin/rm -f /etc/ctdb/changed_ips
/bin/rm -f /etc/ctdb/released_ips /bin/rm -f /etc/ctdb/released_ips
/bin/rm -f /etc/ctdb/taken_ips
exit 0 exit 0
;; ;;

View File

@ -22,23 +22,23 @@ case "$1" in
/bin/rm -f $STATD_SHARED_DIRECTORY/$ip/$2 /bin/rm -f $STATD_SHARED_DIRECTORY/$ip/$2
done done
;; ;;
copy) notify)
restart_needed=0 # restart the local lock manager and statd
/sbin/service nfslock stop > /dev/null 2>&1
/sbin/service nfslock start > /dev/null 2>&1
# send out notifications to any additional ips we now serve
for f in `/bin/ls /etc/ctdb/ip.*`; do for f in `/bin/ls /etc/ctdb/ip.*`; do
fname=`/bin/basename $f` fname=`/bin/basename $f`
ip=`echo $fname | cut -d. -f2-` ip=`echo $fname | cut -d. -f2-`
[ -d $STATD_SHARED_DIRECTORY/$ip ] && { [ -d $STATD_SHARED_DIRECTORY/$ip ] && {
/bin/mv $STATD_SHARED_DIRECTORY/$ip $STATD_SHARED_DIRECTORY/$ip.$$ # we must copy to a different directory since rpc.statd gets
/bin/cp -a $STATD_SHARED_DIRECTORY/$ip.$$/. /var/lib/nfs/statd/sm/ # "upset" if sm-notify touches the files.
/bin/rm -rf $STATD_SHARED_DIRECTORY/$ip.$$ /bin/rm -rf /tmp/statd/$ip
restart_needed=1 /bin/mkdir -p /tmp/statd/$ip
/bin/cp -apr $STATD_SHARED_DIRECTORY/$ip/* /tmp/statd/$ip
/usr/sbin/sm-notify -P /tmp/statd/$ip -v $ip -n
} }
done done
# restart lockd if necessary
[ $restart_needed -eq 1 ] && {
( /sbin/service nfslock status > /dev/null 2>&1 &&
/sbin/service nfslock restart > /dev/null 2>&1 ) &
} > /dev/null 2>&1
;; ;;
esac esac