xref: /freebsd/usr.sbin/nfsd/stablerestart.5 (revision b1f9167f94059fd55c630891d359bcff987bd7eb)
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.\" $FreeBSD$
26.\"
27.Dd April 10, 2011
28.Dt STABLERESTART 5
29.Os
30.Sh NAME
31.Nm nfs-stablerestart
32.Nd restart information for the
33.Tn NFSv4
34server
35.Sh SYNOPSIS
36.Nm nfs-stablerestart
37.Sh DESCRIPTION
38The
39.Nm
40file holds information that allows the
41.Tn NFSv4
42server to restart without always returning the NFSERR_NOGRACE error, as described in the
43.Tn NFSv4
44server specification; see
45.%T "Network File System (NFS) Version 4 Protocol RFC 3530, Section 8.6.3" .
46.Pp
47The first record in the file, as defined by struct nfsf_rec in
48/usr/include/fs/nfs/nfsrvstate.h, holds the lease duration of the
49last incarnation of the server and the number of boot times that follows.
50Following this are the number of previous boot times listed in the
51first record.
52The lease duration is used to set the grace period.
53The boot times
54are used to avoid the unlikely occurrence of a boot time being reused,
55due to a TOD clock going backwards. This record and the previous boot times with this boot time added is re-written at the
56end of the grace period.
57.Pp
58The rest of the file are appended records, as defined by
59struct nfst_rec in /usr/include/fs/nfs/nfsrvstate.h and are used
60represent one of two things. There are records which indicate that a
61client successfully acquired state and records that indicate a client's state was revoked.
62State revoke records indicate that state information
63for a client was discarded, due to lease expiry and an otherwise
64conflicting open or lock request being made by a different client.
65These records can be used
66to determine if clients might have done either of the
67edge conditions.
68.Pp
69If a client might have done either edge condition or this file is
70empty or corrupted, the server returns NFSERR_NOGRACE for any reclaim
71request from the client.
72.Pp
73For correct operation of the server, it must be ensured that the file
74is written to stable storage by the time a write op with IO_SYNC specified
75has returned. This might require hardware level caching to be disabled for
76a local disk drive that holds the file, or similar.
77.Sh FILES
78.Bl -tag -width /var/db/nfs-stablerestart.bak -compact
79.It Pa /var/db/nfs-stablerestart
80NFSv4 stable restart file
81.It Pa /var/db/nfs-stablerestart.bak
82backup copy of the file
83.El
84.Sh SEE ALSO
85.Xr nfsv4 4 ,
86.Xr nfsd 8
87.Sh BUGS
88If the file is empty, the NFSv4 server has no choice but to return
89NFSERR_NOGRACE for all reclaim requests. Although correct, this is
90a highly undesirable occurrence, so the file should not be lost if
91at all possible. The backup copy of the file is maintained
92and used by the
93.Xr nfsd 8
94to minimize the risk of this occurring.
95To move the file, you must edit
96the nfsd sources and recompile it. This was done to discourage
97accidental relocation of the file.
98