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.\" 2520d0a5e5SRick Macklem.\" $FreeBSD$ 2620d0a5e5SRick Macklem.\" 271f5dd95bSEdward Tomasz Napierala.Dd December 3, 2009 2820d0a5e5SRick Macklem.Dt STABLERESTART 5 2920d0a5e5SRick Macklem.Os 3020d0a5e5SRick Macklem.Sh NAME 3120d0a5e5SRick Macklem.Nm nfs-stablerestart 32f3253445SEdward Tomasz Napierala.Nd restart information for the 33f3253445SEdward Tomasz Napierala.Tn NFSv4 34f3253445SEdward Tomasz Napieralaserver 3520d0a5e5SRick Macklem.Sh SYNOPSIS 3620d0a5e5SRick Macklem.Nm nfs-stablerestart 3720d0a5e5SRick Macklem.Sh DESCRIPTION 3820d0a5e5SRick MacklemThe 3920d0a5e5SRick Macklem.Nm 4020d0a5e5SRick Macklemfile holds information that allows the 411f5dd95bSEdward Tomasz Napierala.Tn NFSv4 421f5dd95bSEdward Tomasz Napieralaserver to restart without always returning the NFSERR_NOGRACE error, as described in the 431f5dd95bSEdward Tomasz Napierala.Tn NFSv4 4420d0a5e5SRick Macklemserver specification; see 45*25c8b07fSUlrich Spörlein.%T "Network File System (NFS) Version 4 Protocol RFC 3530, Section 8.6.3" . 4620d0a5e5SRick Macklem.Pp 4720d0a5e5SRick MacklemThe first record in the file, as defined by struct nfsf_rec in 4820d0a5e5SRick Macklem/usr/include/fs/nfs/nfsrvstate.h, holds the lease duration of the 4920d0a5e5SRick Macklemlast incarnation of the server and the number of boot times that follows. 5020d0a5e5SRick MacklemFollowing this are the number of previous boot times listed in the 5120d0a5e5SRick Macklemfirst record. 521f5dd95bSEdward Tomasz NapieralaThe lease duration is used to set the grace period. 5320d0a5e5SRick MacklemThe boot times 5420d0a5e5SRick Macklemare used to avoid the unlikely occurrence of a boot time being reused, 5520d0a5e5SRick Macklemdue to a TOD clock going backwards. This record and the previous boot times with this boot time added is re-written at the 561f5dd95bSEdward Tomasz Napieralaend of the grace period. 5720d0a5e5SRick Macklem.Pp 5820d0a5e5SRick MacklemThe rest of the file are appended records, as defined by 5920d0a5e5SRick Macklemstruct nfst_rec in /usr/include/fs/nfs/nfsrvstate.h and are used 6020d0a5e5SRick Macklemrepresent one of two things. There are records which indicate that a 6120d0a5e5SRick Macklemclient successfully aquired state and records that indicate a client's state was revoked. 6220d0a5e5SRick MacklemState revoke records indicate that state information 6320d0a5e5SRick Macklemfor a client was discarded, due to lease expiry and an otherwise 6420d0a5e5SRick Macklemconflicting open or lock request being made by a different client. 6520d0a5e5SRick MacklemThese records can be used 6620d0a5e5SRick Macklemto determine if clients might have done either of the 6720d0a5e5SRick Macklemedge conditions. 6820d0a5e5SRick Macklem.Pp 6920d0a5e5SRick MacklemIf a client might have done either edge condition or this file is 7020d0a5e5SRick Macklemempty or corrupted, the server returns NFSERR_NOGRACE for any reclaim 7120d0a5e5SRick Macklemrequest from the client. 7220d0a5e5SRick Macklem.Pp 7320d0a5e5SRick MacklemFor correct operation of the server, it must be ensured that the file 7420d0a5e5SRick Macklemis written to stable storage by the time a write op with IO_SYNC specified 7520d0a5e5SRick Macklemhas returned. This might require hardware level caching to be disabled for 7620d0a5e5SRick Macklema local disk drive that holds the file, or similar. 7720d0a5e5SRick Macklem.Sh FILES 7820d0a5e5SRick Macklem.Bl -tag -width /var/db/nfs-stablerestart -compact 7920d0a5e5SRick Macklem.It Pa /var/db/nfs-stablerestart 801f5dd95bSEdward Tomasz NapieralaNFSv4 stable restart 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 871f5dd95bSEdward Tomasz NapieralaNFSERR_NOGRACE for all reclaim requests. Although correct, this is 8820d0a5e5SRick Macklema highly undesirable occurrence, so the file should not be lost if 8920d0a5e5SRick Macklemat all possible. Nfsd will not create the file if it does not 9020d0a5e5SRick Macklemexist and will simply log a failure to start, in the hopes that the 9120d0a5e5SRick Macklemfile can be recovered from a backup. To move the file, you must edit 9220d0a5e5SRick Macklemthe nfsd sources and recompile it. This was done to discourage 9320d0a5e5SRick Macklemaccidental relocation of the file. 94