# mounted cifs and smb shares hang system

## Pythagoras1

if i mount smb or cifs shares from a server and this server becomes shut down (e.g. for administration) nearly the whole system hangs. i neither can't umount these resources (umount hangs) nor reboot the system (nothing happens after the reboot message from init). the only way i get this box running again is to turn it off. i hate this behaviour since our server becomes shut down very often.

----------

## Assgier

i'd like to give this topic a good kick back up, because i'm having the same problem since i started using cifs instead of smbfs (because 2.6.10's in-kernel smbfs cliënt doesn't work the way it should, it's extremely slow and apparently waits for something before it starts transferring a file from one machine to another), the smbfs problem was solved and i can now even umount cifs mounts as normal user ('user' is in fstab)...

Before i'll continue, here's some system (version) information that might be relevant:

```

$ uname -a

Linux 2.6.10-gentoo-r7 #1 Sun Feb 20 03:42:32 CET 2005 i686 Intel(R) Pentium(R) 4 CPU 2.00GHz GenuineIntel GNU/Linux

$ mount

/dev/hda4 on / type ReiserFS (rw,noatime)

none on /dev type devfs (rw)

none on /proc type proc (rw)

none on /sys type sysfs (rw)

none on /dev/pts type devpts (rw)

/dev/hda1 on /mnt/Windows type ntfs (ro,uid=0,gid=407,dmask=0227,fmask=0227)

/dev/hdb1 on /mnt/games type vfat (rw,uid=0,gid=407,dmask=007,fmask=007)

/dev/hde5 on /mnt/stuff type ntfs (ro,uid=0,gid=407,dmask=0222,fmask=0222)

/dev/hdf5 on /mnt/films type ntfs (ro,uid=0,gid=407,dmask=0222,fmask=0222)

none on /dev/shm type tmpfs (rw)

none on /proc/bus/usb type usbfs (rw)

//Achmed/mp3 on /mnt/Achmed type cifs (ro)

```

cifs and smbfs support is built-in my kernel (not as modules)...

Now i'm encountering the same problem as this topic's starter does (perhaps did?); when i want to reboot or shutdown the system, it hangs at "Unmounting filesystems"  :Sad: 

I have now tried to manually umount the cifs mount before shutting down the pc, it doesn't unmount  :Sad: 

```

$ umount /mnt/Achmed

umount: /mnt/Achmed: device is busy

umount: /mnt/Achmed: device is busy

$ su

Password:

# umount /mnt/Achmed

umount: /mnt/Achmed: device is busy

umount: /mnt/Achmed: device is busy

# cat /etc/fstab

*cut*

//Achmed/mp3            /mnt/Achmed     cifs            uid=root,gid=kornelis,dir_mode=0770,file_mode=0770,rw,user,credentials=/etc/samba/achmed 0 0

```

There was still a running process named cifsd, which i have 'kill -9'-ed, but it didn't solve anything and there are no other running processes currently using files on the mount point, i have doublechecked 'ps aux'  :Mad: 

Further more:

```

# umount -f Achmed

umount2: Device or resource busy

umount: //Achmed/mp3: not found

umount: /mnt/Achmed: Illegal seek

umount2: Device or resource busy

umount: /mnt/Achmed: device is busy

```

So if there's anyone that has a solution, or notices any errors in my fstab or something, please tell  :Smile: 

----------

## smithjd15

The problem seems to be with the init scripts. I'll post some information when I get to work.  :Smile: 

----------

## Assgier

 *smithjd15 wrote:*   

> The problem seems to be with the init scripts. I'll post some information when I get to work. 

 

i'm curious  :Smile: 

----------

## smithjd15

Sorry for the delay, I got much too busy at work.

In /etc/init.d/localmount:

```
mount -at nocoda,nonfs,noproc,noncpfs,nosmbfs,noshm >/dev/null
```

Change this line to read:

```
mount -at nocoda,nonfs,noproc,noncpfs,nosmbfs,noshm,nocifs >/dev/null
```

This tells the drive mount init script to ignore cifs (which is the problem you are having, as the network is not a dependency of localmount, when the drives are unmounted the net is already down, so it locks on shutdown.) This is fine, but your cifs partitions will no longer be mounted. So:

/etc/init.d/netmount:

```
local remaining="$(awk '$3 ~ /coda|nfs|ncpfs|smbfs/ { if ($2 != "/") print $2 }' /proc/mounts | sort -r)"
```

becomes

```
local remaining="$(awk '$3 ~ /coda|nfs|ncpfs|smbfs|cifs/ { if ($2 != "/") print $2 }' /proc/mounts | sort -r)"
```

(note the pipes [shift + backslash])

and in the same file 

```
remaining="$(awk '$3 ~ /coda|nfs|ncpfs|smbfs/ { if ($2 != "/") print $2 }' /proc/mounts | sort -r)"
```

is changed similar to above. Yes, there are two instances.  :Smile: 

This is a bonefide BUG, at least in stable baselayout(?); I haven't had a chance to check if it's been fixed in unstable or to file a bug report if not.

James

----------

## smithjd15

On second reflection, I'm not sure whether this will completely solve your issue. It will definitely clear the shutdown issue, but I'm not sure about unmounting a share when the server goes down. This will take some experimenting I guess.  :Smile: 

----------

## Pythagoras1

however, i'm mounting my cifs shares using a perl-tk application. my most recent change in it was that i added the -l option (called lazy) to the umount command. that makes shure the directory is umounted immediately while keeping all handles-in-use opened. it's likley that a similar change in the netmount script would do it.

----------

## Assgier

 *smithjd15 wrote:*   

> Sorry for the delay, I got much too busy at work.
> 
> In /etc/init.d/localmount:
> 
> ```
> ...

 

thanks for your support, well as i was searching the forum a few days ago, i already discovered and did the /etc/init.d/netmount edits, which resulted in the fact that my system would not longer hang (this was when i shut the system down after i bumped this topic all the way back up)...

I will, however, still have to edit /etc/init.d/localmount, but i don't think it will fix the problem where i'm unable to unmount my cifs mount by hand (not during the shutdown process).

Well anyway, the shutdown problem seems to be solved for now, that's what's most important for the moment  :Wink: 

I'm currently not at home (school actually), but i will edit my localmount file as soon as i get the time for it at home  :Smile: 

Thanks again for your help  :Smile: 

----------

## Pythagoras1

maybe you should add /etc/init.d to the CONFIG_PROTECT_MASK variable and then execute etc-update.

my localmount already has nocifs in it. so it looks like they've already updated the script.

----------

## toralf

 *smithjd15 wrote:*   

> 
> 
> This is a bonefide BUG, at least in stable baselayout(?); I haven't had a chance to check if it's been fixed in unstable or to file a bug report if not. 
> 
> 

 

See https://bugs.gentoo.org/show_bug.cgi?id=78038 from 2005-01-16 12:04 PST

----------

## smithjd15

Seems to not have filtered down to stable yet. Which would explain this behaviour on a new box.

----------

