nfs option

soft / hard    Determines the recovery behavior of the NFS client after an NFS request times out.  If neither  option  is specified (or if the hard option is specified), NFS requests are retried indefinitely.  If the soft optionis specified, then the NFS client fails an NFS request after retrans retransmissions have been sent, causing the NFS client to return an error to the calling application.

NFS请求超时后,决定NFS Client的重获行为。如果没有设置选项(或者设置为hard),NFS请求会无限期的重试。如果设置为soft,那么在retrans个请求重发失败后,触发NFS Client返回一个错误给调用的程序

 

NB:  A  so-called  "soft" timeout can cause silent data corruption in certain cases. As such, use the soft option only when client responsiveness is more important than data  integrity.   Using  NFS  over  TCP  or increasing the value of the retrans option may mitigate some of the risks of using the soft option.

soft超时在特定的情况下,会导致无记载数据损坏。本身,在响应能力远比完整性重要时才使用soft选项。使用TCP或者增大retrans可以缓解使用soft的风险。

 

timeo=n        The  time (in tenths of a second) the NFS client waits for a response before it retries an NFS request. If this option is not specified, requests are retried every 60 seconds for NFS over TCP.  The NFS client does not perform any kind of timeout backoff for NFS over TCP.

NFS Client在重试NFS请求之前的等待响应时间(十分之一秒)。如果该选项没有设置,使用TCP协议时请求每60秒重新一次。使用TCP协议时,NFS Client不执行任何超时backoff

However,  for NFS over UDP, the client uses an adaptive algorithm to estimate an appropriate timeout value for frequently used request types (such as READ and WRITE requests), but uses the timeo setting for infrequently  used request types (such as FSINFO requests).  If the timeo option is not specified, infrequently used request types are retried after 1.1 seconds.  After each retransmission, the NFS client  doubles  the  timeout for that request, up to a maximum timeout length of 60 seconds.

可是对于UDP协议,client使用一个合适的算法,为常用的请求类型estimate合适的超时时间。但对不常用的请求类型使用timeo设置。如果timeo没有设置,不常用的请求类型1.1秒以后重试。在每次重发后,NFS Client会将timeout时间加倍,直到最大的60秒。

 

retrans=n      The  number  of  times the NFS client retries a request before it attempts further recovery action. If the retrans option is not specified, the NFS client tries each request three times.The NFS client generates a "server not responding" message after retrans retries,  then  attempts  further  recovery (depending on whether the hard mount option is in effect).

在尝试进一步的重获行为之前(即softhard),NFS  Clinet的重试次数。如果retrans没有设置,NFS client会对没个请求重试3次。在retrans次重试以后,NFS client会生成一个"server not responding"的消息,然后尝试进一步重获(取决于是否是hard mount)。

 

retry=n        The  number of minutes that the mount(8) command retries an NFS mount operation in the foreground or back- ground before giving up.  If this option is not specified, the default value for foreground  mounts  is  2   minutes, and the default value for background mounts is 10000 minutes (80 minutes shy of one week).

mount(8)在前台或后台重试NFS mount放弃之前的分钟数。如果没有设置该选项,foreground  mounts的默认值为2分钟,background mounts的默认值是10000分钟。

 

bg / fg        Determines  how the mount(8) command behaves if an attempt to mount an export fails.  The fg option causes mount(8) to exit with an error status if any part of the mount request times out or fails outright.   This   is called a "foreground" mount, and is the default behavior if neither the fg nor bg mount option is spec ified.

         尝试mount失败时,决定mount(8)的行为。如果mount请求超时或失败,fg选项使mount(8)退出返回失败状态。这就叫foreground mountfg是默认值。

   If the bg option is specified, a timeout or failure causes the mount(8) command to fork a child which continues  to  attempt  to  mount the export.  The parent immediately returns with a zero exit code.  This is   known as a "background" mount.   If the local mount point directory is missing, the mount(8) command acts as if  the  mount  request  timed    out.   This  permits  nested NFS mounts specified in /etc/fstab to proceed in any order during system initialization, even if some NFS servers are not yet available.

         如果设置为bgmount超时或者失败会使mount(8)命令发起Child,持续的尝试mount。而父进程立即返回一个0。这就是background  mount。如果缺少本地目录,mount(8)命令表现为超时。这个允许在etc/fstab中指定的NFS MOUNT,可以在系统初始化时执行,即使一些NFS服务器还是无效的。

关于TCPtimeouthttp://www.eall.com.br/blog/?p=2338

if the timeo option for the NFS has a low value, the NFS will interfere and resend the whole RPC call without wait for the TCP timeout (yes, TCP has a timeout, and has nothing to do with the fstab options). So, the default timeo for NFS/TCP shares should be 600 (60 seconds), because that should be sufficient for the TCP timeout.

如果NFStimeo设置为一个小值,NFS会介入并重新发新整个RPC请求而不是等待TPCtimeout(TCP有个一timeout,和fstab选项没有什么关系)。因此NFS/TCP shares的默认的timeo60秒,因为对TCP timeout是充足的。

监控nfs的行为while true; do nfsstat -rc; sleep 5; done

总结:soft / hardtimeoretrans应该对请求而言的。而retrybg / fg是对mount而言的。

猜你喜欢

转载自jianzong2000.iteye.com/blog/1631074
nfs
今日推荐