⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 1.t

📁 早期freebsd实现
💻 T
📖 第 1 页 / 共 2 页
字号:
.\" Copyright (c) 1993.\"	The Regents of the University of California.  All rights reserved..\".\" This document is derived from software contributed to Berkeley by.\" Rick Macklem at The University of Guelph..\".\" Redistribution and use in source and binary forms, with or without.\" modification, are permitted provided that the following conditions.\" are met:.\" 1. Redistributions of source code must retain the above copyright.\"    notice, this list of conditions and the following disclaimer..\" 2. Redistributions in binary form must reproduce the above copyright.\"    notice, this list of conditions and the following disclaimer in the.\"    documentation and/or other materials provided with the distribution..\" 3. All advertising materials mentioning features or use of this software.\"    must display the following acknowledgement:.\"	This product includes software developed by the University of.\"	California, Berkeley and its contributors..\" 4. Neither the name of the University nor the names of its contributors.\"    may be used to endorse or promote products derived from this software.\"    without specific prior written permission..\".\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION).\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF.\" SUCH DAMAGE..\".\"	@(#)1.t	8.1 (Berkeley) 6/8/93.\".sh 1 "NFS Implementation".ppThe 4.4BSD implementation of NFS and the alternate protocol nicknamedNot Quite NFS (NQNFS) are kernel resident, but make use of a few systemdaemons.The kernel implementation does not use an RPC library, handling the RPCrequest and reply messages directly in \fImbuf\fR data areas. NFSinterfaces to the network usingsockets via. the kernel interface available in\fIsys/kern/uipc_syscalls.c\fR as \fIsosend(), soreceive(),\fR...There are connection management routines for support of sockets for connectionoriented protocols and timeout/retransmit support for datagram sockets onthe client side.For connection oriented transport protocols,such as TCP/IP, there is one connectionfor each client to server mount point that is maintained until an umount.If the connection breaks, the client will attempt a reconnect with a newsocket.The client side can operate without any daemons running, but performancewill be improved by running nfsiod daemons that perform read-aheadsand write-behinds.For the server side to function, the daemons portmap, mountd andnfsd must be running.The mountd daemon performs two important functions..ip 1)Upon startup and after a hangup signal, mountd reads the exportsfile and pushes the export information for each local file system downinto the kernel via. the mount system call..ip 2)Mountd handles remote mount protocol (RFC1094, Appendix A) requests..lpThe nfsd master daemon forks off children that enter the kernelvia. the nfssvc system call. The children normally remain kernelresident, providing a process context for the NFS RPC servers. The onlyexception to this is when a Kerberos [Steiner88]ticket is received and at that timethe nfsd exits the kernel temporarily to verify the ticket via. theKerberos libraries and then returns to the kernel with the results.(This only happens for Kerberos mount points as described further underSecurity.)Meanwhile, the master nfsd waits to accept new connections from clientsusing connection oriented transport protocols and passes the new sockets downinto the kernel.The client side mount_nfs along with portmap andmountd are the only parts of the NFS subsystem that make anyuse of the Sun RPC library..sh 1 "Mount Problems".ppThere are several problems that can be encountered at the time of an NFSmount, ranging from a unresponsive NFS server (crashed, network partitionedfrom client, etc.) to various interoperability problems between differentNFS implementations..ppOn the server side,if the 4.4BSD NFS server will be handling any PC clients, mountd willrequire the \fB-n\fR option to enable non-root mount request servicing.Running of a pcnfsd\** daemon will also be necessary..(f\** Pcnfsd is available in source form from Sun Microsystems and manyanonymous ftp sites..)fThe server side requires that the daemonsmountd and nfsd be running and thatthey be registered with portmap properly.If problems are encountered,the safest fix is to kill all the daemons and then restart them inthe order portmap, mountd and nfsd.Other server side problems are normally caused by problems with the formatof the exports file, which is covered underSecurity and in the exports man page..ppOn the client side, there are several mount options useful for dealingwith server problems.In cases where a file system is not critical for system operation, the\fB-b\fRmount option may be specified so that mount_nfs will go into thebackground for a mount attempt on an unresponsive server.This is useful for mounts specified in\fIfstab(5)\fR,so that the system will not get hung while booting doing\fBmount -a\fRbecause a file server is not responsive.On the other hand, if the file system is critical to system operation, thisoption should not be used so that the client will wait for the server tocome up before completing bootstrapping.There are also three mount options to help deal with interoperability issueswith various non-BSD NFS servers. The\fB-P\fRoption specifies that the NFSclient use a reserved IP port number to satisfy some servers' securityrequirements.\**.(f\**Any security benefit of this is highly questionable and assuch the BSD server does not require a client to use a reserved port number..)fThe\fB-c\fRoption stops the NFS client from doing a \fIconnect\fR on the UDPsocket, so that the mount works with servers that send NFS replies fromport numbers other than the standard 2049.\**.(f\**The Encore Multimax is knownto require this..)fFinally, the\fB-g=\fInum\fRoption sets the maximum size of the group list in the credentials passedto an NFS server in every RPC request. Although RFC1057 specifies a maximumsize of 16 for the group list, some servers can't handle that many.If a user, particularly root doing a mount,keeps getting access denied from a file server, try temporarilyreducing the number of groups that user is in to less than 5by editing /etc/group. If the user can then access the file system, slowlyincrease the number of groups for that user until the limit is found andthen peg the limit there with the\fB-g=\fInum\fRoption.This implies that the server will only see the first \fInum\fRgroups that the user is in, which can cause some accessibility problems..ppFor sites that have many NFS servers, amd [Pendry93]is a useful administration tool.It also reduces the number of actual NFS mount points, alleviating problemswith commands such as df(1) that hang when any of the NFS servers isunreachable..sh 1 "Dealing with Hung Servers".ppThere are several mount options available to help a client deal withbeing hung waiting for response from a crashed or unreachable\** server..(f\**Due to a network partitioning or similar..)fBy default, a hard mount will continue to try to contact the server``forever'' to complete the system call. This type of mount is appropriatewhen processes on the client that access files in the file system do nottolerate file I/O systems calls that return -1 with \fIerrno == EINTR\fRand/or access to the file system is critical for normal system operation..lpThere are two other alternatives:.ip 1)A soft mount (\fB-s\fR option) retries an RPC \fIn\fRtimes and then the correspondingsystem call returns -1 with errno set to EINTR.For TCP transport, the actual RPC request is not retransmitted, but thetimeout intervals waiting for a reply from the server are donein the same manner as UDP for this purpose.The problem with this type of mount is that most applications do notexpect an EINTR error return from file I/O system calls (since it neveroccurs for a local file system) and get confused by the error returnfrom the I/O system call.The option\fB-x=\fInum\fRis used to set the RPC retry limit and if set too low, the error returnswill start occurring whenever the NFS server is slow due to heavy load.Alternately, a large retry limit can result in a process hung for a longtime, due to a crashed server or network partitioning..ip 2)An interruptible mount (\fB-i\fR option) checks to see if a termination signalis pending for the process when waiting for server response and if it is,the I/O system call posts an EINTR. Normally this results in the processbeing terminated by the signal when returning from the system call.This feature allows you to ``^C'' out of processes that are hungdue to unresponsive servers.The problem with this approach is that signals that are caught bya process are not recognized as termination signalsand the process will remain hung.\**.(f\**Unfortunately, there are also some resource allocation situations in theBSD kernel where the termination signal will be ignored and the processwill not terminate..)f.sh 1 "RPC Transport Issues".ppThe NFS Version 2 protocol runs over UDP/IP transport bysending each Sun Remote Procedure Call (RFC1057)request/reply message in a single UDPdatagram. Since UDP does not guarantee datagram delivery, theRemote Procedure Call (RPC) layertimes out and retransmits an RPC request ifno RPC reply has been received. Since this round trip timeout (RTO) value is for the entire RPC operation, including RPC message transmission to theserver, queuing at the server for an nfsd, performing the RPC andsending the RPC reply message back to the client, it can be highly variablefor even a moderately loaded NFS server.As a result, the RTO interval must be a conservation (large) estimate, inorder to avoid extraneous RPC request retransmits.\**.(f\**At best, an extraneous RPC request retransmit increasesthe load on the server and at worst can result in damaged fileson the server when non-idempotent RPCs are redone [Juszczak89]..)fAlso, with an 8Kbyte read/write data size(the default), the read/write reply/request will be an 8+Kbyte UDP datagramthat must normally be fragmented at the IP layer for transmission.\**.(f\**6 IP fragments for an Ethernet,which has an maximum transmission unit of 1500bytes..)fFor IP fragments to be successfully reassembled intothe IP datagram at the receive end, allfragments must be received within a fairly short ``time to live''.If one fragment is lost/damaged in transit,the entire RPC must be retransmitted and redone.This problem can be exaggerated by a network interface on the receiver thatcannot handle the reception of back to back network packets. [Kent87a].ppThere are several tuning mountoptions on the client side that can prove useful when trying toalleviate performance problems related to UDP RPC transport.The options\fB-r=\fInum\fRand\fB-w=\fInum\fRspecify the maximum read or write data size respectively.The size \fInum\fRshould be a power of 2 (4K, 2K, 1K) and adjusted downward from themaximum of 8Kbyteswhenever IP fragmentation is causing problems. The best indicator ofIP fragmentation problems is a significant number of\fIfragments dropped after timeout\fRreported by the \fIip:\fR section of a \fBnetstat -s\fRcommand on either the client or server.Of course, if the fragments are being dropped at the server, it can befun figuring out which client(s) are involved.The most likely candidates are clients that are noton the same local area network as theserver or have network interfaces that do not receive severalback to back network packets properly..ppBy default, the 4.4BSD NFS client dynamically estimates the retransmittimeout interval for the RPC and this appears to work reasonably well formany environments. However, the\fB-d\fRflag can be specified to turn offthe dynamic estimation of retransmit timeout, so that the client willuse a static initial timeout interval.\**.(f\**After the first retransmit timeout, the initial interval is backed offexponentially..)fThe\fB-t=\fInum\fRoption can be used with\fB-d\fRto set the initial timeout interval to other than the default of 2 seconds.The best indicator that dynamic estimation should be turned off wouldbe a significant number\** in the \fIX Replies\fR field and a.(f\**Even 0.1% of the total RPCs is probably significant..)flarge number in the \fIRetries\fR fieldin the \fIRpc Info:\fR section as reportedby the \fBnfsstat\fR command.On the server, there would be significant numbers of \fIInprog\fR recentrequest cache hits in the \fIServer Cache Stats:\fR section as reportedby the \fBnfsstat\fR command, when run on the server..ppThe tradeoff is that a smaller timeout interval results in a betteraverage RPC response time, but increases the risk of extraneous retries

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -