xref: /freebsd/usr.sbin/nfsd/stablerestart.5 (revision 8aac90f18aef7c9eea906c3ff9a001ca7b94f375)
1.\" Copyright (c) 2009 Rick Macklem, University of Guelph
2.\" All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\"    notice, this list of conditions and the following disclaimer.
9.\" 2. Redistributions in binary form must reproduce the above copyright
10.\"    notice, this list of conditions and the following disclaimer in the
11.\"    documentation and/or other materials provided with the distribution.
12.\"
13.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23.\" SUCH DAMAGE.
24.\"
25.Dd April 10, 2011
26.Dt STABLERESTART 5
27.Os
28.Sh NAME
29.Nm nfs-stablerestart
30.Nd restart information for the
31.Tn NFSv4
32server
33.Sh SYNOPSIS
34.Nm nfs-stablerestart
35.Sh DESCRIPTION
36The
37.Nm
38file holds information that allows the
39.Tn NFSv4
40server to restart without always returning the NFSERR_NOGRACE error, as described in the
41.Tn NFSv4
42server specification; see
43.%T "Network File System (NFS) Version 4 Protocol RFC 3530, Section 8.6.3" .
44.Pp
45The first record in the file, as defined by struct nfsf_rec in
46/usr/include/fs/nfs/nfsrvstate.h, holds the lease duration of the
47last incarnation of the server and the number of boot times that follows.
48Following this are the number of previous boot times listed in the
49first record.
50The lease duration is used to set the grace period.
51The boot times
52are used to avoid the unlikely occurrence of a boot time being reused,
53due to a TOD clock going backwards.
54This record and the previous boot times with this boot time
55added is re-written at the end of the grace period.
56.Pp
57The rest of the file are appended records, as defined by
58struct nfst_rec in /usr/include/fs/nfs/nfsrvstate.h and are used represent one of two things.
59There are records which indicate that a
60client successfully acquired state and records that indicate a client's state was revoked.
61State revoke records indicate that state information
62for a client was discarded, due to lease expiry and an otherwise
63conflicting open or lock request being made by a different client.
64These records can be used to determine if clients might have done either of the
65edge conditions.
66.Pp
67If a client might have done either edge condition or this file is
68empty or corrupted, the server returns NFSERR_NOGRACE for any reclaim
69request from the client.
70.Pp
71For correct operation of the server, it must be ensured that the file
72is written to stable storage by the time a write op with IO_SYNC specified has returned.
73This might require hardware level caching to be disabled for
74a local disk drive that holds the file, or similar.
75.Sh FILES
76.Bl -tag -width /var/db/nfs-stablerestart.bak -compact
77.It Pa /var/db/nfs-stablerestart
78NFSv4 stable restart file
79.It Pa /var/db/nfs-stablerestart.bak
80backup copy of the file
81.El
82.Sh SEE ALSO
83.Xr nfsv4 4 ,
84.Xr nfsd 8
85.Sh BUGS
86If the file is empty, the NFSv4 server has no choice but to return
87NFSERR_NOGRACE for all reclaim requests.
88Although correct, this is a highly undesirable occurrence, so the file should not be lost if
89at all possible.
90The backup copy of the file is maintained and used by the
91.Xr nfsd 8
92to minimize the risk of this occurring.
93To move the file, you must edit the nfsd sources and recompile it.
94This was done to discourage accidental relocation of the file.
95