|
root / base / usr / src / zyginit / services / nfs-lockd
nfs-lockd Plain Text 42 lines 1.2 KB
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# NFS lock manager (RPC program 100021). Implements NLM v3 locking;
# both client and server need it. Must wait for statd to register
# before lockd can attach to it.
# Replaces /lib/svc/manifest/network/nfs/nlockmgr.xml.
[service]
name = "nfs-lockd"
description = "NFS lock manager (lockd)"
type = "daemon"
[exec]
start = "/etc/zyginit/services/nfs-lockd/start.sh"
[dependencies]
requires = ["rpcbind", "nfs-statd"]
[restart]
on = "failure"
delay = 5
max_retries = 3
[contract]
param = ["inherit", "noorphan"]
fatal = ["hwerr"]
#!/bin/sh
# Wait until statd has registered an RPC address. The kernel's NLM
# code expects to find statd at attach time; without this wait,
# lockd can fail noisily on first call.
#
# Use absolute paths for every command — first-boot-of-fresh-deploy can
# transiently fail bare-command lookups under I/O pressure. See
# [[zyginit-service-empty-path]] and the swap/start.sh precedent
# (commit 87e9f19f69).  PATH= kept as defense-in-depth.
PATH=/usr/sbin:/usr/bin:/sbin:/bin
export PATH

i=0
while ! /usr/bin/rpcinfo -T tcp 127.0.0.1 status >/dev/null 2>&1; do
    i=$((i + 1))
    [ $i -gt 30 ] && {
        /bin/echo "statd never registered after 30s" >&2
        exit 1
    }
    /bin/sleep 1
done
exec /usr/lib/nfs/lockd