# Mounted CIFS Freezes Computer on Connection Drop

## eleanor

Hello,

I've recently setup my autofs config, because I would like to automatically mount CIFS volumes when connected over VPN connection. But since this is a laptop, where the VPN connection is constantly turned on/off, the setup has to work with these considerations in mind.

My setup is presented below. The /etc/autofs/auto.master contains the following:

```

/home/user/Shares /etc/autofs/share --ghost --timeout=10 --nonstrict

```

The /etc/autofs/share contains the following, which should mount the //nas/private share, which is obviously located on a NAS system that is accessible by resolving local DNS nas. Note that the domain cannot be resolved when the VPN is not connected, but this shouldn't cause any problems, because the DNS system should not return anything, which doesn't cause a long-blocking connections.

```

private -fstype=cifs,credentials=/root/.credentials,gid=1000,uid=1000,rw,soft,intr,bg,retrans=1,retry=0,nodev,nosuid,async,_netdev ://nas/private

```

If I start autofs when the VPN is connected everything works flawlessly, but whole laptop freezes if I disconnect from VPN, which can be confirmed by looking into /var/log/messages:

 *Quote:*   

> 
> 
> May 27 22:39:36 user kernel: [26254.979077] grsec: unmount of //nas/private by /bin/umount[umount:1580] uid/euid:0/0 gid/egid:0/0, parent /usr/sbin/                          automount[automount:1579] uid/euid:0/0 gid/egid:0/0
> 
> May 27 22:41:40 user kernel: [26379.055017] CIFS VFS: Server shared has not responded in 120 seconds. Reconnecting... 
> ...

 

The following was added to /etc/openvpn/up.sh, which gets called when connecting to VPN:

```

/etc/init.d/autofs start

```

I've also added the following into /etc/openvpn/down.sh, which gets called upon disconnecting the VPN connection.

```

umount -l -a -t cifs -f                                                                                                                                                      

/etc/init.d/autofs stop

```

The problem is if I run the "umount -l -a -t cifs -f" manually I get the following error:

 *Quote:*   

> 
> 
> umount: /home/user/Shares/private: not mounted
> 
> 

 

Does anybody have any ideas what to do to lower the timeout value, which is not being taken into account, since in /etc/autofs/auto.master 10 seconds are set, but in /var/log/messages it still takes 120 seconds to respond.

Additionally I would like to know why the umount doesn't recognize the share to be mounted and therefore can't unmount it.

In the best case scenario, I wouldn't even want to wait for 10 seconds, but would like that to be handled in the background without freezing the whole computer. 

Any other help would be appreciated.

Thank you

----------

## eleanor

Posting to update the thread, maybe somebody missed it and will have some ideas. Any ideas are appreciated, so shoot away even if you have the slightest idea of how to possibly solve the issue.

----------

