Rev 410: merged from ronnie in http://samba.org/~tridge/ctdb
tridge at samba.org
tridge at samba.org
Fri Jun 1 03:29:11 GMT 2007
------------------------------------------------------------
revno: 410
revision-id: tridge at samba.org-20070601032911-4o9qwds8gfregd3p
parent: tridge at samba.org-20070531035053-dgk3sbz0t10c7v18
parent: sahlberg at ronnie-20070601032614-3ngwkhvkku56xk27
committer: Andrew Tridgell <tridge at samba.org>
branch nick: tridge
timestamp: Fri 2007-06-01 13:29:11 +1000
message:
merged from ronnie
modified:
tools/events events-20070529030121-04fjh63cxfh8v1pj-1
tools/statd-callout statdcallout-20070531010857-6sdlz455vusye5y5-1
------------------------------------------------------------
revno: 393.1.3
merged: sahlberg at ronnie-20070601032614-3ngwkhvkku56xk27
parent: sahlberg at ronnie-20070601031405-yd5dk72l9rtxciz2
committer: Ronnie Sahlberg <sahlberg at ronnie>
branch nick: ctdb
timestamp: Fri 2007-06-01 13:26:14 +1000
message:
it is -f not -x to check if a file exists
------------------------------------------------------------
revno: 393.1.2
merged: sahlberg at ronnie-20070601031405-yd5dk72l9rtxciz2
parent: sahlberg at ronnie-20070601030353-6vwmyp86x7rajbh3
committer: Ronnie Sahlberg <sahlberg at ronnie>
branch nick: ctdb
timestamp: Fri 2007-06-01 13:14:05 +1000
message:
- create /etc/ctdb/taken_ips and /etc/ctdb/changed_ips analog to the
existing /etc/ctdb/released_ips
- only call the statd-callout script if the ips have changed and call
it with a "notify" argument. we need to restart nfslock service in
both cases
- change statd-callout to explicitely restart the lock manager and statd
when "notify" is called. copy the state directory for each held ip
from shared storage to /tmp then use sm-notify to send notifications to
all monitored clients
------------------------------------------------------------
revno: 393.1.1
merged: sahlberg at ronnie-20070601030353-6vwmyp86x7rajbh3
parent: tridge at samba.org-20070530002116-kz22u8npsxt6hhom
parent: tridge at samba.org-20070531035053-dgk3sbz0t10c7v18
committer: Ronnie Sahlberg <sahlberg at ronnie>
branch nick: ctdb
timestamp: Fri 2007-06-01 13:03:53 +1000
message:
new branch from tridges tree
=== modified file 'tools/events'
--- a/tools/events 2007-05-31 01:09:45 +0000
+++ b/tools/events 2007-06-01 03:26:14 +0000
@@ -41,6 +41,9 @@
echo "Failed to add $ip/$maskbits on dev $iface"
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
/sbin/arp -d $ip 2> /dev/null
@@ -65,19 +68,27 @@
# if we have a local arp entry for this IP then remove it
/sbin/arp -d $ip 2> /dev/null
echo $ip >> /etc/ctdb/released_ips
+ echo $ip >> /etc/ctdb/changed_ips
/bin/rm -f /etc/ctdb/ip.$ip
exit 0
;;
recovered)
- # restart any services as necessary, like NFS
- #
- [ -x /etc/ctdb/statd-callout ] && /etc/ctdb/statd-callout copy
+ # if we have taken or released any ips we must send out
+ # statd notifications to recover lost nfs locks
+ [ -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 ] && {
( /sbin/service nfs status > /dev/null 2>&1 &&
/sbin/service nfs restart > /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/taken_ips
exit 0
;;
=== modified file 'tools/statd-callout'
--- a/tools/statd-callout 2007-05-31 01:14:07 +0000
+++ b/tools/statd-callout 2007-06-01 03:14:05 +0000
@@ -22,23 +22,23 @@
/bin/rm -f $STATD_SHARED_DIRECTORY/$ip/$2
done
;;
- copy)
- restart_needed=0
+ notify)
+ # 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
fname=`/bin/basename $f`
ip=`echo $fname | cut -d. -f2-`
[ -d $STATD_SHARED_DIRECTORY/$ip ] && {
- /bin/mv $STATD_SHARED_DIRECTORY/$ip $STATD_SHARED_DIRECTORY/$ip.$$
- /bin/cp -a $STATD_SHARED_DIRECTORY/$ip.$$/. /var/lib/nfs/statd/sm/
- /bin/rm -rf $STATD_SHARED_DIRECTORY/$ip.$$
- restart_needed=1
+ # we must copy to a different directory since rpc.statd gets
+ # "upset" if sm-notify touches the files.
+ /bin/rm -rf /tmp/statd/$ip
+ /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
- # 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
More information about the samba-cvs
mailing list