]> git.decadent.org.uk Git - nfs-utils.git/blob - debian/patches/00git-systemd-units.patch
Import Debian patch 1:1.2.8-9.1
[nfs-utils.git] / debian / patches / 00git-systemd-units.patch
1 Description: systemd units from upstream
2 Origin: upstream, 1.3.2
3
4 Index: nfs-utils-1.2.8/systemd/README
5 ===================================================================
6 --- /dev/null
7 +++ nfs-utils-1.2.8/systemd/README
8 @@ -0,0 +1,71 @@
9 +
10 +Notes about systemd unit files for nfs-utils.
11 +
12 +The unit files provided here should be sufficient for systemd
13 +to manage all daemons and related services provides by nfs-utils.
14 +
15 +They do *not* include any unit files for separate services such as
16 +rpc.rquotad (in the 'quota' package) or rpcbind.
17 +
18 +There are 4 units that can be 'enabled' or 'disabled' by systemctl, or
19 +by a suitable 'preset' setting:
20 +
21 + nfs-server.service
22 +    If enabled, nfs service is started together with dependencies
23 +    such as mountd, statd, rpc.idmapd
24 +    This is a "service" file rather than a "target" (which is the
25 +    normal grouping construct) so that
26 +        systemctl start nfs-server
27 +    can work (if no type is given, ".service" is assumed).
28 +
29 + nfs-client.target
30 +    If enabled, daemons needs for an nfs client are enabled.
31 +    This does *not* include rpc.statd.  the rpc-statd.service unit
32 +    is started by /usr/sbin/start-statd which mount.nfs will run
33 +    if statd is needed.
34 +
35 + nfs-blkmap.target
36 +    If enabled, then blkmapd will be run when nfs-client.target is
37 +    started.
38 +
39 +Another special unit is "nfs-utils.service".  This doesn't really do
40 +anything, but exists so that other units may declare themselves as
41 +"PartOf" nfs-utils.service.
42 +The effect of this is that
43 +     systemctl restart nfs-utils
44 +will restart all nfs-utils daemons as maybe be required during
45 +software update.  It isn't possible to make
46 +     systemctl try-restart nfs-server nfs-client.target
47 +do this as some daemon are included in both, and rpc.statd would
48 +not be restarted if nfs-server were not active (as nfs-client doesn't
49 +Want it - it is started by mount.nfs running start-statd).
50 +
51 +It is possible that we should have an nfs-statd.target which can
52 +selectively enable statd being stared by -server and sm-notify
53 +being started by -server or -client.  That way it could be disabled
54 +completely on V4-only configurations.  Currently statd is always
55 +started on the server and sm-notify is always run if server or
56 +client is enabled.
57 +
58 +Stopping nfs-server will also stop rpc.mountd, and rpc.svcgssd.
59 +It cannot stop rpc.statd or rpc.gssd as they may be in use by the
60 +client and systemd cannot specify is two-pronged reverse dependency.
61 +(i.e. stop this unit if none of these units are running)
62 +
63 +Distro specific commandline configuration can be provided by
64 +installing a script /usr/lib/systemd/scripts/nfs-utils_env.sh
65 +This should write /run/sysconfig/nfs-utils based on configuration
66 +information such as in /etc/sysconfig/nfs or /etc/defaults/nfs.
67 +It is run once by nfs-config.service.
68 +
69 +rpc.gssd and rpc.svcgssd are assumed to be needed if /etc/krb5.keytab
70 +is present.
71 +If a site needs this file present but does not want the gss daemons
72 +running, it should create
73 +   /etc/systemd/system/rpc-gssd.service.d/01-disable.conf
74 +and
75 +   /etc/systemd/system/rpc-svcgssd.service.d/01-disable.conf
76 +
77 +containing
78 +   [Unit]
79 +   ConditionNull=false
80 Index: nfs-utils-1.2.8/systemd/auth-rpcgss-module.service
81 ===================================================================
82 --- /dev/null
83 +++ nfs-utils-1.2.8/systemd/auth-rpcgss-module.service
84 @@ -0,0 +1,15 @@
85 +# We want to start gss-proxy on kernels that support it and rpc.svcgssd
86 +# on those that don't.  Those services check for support by checking
87 +# for existence of the path /proc/net/rpc/use-gss-proxy.  Before they
88 +# can perform that check, they need this module loaded.  (Unless
89 +# rpcsec_gss support is built directly into the kernel, in which case this
90 +# unit will fail.  But that's OK.)
91 +[Unit]
92 +Description=Kernel Module supporting RPCSEC_GSS
93 +Before=gssproxy.service rpc-svcgssd.service rpc-gssd.service
94 +Wants=gssproxy.service rpc-svcgssd.service rpc-gssd.service
95 +ConditionPathExists=/etc/krb5.keytab
96 +
97 +[Service]
98 +Type=oneshot
99 +ExecStart=/sbin/modprobe -q auth_rpcgss
100 Index: nfs-utils-1.2.8/systemd/nfs-blkmap.service
101 ===================================================================
102 --- /dev/null
103 +++ nfs-utils-1.2.8/systemd/nfs-blkmap.service
104 @@ -0,0 +1,16 @@
105 +[Unit]
106 +Description=pNFS block layout mapping daemon
107 +DefaultDependencies=no
108 +Conflicts=umount.target
109 +After=var-lib-nfs-rpc_pipefs.mount
110 +Requires=var-lib-nfs-rpc_pipefs.mount
111 +
112 +Requisite=nfs-blkmap.target
113 +After=nfs-blkmap.target
114 +
115 +PartOf=nfs-utils.service
116 +
117 +[Service]
118 +Type=forking
119 +PIDFile=/var/run/blkmapd.pid
120 +ExecStart=/usr/sbin/blkmapd $BLKMAPDARGS
121 Index: nfs-utils-1.2.8/systemd/nfs-blkmap.target
122 ===================================================================
123 --- /dev/null
124 +++ nfs-utils-1.2.8/systemd/nfs-blkmap.target
125 @@ -0,0 +1,8 @@
126 +[Unit]
127 +Description= PNFS blkmaping enablement.
128 +# If this target is enabled, then blkmapd will be started
129 +# as required.  If it is not enabled it won't.
130 +
131 +[Install]
132 +WantedBy=remote-fs.target
133 +WantedBy=multi-user.target
134 \ No newline at end of file
135 Index: nfs-utils-1.2.8/systemd/nfs-client.target
136 ===================================================================
137 --- /dev/null
138 +++ nfs-utils-1.2.8/systemd/nfs-client.target
139 @@ -0,0 +1,17 @@
140 +[Unit]
141 +Description=NFS client services
142 +Before=remote-fs-pre.target
143 +Wants=remote-fs-pre.target
144 +
145 +# Note: we don't "Wants=rpc-statd.service" as "mount.nfs" will arrange to
146 +# start that on demand if needed.
147 +Wants=nfs-blkmap.service rpc-statd-notify.service
148 +After=nfs-blkmap.service
149 +
150 +# GSS services dependencies and ordering
151 +Wants=auth-rpcgss-module.service
152 +After=rpc-gssd.service rpc-svcgssd.service gssproxy.service
153 +
154 +[Install]
155 +WantedBy=multi-user.target
156 +WantedBy=remote-fs.target
157 Index: nfs-utils-1.2.8/systemd/nfs-config.service
158 ===================================================================
159 --- /dev/null
160 +++ nfs-utils-1.2.8/systemd/nfs-config.service
161 @@ -0,0 +1,7 @@
162 +[Unit]
163 +Description=Preprocess NFS configuration
164 +
165 +[Service]
166 +Type=oneshot
167 +RemainAfterExit=yes
168 +ExecStart=/usr/lib/systemd/scripts/nfs-utils_env.sh
169 Index: nfs-utils-1.2.8/systemd/nfs-idmapd.service
170 ===================================================================
171 --- /dev/null
172 +++ nfs-utils-1.2.8/systemd/nfs-idmapd.service
173 @@ -0,0 +1,14 @@
174 +[Unit]
175 +Description=NFSv4 ID-name mapping service
176 +Requires=var-lib-nfs-rpc_pipefs.mount
177 +After=var-lib-nfs-rpc_pipefs.mount
178 +
179 +BindsTo=nfs-server.service
180 +
181 +Wants=nfs-config.service
182 +After=nfs-config.service
183 +
184 +[Service]
185 +EnvironmentFile=-/run/sysconfig/nfs-utils
186 +Type=forking
187 +ExecStart=/usr/sbin/rpc.idmapd $RPCIDMAPDARGS
188 Index: nfs-utils-1.2.8/systemd/nfs-mountd.service
189 ===================================================================
190 --- /dev/null
191 +++ nfs-utils-1.2.8/systemd/nfs-mountd.service
192 @@ -0,0 +1,14 @@
193 +[Unit]
194 +Description=NFS Mount Daemon
195 +Requires=proc-fs-nfsd.mount
196 +After=proc-fs-nfsd.mount
197 +After=network.target
198 +BindsTo=nfs-server.service
199 +
200 +Wants=nfs-config.service
201 +After=nfs-config.service
202 +
203 +[Service]
204 +EnvironmentFile=-/run/sysconfig/nfs-utils
205 +Type=forking
206 +ExecStart=/usr/sbin/rpc.mountd $RPCMOUNTDARGS
207 Index: nfs-utils-1.2.8/systemd/nfs-server.service
208 ===================================================================
209 --- /dev/null
210 +++ nfs-utils-1.2.8/systemd/nfs-server.service
211 @@ -0,0 +1,33 @@
212 +[Unit]
213 +Description=NFS server and services
214 +Requires= network.target proc-fs-nfsd.mount rpcbind.target
215 +Requires= nfs-mountd.service
216 +Wants=rpc-statd.service nfs-idmapd.service
217 +Wants=rpc-statd-notify.service
218 +
219 +After= network.target proc-fs-nfsd.mount rpcbind.target nfs-mountd.service
220 +After= nfs-idmapd.service rpc-statd.service
221 +Before= rpc-statd-notify.service
222 +
223 +# GSS services dependencies and ordering
224 +Wants=auth-rpcgss-module.service
225 +After=rpc-gssd.service gssproxy.service rpc-svcgssd.service
226 +
227 +Wants=nfs-config.service
228 +After=nfs-config.service
229 +
230 +[Service]
231 +EnvironmentFile=-/run/sysconfig/nfs-utils
232 +
233 +Type=oneshot
234 +RemainAfterExit=yes
235 +ExecStartPre=/usr/sbin/exportfs -r
236 +ExecStart=/usr/sbin/rpc.nfsd $RPCNFSDARGS
237 +ExecStop=/usr/sbin/rpc.nfsd 0
238 +ExecStopPost=/usr/sbin/exportfs -au
239 +ExecStopPost=/usr/sbin/exportfs -f
240 +
241 +ExecReload=/usr/sbin/exportfs -r
242 +
243 +[Install]
244 +WantedBy=multi-user.target
245 Index: nfs-utils-1.2.8/systemd/nfs-utils.service
246 ===================================================================
247 --- /dev/null
248 +++ nfs-utils-1.2.8/systemd/nfs-utils.service
249 @@ -0,0 +1,17 @@
250 +[Unit]
251 +Description=NFS server and client services
252 +# This service should never be stopped, only restarted.
253 +# When it is re-started, all other services which declare
254 +# themselves to be "PartOf" this service will also be
255 +# restarted. Thus
256 +#   systemctl restart nfs-utils
257 +# will restart all daemons which are part of nfs-utils
258 +# and which are running.  This is useful after a software
259 +# update.
260 +
261 +# This is a "service" rather than "target" so that we
262 +# don't need to say "systemctl restart nfs-utils.target".
263 +[Service]
264 +Type=oneshot
265 +RemainAfterExit=yes
266 +ExecStart=/bin/true
267 Index: nfs-utils-1.2.8/systemd/proc-fs-nfsd.mount
268 ===================================================================
269 --- /dev/null
270 +++ nfs-utils-1.2.8/systemd/proc-fs-nfsd.mount
271 @@ -0,0 +1,7 @@
272 +[Unit]
273 +Description=NFSD configuration filesystem
274 +
275 +[Mount]
276 +What=nfsd
277 +Where=/proc/fs/nfsd
278 +Type=nfsd
279 Index: nfs-utils-1.2.8/systemd/rpc-gssd.service
280 ===================================================================
281 --- /dev/null
282 +++ nfs-utils-1.2.8/systemd/rpc-gssd.service
283 @@ -0,0 +1,19 @@
284 +[Unit]
285 +Description=RPC security service for NFS client and server
286 +DefaultDependencies=no
287 +Conflicts=umount.target
288 +Requires=var-lib-nfs-rpc_pipefs.mount
289 +After=var-lib-nfs-rpc_pipefs.mount
290 +
291 +ConditionPathExists=/etc/krb5.keytab
292 +
293 +PartOf=nfs-utils.service
294 +
295 +Wants=nfs-config.service
296 +After=nfs-config.service
297 +
298 +[Service]
299 +EnvironmentFile=-/run/sysconfig/nfs-utils
300 +
301 +Type=forking
302 +ExecStart=/usr/sbin/rpc.gssd $GSSDARGS
303 Index: nfs-utils-1.2.8/systemd/rpc-statd-notify.service
304 ===================================================================
305 --- /dev/null
306 +++ nfs-utils-1.2.8/systemd/rpc-statd-notify.service
307 @@ -0,0 +1,18 @@
308 +[Unit]
309 +Description=Notify NFS peers of a restart
310 +Requires=network-online.target
311 +After=network.target nss-lookup.target
312 +
313 +# if we run an nfs server, it needs to be running before we
314 +# tell clients that it has restarted.
315 +After=nfs-server.service
316 +
317 +PartOf=nfs-utils.service
318 +
319 +Wants=nfs-config.service
320 +After=nfs-config.service
321 +
322 +[Service]
323 +EnvironmentFile=-/run/sysconfig/nfs-utils
324 +Type=forking
325 +ExecStart=-/usr/sbin/sm-notify $SMNOTIFYARGS
326 Index: nfs-utils-1.2.8/systemd/rpc-statd.service
327 ===================================================================
328 --- /dev/null
329 +++ nfs-utils-1.2.8/systemd/rpc-statd.service
330 @@ -0,0 +1,17 @@
331 +[Unit]
332 +Description=NFS status monitor for NFSv2/3 locking.
333 +DefaultDependencies=no
334 +Conflicts=umount.target
335 +Requires=nss-lookup.target rpcbind.target
336 +After=network.target nss-lookup.target rpcbind.target
337 +
338 +PartOf=nfs-utils.service
339 +
340 +Wants=nfs-config.service
341 +After=nfs-config.service
342 +
343 +[Service]
344 +EnvironmentFile=-/run/sysconfig/nfs-utils
345 +Type=forking
346 +PIDFile=/var/run/rpc.statd.pid
347 +ExecStart=/usr/sbin/rpc.statd --no-notify $STATDARGS
348 Index: nfs-utils-1.2.8/systemd/rpc-svcgssd.service
349 ===================================================================
350 --- /dev/null
351 +++ nfs-utils-1.2.8/systemd/rpc-svcgssd.service
352 @@ -0,0 +1,19 @@
353 +[Unit]
354 +Description=RPC security service for NFS server
355 +Requires=var-lib-nfs-rpc_pipefs.mount
356 +After=var-lib-nfs-rpc_pipefs.mount
357 +PartOf=nfs-server.service
358 +PartOf=nfs-utils.service
359 +
360 +After=gssproxy.service
361 +ConditionPathExists=|!/run/gssproxy.pid
362 +ConditionPathExists=|!/proc/net/rpc/use-gss-proxy
363 +ConditionPathExists=/etc/krb5.keytab
364 +
365 +Wants=nfs-config.service
366 +After=nfs-config.service
367 +
368 +[Service]
369 +EnvironmentFile=-/run/sysconfig/nfs-utils
370 +Type=forking
371 +ExecStart=/usr/sbin/rpc.svcgssd $SVCGSSDARGS
372 Index: nfs-utils-1.2.8/systemd/var-lib-nfs-rpc_pipefs.mount
373 ===================================================================
374 --- /dev/null
375 +++ nfs-utils-1.2.8/systemd/var-lib-nfs-rpc_pipefs.mount
376 @@ -0,0 +1,9 @@
377 +[Unit]
378 +Description=RPC Pipe File System
379 +DefaultDependencies=no
380 +Conflicts=umount.target
381 +
382 +[Mount]
383 +What=sunrpc
384 +Where=/var/lib/nfs/rpc_pipefs
385 +Type=rpc_pipefs