xref: /freebsd/usr.sbin/nfsd/stablerestart.5 (revision fa9896e082a1046ff4fbc75fcba4d18d1f2efc19)
120d0a5e5SRick Macklem.\" Copyright (c) 2009 Rick Macklem, University of Guelph
220d0a5e5SRick Macklem.\" All rights reserved.
320d0a5e5SRick Macklem.\"
420d0a5e5SRick Macklem.\" Redistribution and use in source and binary forms, with or without
520d0a5e5SRick Macklem.\" modification, are permitted provided that the following conditions
620d0a5e5SRick Macklem.\" are met:
720d0a5e5SRick Macklem.\" 1. Redistributions of source code must retain the above copyright
820d0a5e5SRick Macklem.\"    notice, this list of conditions and the following disclaimer.
920d0a5e5SRick Macklem.\" 2. Redistributions in binary form must reproduce the above copyright
1020d0a5e5SRick Macklem.\"    notice, this list of conditions and the following disclaimer in the
1120d0a5e5SRick Macklem.\"    documentation and/or other materials provided with the distribution.
1220d0a5e5SRick Macklem.\"
1320d0a5e5SRick Macklem.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
1420d0a5e5SRick Macklem.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1520d0a5e5SRick Macklem.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1620d0a5e5SRick Macklem.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
1720d0a5e5SRick Macklem.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1820d0a5e5SRick Macklem.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
1920d0a5e5SRick Macklem.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2020d0a5e5SRick Macklem.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2120d0a5e5SRick Macklem.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2220d0a5e5SRick Macklem.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2320d0a5e5SRick Macklem.\" SUCH DAMAGE.
2420d0a5e5SRick Macklem.\"
259d12ecf0SRick Macklem.Dd April 10, 2011
2620d0a5e5SRick Macklem.Dt STABLERESTART 5
2720d0a5e5SRick Macklem.Os
2820d0a5e5SRick Macklem.Sh NAME
2920d0a5e5SRick Macklem.Nm nfs-stablerestart
30f3253445SEdward Tomasz Napierala.Nd restart information for the
31f3253445SEdward Tomasz Napierala.Tn NFSv4
32f3253445SEdward Tomasz Napieralaserver
3320d0a5e5SRick Macklem.Sh SYNOPSIS
3420d0a5e5SRick Macklem.Nm nfs-stablerestart
3520d0a5e5SRick Macklem.Sh DESCRIPTION
3620d0a5e5SRick MacklemThe
3720d0a5e5SRick Macklem.Nm
3820d0a5e5SRick Macklemfile holds information that allows the
391f5dd95bSEdward Tomasz Napierala.Tn NFSv4
401f5dd95bSEdward Tomasz Napieralaserver to restart without always returning the NFSERR_NOGRACE error, as described in the
411f5dd95bSEdward Tomasz Napierala.Tn NFSv4
4220d0a5e5SRick Macklemserver specification; see
4325c8b07fSUlrich Spörlein.%T "Network File System (NFS) Version 4 Protocol RFC 3530, Section 8.6.3" .
4420d0a5e5SRick Macklem.Pp
4520d0a5e5SRick MacklemThe first record in the file, as defined by struct nfsf_rec in
4620d0a5e5SRick Macklem/usr/include/fs/nfs/nfsrvstate.h, holds the lease duration of the
4720d0a5e5SRick Macklemlast incarnation of the server and the number of boot times that follows.
4820d0a5e5SRick MacklemFollowing this are the number of previous boot times listed in the
4920d0a5e5SRick Macklemfirst record.
501f5dd95bSEdward Tomasz NapieralaThe lease duration is used to set the grace period.
5120d0a5e5SRick MacklemThe boot times
5220d0a5e5SRick Macklemare used to avoid the unlikely occurrence of a boot time being reused,
53*ad5e10ecSGordon Berglingdue to a TOD clock going backwards.
54*ad5e10ecSGordon BerglingThis record and the previous boot times with this boot time
55*ad5e10ecSGordon Berglingadded is re-written at the end of the grace period.
5620d0a5e5SRick Macklem.Pp
5720d0a5e5SRick MacklemThe rest of the file are appended records, as defined by
58*ad5e10ecSGordon Berglingstruct nfst_rec in /usr/include/fs/nfs/nfsrvstate.h and are used represent one of two things.
59*ad5e10ecSGordon BerglingThere are records which indicate that a
60f6ac2391SJoel Dahlclient successfully acquired state and records that indicate a client's state was revoked.
6120d0a5e5SRick MacklemState revoke records indicate that state information
6220d0a5e5SRick Macklemfor a client was discarded, due to lease expiry and an otherwise
6320d0a5e5SRick Macklemconflicting open or lock request being made by a different client.
64*ad5e10ecSGordon BerglingThese records can be used to determine if clients might have done either of the
6520d0a5e5SRick Macklemedge conditions.
6620d0a5e5SRick Macklem.Pp
6720d0a5e5SRick MacklemIf a client might have done either edge condition or this file is
6820d0a5e5SRick Macklemempty or corrupted, the server returns NFSERR_NOGRACE for any reclaim
6920d0a5e5SRick Macklemrequest from the client.
7020d0a5e5SRick Macklem.Pp
7120d0a5e5SRick MacklemFor correct operation of the server, it must be ensured that the file
72*ad5e10ecSGordon Berglingis written to stable storage by the time a write op with IO_SYNC specified has returned.
73*ad5e10ecSGordon BerglingThis might require hardware level caching to be disabled for
7420d0a5e5SRick Macklema local disk drive that holds the file, or similar.
7520d0a5e5SRick Macklem.Sh FILES
769d12ecf0SRick Macklem.Bl -tag -width /var/db/nfs-stablerestart.bak -compact
7720d0a5e5SRick Macklem.It Pa /var/db/nfs-stablerestart
781f5dd95bSEdward Tomasz NapieralaNFSv4 stable restart file
799d12ecf0SRick Macklem.It Pa /var/db/nfs-stablerestart.bak
809d12ecf0SRick Macklembackup copy of the file
8120d0a5e5SRick Macklem.El
8220d0a5e5SRick Macklem.Sh SEE ALSO
831f5dd95bSEdward Tomasz Napierala.Xr nfsv4 4 ,
8420d0a5e5SRick Macklem.Xr nfsd 8
8520d0a5e5SRick Macklem.Sh BUGS
861f5dd95bSEdward Tomasz NapieralaIf the file is empty, the NFSv4 server has no choice but to return
87*ad5e10ecSGordon BerglingNFSERR_NOGRACE for all reclaim requests.
88*ad5e10ecSGordon BerglingAlthough correct, this is a highly undesirable occurrence, so the file should not be lost if
89*ad5e10ecSGordon Berglingat all possible.
90*ad5e10ecSGordon BerglingThe backup copy of the file is maintained and used by the
919d12ecf0SRick Macklem.Xr nfsd 8
929d12ecf0SRick Macklemto minimize the risk of this occurring.
93*ad5e10ecSGordon BerglingTo move the file, you must edit the nfsd sources and recompile it.
94*ad5e10ecSGordon BerglingThis was done to discourage accidental relocation of the file.
95