免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1961 | 回复: 1
打印 上一主题 下一主题

访问NFS mount 如何让它立即返回??? [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2010-04-28 15:06 |只看该作者 |倒序浏览
曾写了一个检测程序以检测 NFS mount 的目录 是否存在?? 在异常测试中, 当断开NFS网线时, stat函数一直挂在那个地方, 查阅相关资料, 得知 mount 时参数指定不对. 遂根据资料修类似如下命令:

mount -t nfs -o timeo=10,rw,soft,retry=1,intr 135.251.208.34:/vol/vol1 /nfs

由于添加了 timeo 及 soft  与 retry 参数, 这样, 经过 (timeo + 2*timeo)/10 = 3秒后, stat函数应该会返回, 其 errno 表明 "I/O" 错误.

测试展示, 发现不稳定, 在 mount 上后的前几次操作中, stat函数 (df -k 命令也一样)等待3秒后返回了 "I/O"错误,, 但偶尔有时又挂在那里了, 最后需要等待1分钟后才返回. 由于程序对这个检测时间比较敏感, 希望将这个检测时间控制在较短范围.

1, 为什么 stat函数(df -k) 不按设置好的参数超时返回呢?

2, 能否加一个保护机制, 当 stat挂在那地方超过一时间后, 主程序能否中断 stat 操作? 怎么去中断?? 是否发一个信号?? 这个信号怎么发??

论坛徽章:
0
2 [报告]
发表于 2010-04-29 12:24 |只看该作者
If you really want to go this route, you can use an rpc call to contact the NFS server to inquire of it's health. Calling procedure 0 is a common way to do this. Procedure 0 always succeeds and just exits to prove that the server is alive. The rpcinfo can do this. You can either invoke that program or download the source code from opensolaris to see how to do it.
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP