# NFSv4 clients hang when the NFS server is gone



## GoodWolf (Apr 5, 2013)

I am operating some NFSv4 Servers, .. but, someday, I reboot NFS Servers in out of awarence .. then, NFS Clients was hangs when approaches to the NFS Mount points

I am operating some NFSv4 servers, but sometimes I reboot NFS servers (_why?_), causing NFS clients to hang when trying to approach the NFS mountpoints.


`umount` / `umount -f` does not work
Even when I reboot some NFS clients, they still hang on the way to shutdown
OS is FreeBSD 9.1-p2 (server and clients)
NFS configuration is below


```
[server]
 rpcbind_enable="YES"
 nfs_server_enable="YES"
 nfsv4_server_enable="YES"
 nfsuserd_enable="YES"  # Client also needed
 mountd_enable="YES"
 mountd_flags="-r"
 
 rpc_lockd_enable="YES"
 rpc_statd_enable="YES"

[clients]
 rpcbind_enable="YES"
 nfs_client_enable="YES"
 nfsuserd_enable="YES"
```

What's wrong?
Can I solve these hanging situations?
Please tell me how to avoid these situations. When the server is gone, clients should not hang and recover automatically when the server comes back (reboots).

Thank you.


----------



## SirDice (Apr 5, 2013)

Have a look in the mount_nfs(8) man page:

```
If the server becomes unresponsive while an NFS file system is mounted,
     any new or outstanding file operations on that file system will hang
     uninterruptibly until the server comes back.  To modify this default be-
     haviour, see the intr and soft options.
```


----------



## nORKy (Apr 6, 2013)

And what does it mean?

```
BUGS
     Since nfsv4 performs open/lock operations that have their ordering
     strictly enforced by the server, the options intr and soft cannot be
     safely used.  hard nfsv4 mounts are strongly recommended.
```


----------



## ramirez (Feb 9, 2015)

Same problem with FreeBSD 10.1 amd64.
I have one client connected to two servers. If one server go away, client hangs until server come back.

Any workarounds?


----------



## Oko (Feb 9, 2015)

Yes that is called statefull NFS. It is expected behaviour. Use NFS3. What problem are you traying to solve with NFSv4 anyway?


----------



## ramirez (Feb 9, 2015)

My app push files to multiple nodes that mounted via NFS.

Looks like I must use NFS soft mount option.
With care, of course.


----------

