]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
improve the handling of hosts to notify with statd
authorRonnie Sahlberg <sahlberg@ronnie>
Thu, 6 Sep 2007 01:30:49 +0000 (11:30 +1000)
committerRonnie Sahlberg <sahlberg@ronnie>
Thu, 6 Sep 2007 01:30:49 +0000 (11:30 +1000)
(This used to be ctdb commit cc87bda7e344bc777b9620a6211e62de4dce4e3b)

ctdb/config/events.d/60.nfs
ctdb/config/statd-callout

index b7033ba8d68f599597968503dbf967308fabc4de..311e9f2ef4982b408cffb5c4b4fe32fa3ca3c573 100755 (executable)
@@ -15,8 +15,8 @@ PATH=/usr/bin:/bin:/usr/sbin:/sbin:$PATH
 case $cmd in 
      startup)
        /bin/mkdir -p /etc/ctdb/state/nfs
-       /bin/mkdir -p ${STATD_SHARED_DIRECTORY}/${PUBLIC_IP}
        /bin/mkdir -p /etc/ctdb/state/statd/ip
+       /bin/mkdir -p $STATD_SHARED_DIRECTORY
        ctdb_wait_directories "nfslock" "$STATD_SHARED_DIRECTORY"
 
 
index 0c61c4a27ec4a0377eeb4b08779c7f4768af89b5..6f097be9f65eb7e5279486c2e3e01964b0aca4d3 100755 (executable)
@@ -14,16 +14,20 @@ loadconfig nfs
 
 case "$1" in
   add-client)
+       # the callout does not tell us to which ip the client connected
+       # so we must add it to all the ips that we serve
         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
+           /bin/touch $STATD_SHARED_DIRECTORY/$ip/$2
        done
        ;;
   del-client)
+       # the callout does not tell us to which ip the client connected
+       # so we must add it to all the ips that we serve
         for f in `/bin/ls /etc/ctdb/state/statd/ip/*`; do
            ip=`/bin/basename $f`
-           /bin/rm -f $STATD_SHARED_DIRECTORY/$ip/sm/$2
+           /bin/rm -f $STATD_SHARED_DIRECTORY/$ip/$2
        done
        ;;
   notify)
@@ -31,10 +35,7 @@ case "$1" in
         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
+               for g in `/bin/ls $STATD_SHARED_DIRECTORY/$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
@@ -42,6 +43,7 @@ case "$1" in
                        #
                        /usr/bin/smnotify --client=$client --ip=$ip --server=$ip --stateval=4
                        /usr/bin/smnotify --client=$client --ip=$ip --server=$ip --stateval=5
+                       /bin/rm -f $g
                done
            }
        done