source: gpfs_3.1_ker2.6.20/lpp/mmfs/samples/nfscluster/start.nfs @ 214

Last change on this file since 214 was 16, checked in by rock, 17 years ago
  • Property svn:executable set to *
File size: 2.6 KB
Line 
1#!/bin/ksh
2# @(#)67  1.13.1.10  src/avs/fs/mmfs/samples/nfscluster/start.nfs, mmfs, avs_rgpfs24, rgpfs24s010a 2/16/07 02:32:51
3#
4# start.nfs <GPFS_IP_ADDRESS>
5#
6
7if [ ! -f /var/mmfs/etc/nfsfuncs ]; then
8    echo "$0: Can't find NFS functions in /var/mmfs/etc"
9    exit 0
10fi
11. /var/mmfs/etc/nfsfuncs
12
13myip=$1
14[ "$myip" == "" ] && myip=$(myGPFSIP)
15[ "$myip" != "" ] || die "Usage: start.nfs <GPFS IP address>"
16
17debugmsg "start.nfs called with ip=$myip"
18
19# Setup
20rotatelog
21_unlink /tmp/ha-nfs-reboot
22
23configHA $myip
24[ $? -ne 0 ] && die "start.nfs: configHA failed"
25
26# did we mount any of the exported fs
27isAnyExported
28[ $? -ne 0 ] && die "start.nfs: mount failed"
29
30# Clear any old locks in Linux.
31resetLockd
32
33# Set nfsd proc fs, used for grace control
34debuglog mount -t nfsd nfsd /proc/fs/nfsd
35
36# Stop NFSD before doing failback
37debuglog rpc.nfsd 0
38
39# Is this a failback?
40[ $iptakeover -eq 1 ] && IPfailback $myip
41
42# Bring up all nfs ip address
43nfsips=$(getNfsIPs $myip)
44msg "Enabling interface(s) for IP address(es) $nfsips"
45
46typeset -i connections=0
47while true; do
48    for ip in $nfsips; do
49  ifUp $ip
50  iface=$(getifname $ip)
51  checkLinkStatus $iface
52  if [ $? -ne 1 ]; then
53      gwIP=$(route -n |awk '/UG/ {print $2}')
54      if [ -n "$gwIP" ]; then
55    ping -c 1 -w 5 $gwIP > /dev/null
56    if [ $? -ne 0 ]; then
57        debugmsg "Failed to ping the gateway at $gwIP"
58    else
59        connections=1
60    fi
61      else
62    connections=1
63      fi
64  fi
65    done
66    if [ $connections -eq 0 ]; then
67  sleep 10
68    else
69  break
70    fi
71done
72
73# Start nfs server.
74debuglog umount /proc/fs/nfsd
75nfsService start
76
77_mkdir $SHARED_RECOVERY/$myip
78
79# takeover nodes that were recovered by this node before failing
80for failed_node in $(ls -A $SHARED_RECOVERY/$myip 2> /dev/null); do
81    debugmsg "Do recovery for node $failed_node at $myip start up"
82    IPtakeover $myip $failed_node
83done
84
85# takeover nodes that are not up
86next=$(getNextNode $myip $myip)
87debugmsg check other nodes starting with $next
88while [ -n "$next" ]; do
89    isNodeUp $next
90    if [ $? -ne 0 ]; then
91  # was already on my list and was handled above
92  if [ ! -f $SHARED_RECOVERY/$myip/$next ]; then
93     isNodeUp $next
94     if [ $? -ne 0 ]; then
95        touch $SHARED_RECOVERY/$myip/$next
96        sleep 10
97        if [ -f $SHARED_RECOVERY/$myip/$next ]; then
98           isNodeUp $next
99           if [ $? -ne 0 ]; then
100        debugmsg "Do start recovery for node $next"
101        IPtakeover $myip $next
102                    next=$(getNextNode $next $myip)
103                    continue
104           fi
105        fi
106     fi
107  fi
108    fi
109    break
110done
111
112
113# reclaim locks
114startReclaim $myip
115backupSmDir /tmp/statd
116
117if [ $monitor -eq 1 ]; then
118    nfsmonitor -s
119fi
120exit 0
Note: See TracBrowser for help on using the repository browser.