# Hanging cifs mount

## javeree

This is the situation:

I have a Gentoo PC that I use simultaneously as my dhcp/router and as a desktop. I have a windows 7 PC that shares some directories.

On the Gentoo PC, I have in /etc/fstab

 *Quote:*   

> //Athene/Video /home/media/mnt/Athene/Video     cifs    user,noauto,_netdev,soft,iocharset=utf8,credentials=/home/media/mnt/Athene/.smbcredentials,uid=1004,gid=100 0       0

 

With that command I can mount and access the share perfectly

Now the gentoo PC is rarely rebooted, while the Windows PC is rebooted almost daily.

In that situation, the following happens:

1. Gentoo mounts and access the teh share from teh windows PC flawlessly

2. The Windows PC reboots

3. The Windows PC now clearly has not memory of teh mounted state of the share.

4. The Gentoo PC still thinks it has a share mounted (as shown by the 'mount' command)

5. ANY command that stats the share (like ls, df, tab completion to the mount point, use a file  manager to access the mount) results in the command hanging. There is no output, there is no error message, nothing in /var/log, no special activity visible in top or iotop.

6. The only way to get out of it is to kill the console or program or to kill the command (if possible).What could I change to make sure that on a reboot of the Windows PC, the Gentoo PC would notice that some existing mounts are not valid anymore and take appropriate action.

(Whatever appropriate may mean here - hanging is not among the options  :Smile: )

----------

## noclear2000

I somehow expected that the connection would work after a server-side reboot - just as with NFS.

Not sure if there is a more elegant way but here are some things that come to my mind:

1. check autofs/automounting software to use like net-fs/autofs

2. use script to frequently check (maybe all 15 seconds) if server-side is available. if yes and not mounted then mount. If no and mounted then umount (lazy + force probably as server not available) [This is what I do with my notebook and some NFS shares I need to mount only when being at home)

3. Or to avoid polling in while true loop do it event-based: on server-side create a startup-shortcut to a win-batch script that calls a saved putty session with passphrase-less RSA key auth (to a !!non-privileged and jailrooted!! user) that removes + creates or updates a file in the users jail. On client-side this "notification" of server-restart can be received with inotify/incron and trigger the remount action.

just some thoughts on a hack. Probably there is a better way to do it. good luck for receiving such a response.  :Smile: 

----------

