You are not logged in.

#1 2011-11-24 19:26:31

paziul
Member
From: N.C.
Registered: 2011-11-23
Posts: 27

shutdown hangs when cifs share mounted

Hello,

I noticed, when there is a cifs share mount active eg. /mnt/cifs the shutdown process will hang on "Unmounting Non-API Filesystems".
It will hang because all network services are down, but it is still trying to un-mount the cifs/network share.
I looked in the /etc/rc.d/functions and added this >>#avoid cifs<< case:

                # don't unmount API filesystems
                if [[ $target = /@(proc|sys|run|dev|dev/pts) ]]; then
                        continue
                fi

               # avoid cifs
                if [[ $fstype = @(cifs) ]]; then
                        continue
                fi 

                # avoid networked devices
                IFS=, read -ra opts <<< "$options"
                if in_array _netdev "${opts[@]}"; then
                        continue
                fi

There is probably 10 other ways of unmounting custom mounts other than /tmp /dev/shm / ( this is what normally gets unmounted at this stage )
but I found a clean unmount of the cifs file system as unnecessary, unless it can be done prior to the network shutdown... ( at least in my case )

changing the following line in "avoid networked devices"  would do the job:

               if in_array _netdev "${opts[@]}" || [[ $fstype = @(cifs) ]]; then 

hope this helps somebody,

paziul

Last edited by paziul (2011-11-25 14:50:25)


"...and it probably never will support anything other than AT-harddisks..."

Offline

#2 2011-11-25 01:13:46

ngoonee
Forum Fellow
From: Between Thailand and Singapore
Registered: 2009-03-17
Posts: 7,355

Re: shutdown hangs when cifs share mounted

Hi paziul, I'm moving this to "Networking, Server, & Protection", but it probably belongs more in the wiki than in a forum post, if you'd be so kind as to add it to the appropriate page.


Allan-Volunteer on the (topic being discussed) mailn lists. You never get the people who matters attention on the forums.
jasonwryan-Installing Arch is a measure of your literacy. Maintaining Arch is a measure of your diligence. Contributing to Arch is a measure of your competence.
Griemak-Bleeding edge, not bleeding flat. Edge denotes falls will occur from time to time. Bring your own parachute.

Offline

#3 2011-11-26 02:18:24

zasdfgbnm
Member
From: China
Registered: 2011-11-26
Posts: 38
Website

Re: shutdown hangs when cifs share mounted

Hi ,the same problem happened to me. I have tried your method ,but it doesn't work.
The problem happened when I shutdown with network connection on. Any good ideas?

the output of "df -Th" is:

Filesystem     Type      Size  Used Avail Use% Mounted on
udev           devtmpfs   10M     0   10M   0% /dev
run            tmpfs      10M  384K  9.7M   4% /run
/dev/sda6      btrfs     140G   11G  123G   8% /
shm            tmpfs     2.9G     0  2.9G   0% /dev/shm
tmpfs          tmpfs     2.9G   16K  2.9G   1% /tmp
/dev/sda1      ext2      464M   18M  422M   5% /boot
/dev/sda5      reiserfs   94G  7.2G   87G   8% /var
/dev/sda7      btrfs     231G  118G  108G  53% /home

there is no cifs share mount

Offline

#4 2011-11-26 03:14:13

falconindy
Developer
From: New York, USA
Registered: 2009-10-22
Posts: 4,111
Website

Re: shutdown hangs when cifs share mounted

paziul wrote:

Hello,

I noticed, when there is a cifs share mount active eg. /mnt/cifs the shutdown process will hang on "Unmounting Non-API Filesystems".
It will hang because all network services are down, but it is still trying to un-mount the cifs/network share.
I looked in the /etc/rc.d/functions and added this >>#avoid cifs<< case:

                # don't unmount API filesystems
                if [[ $target = /@(proc|sys|run|dev|dev/pts) ]]; then
                        continue
                fi

               # avoid cifs
                if [[ $fstype = @(cifs) ]]; then
                        continue
                fi 

                # avoid networked devices
                IFS=, read -ra opts <<< "$options"
                if in_array _netdev "${opts[@]}"; then
                        continue
                fi

There is probably 10 other ways of unmounting custom mounts other than /tmp /dev/shm / ( this is what normally gets unmounted at this stage )
but I found a clean unmount of the cifs file system as unnecessary, unless it can be done prior to the network shutdown... ( at least in my case )

changing the following line in "avoid networked devices"  would do the job:

               if in_array _netdev "${opts[@]}" || [[ $fstype = @(cifs) ]]; then 

hope this helps somebody,

paziul

This is a pretty filthy hack, and you really shouldn't be doing such a thing (/etc/rc.d/functions will be overwritten on upgrade). Why not just label the mount with the _netdev option on mounting it?

Offline

#5 2011-11-26 06:25:56

paziul
Member
From: N.C.
Registered: 2011-11-23
Posts: 27

Re: shutdown hangs when cifs share mounted

@zasdfgbnm
since you have no cifs mounted, there is a different reason why it hangs on Unmounting Non-API - it is mostlikely unable to umount a fs... similar issue but this "hack" will not help you, but you could try to replace or add other fstype's : @(cifs|btrfs) ... till you find the one that causes the umount problem. reboot each time you make the changes...

@falconindy
It is a hack, that helps me in troubleshooting.... I am new to Arch, I do not remember seeing this on Gentoo... regardless, I need to have my boxes doing what I want need them to do and nothing less, even if there is - as you called it - a "filthy" hack involved. Imagine you doing an init 6 to a remote box and it freezes on some umount (...) ? There might be nobody who will hit the reset button... the shutdown/restart, even if "hacked", has to finish regardless... The _netdev option does not do any good during the shutdown, it still hangs when trying to umount cifs.
tried manually and from the fstab...  the mount -a -O _netdev works just fine when in fstab, but during shutdown it does not see _netdev in opts... freezes... only the "filthy" hack works all the time.. also, zasdfgbnm reports an umount issues, not cifs, but I think it would be good to see why rc.d/functions are not doing what it supposed to do - _netdev is not involved in his case....


"...and it probably never will support anything other than AT-harddisks..."

Offline

#6 2011-11-26 14:50:26

falconindy
Developer
From: New York, USA
Registered: 2009-10-22
Posts: 4,111
Website

Re: shutdown hangs when cifs share mounted

paziul wrote:

The _netdev option does not do any good during the shutdown, it still hangs when trying to umount cifs.

Right, so that's a bug in initscripts, and I'll send a patch to fix it. It's a simple matter of wanting to fix the problem where it exists, not bandaid around it. We have a bug tracker where we'd love to hear about such things not working properly.

http://mailman.archlinux.org/pipermail/ … 02227.html

Last edited by falconindy (2011-11-26 14:58:15)

Offline

#7 2011-11-26 16:01:30

tomegun
Developer
From: France
Registered: 2010-05-28
Posts: 661

Re: shutdown hangs when cifs share mounted

falconindy wrote:
paziul wrote:

The _netdev option does not do any good during the shutdown, it still hangs when trying to umount cifs.

Right, so that's a bug in initscripts, and I'll send a patch to fix it. It's a simple matter of wanting to fix the problem where it exists, not bandaid around it. We have a bug tracker where we'd love to hear about such things not working properly.

http://mailman.archlinux.org/pipermail/ … 02227.html

Applied and pushed: http://projects.archlinux.org/initscrip … 5d3d5e2336 .

Thanks to paziul for the report and to falconindy for the patch.

@paziul: could you verify that replacing your /etc/rc.d/functions with http://projects.archlinux.org/initscrip … ns?id=HEAD fixes the problem (and marking the device as _netdev in fstab).

Offline

#8 2011-11-26 16:13:50

zasdfgbnm
Member
From: China
Registered: 2011-11-26
Posts: 38
Website

Re: shutdown hangs when cifs share mounted

I have applied this patch. It looks well when shutting down but each time when I reboot, the system tells me that  "boot was not cleanly unmounted, force check"

Offline

#9 2011-11-26 16:20:50

zasdfgbnm
Member
From: China
Registered: 2011-11-26
Posts: 38
Website

Re: shutdown hangs when cifs share mounted

#
# /etc/fstab: static file system information
#
# <file system> <dir>   <type>  <options>       <dump>  <pass>
tmpfs           /tmp    tmpfs   nodev,nosuid    0       0
/dev/sda1 /boot ext2 defaults 0 1
/dev/sda2 swap swap defaults 0 0
/dev/sda5 /var reiserfs defaults 0 1
/dev/sda6 / btrfs defaults 0 1
/dev/sda7 /home btrfs defaults 0 1

Offline

#10 2011-11-26 17:08:02

paziul
Member
From: N.C.
Registered: 2011-11-23
Posts: 27

Re: shutdown hangs when cifs share mounted

@falconindy - I agree, only a true "fix" is the ultimate solution, and the new functions does work well on my box - tested - thank you!
I am not too fast in opening a bug report, I usually like to discuss it with others.. 

# findmnt -mrunRo TARGET,FSTYPE,OPTIONS / | tac
returns just '/' in my case... which is nice - the only mounted block device ( aren't the rest of the test cases just redundant ? )

@zasdfgbnm
run this from the shell and share the output:
# findmnt -mrunRo TARGET,FSTYPE,OPTIONS / | tac

Last edited by paziul (2011-11-26 17:11:07)


"...and it probably never will support anything other than AT-harddisks..."

Offline

#11 2011-11-26 17:20:56

tomegun
Developer
From: France
Registered: 2010-05-28
Posts: 661

Re: shutdown hangs when cifs share mounted

paziul wrote:

@falconindy - I agree, only a true "fix" is the ultimate solution, and the new functions does work well on my box - tested - thank you!
I am not too fast in opening a bug report, I usually like to discuss it with others..

If your boot or shutdown is broken, the first line of defense should always be to yell at me ;-)

paziul wrote:

# findmnt -mrunRo TARGET,FSTYPE,OPTIONS / | tac
returns just '/' in my case... which is nice - the only mounted block device ( aren't the rest of the test cases just redundant ? )

This sounds wrong, it should return all your mounts (it does here)...

Edit: so it looks like you found another bug. When /etc/mtab is a file, and not a symlink only / is returned. Which is not what we want....

Last edited by tomegun (2011-11-26 17:24:09)

Offline

#12 2011-11-26 17:52:40

paziul
Member
From: N.C.
Registered: 2011-11-23
Posts: 27

Re: shutdown hangs when cifs share mounted

well yes, it is not >nice<, it works, but is not right...
yes, symlink returns all
would symlink to /proc/mounts be a temp workaround or findmnt needs to be "fixed"?



EDIT:

if symlinked to /proc/mounts it still hangs during shutdown...

Last edited by paziul (2011-11-26 19:27:52)


"...and it probably never will support anything other than AT-harddisks..."

Offline

#13 2011-11-26 18:06:40

tomegun
Developer
From: France
Registered: 2010-05-28
Posts: 661

Re: shutdown hangs when cifs share mounted

We'll create the symlink automatically in the next release to avoid this problem (unless someone objects).

Offline

#14 2011-11-26 18:08:05

zasdfgbnm
Member
From: China
Registered: 2011-11-26
Posts: 38
Website

Re: shutdown hangs when cifs share mounted

I'm sorry, the command "findmnt -mrunRo TARGET,FSTYPE,OPTIONS / | tac" got the result:
/ btrfs rw,relatime
The same problem with paziul.
When shutting down, it doen't hang on unmounting non-api filesystems, instead it fails when unmounting swap-backed filesystems. When rebooting it says "boot is not cleanly unmounted" and "filesystem is not clean".

Last edited by zasdfgbnm (2011-11-27 00:16:39)

Offline

#15 2011-11-27 09:29:28

zasdfgbnm
Member
From: China
Registered: 2011-11-26
Posts: 38
Website

Re: shutdown hangs when cifs share mounted

I did these commands:
#rm /etc/mtab
#ln -s /proc/mounts /etc/mtab
It works well now, thank you. smile

Last edited by zasdfgbnm (2011-11-27 09:42:25)

Offline

#16 2011-11-28 14:59:22

zasdfgbnm
Member
From: China
Registered: 2011-11-26
Posts: 38
Website

Re: shutdown hangs when cifs share mounted

Oh, after it works well for some times, the same problem came back sad, shutdown still hangs on unmounting non-API filesystems when my network is connected.
some commands and its' output is listed here:

#file /etc/mtab
/etc/mtab: symbolic link to `/proc/mounts'

# findmnt -mrunRo TARGET,FSTYPE,OPTIONS / | tac
/home btrfs rw,relatime
/var reiserfs rw,relatime
/boot ext2 rw,relatime,errors=continue
/tmp tmpfs rw,nosuid,nodev,relatime
/run tmpfs rw,nosuid,nodev,relatime,size=10240k,mode=755
/dev/shm tmpfs rw,nosuid,nodev,relatime
/dev/pts devpts rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000
/dev devtmpfs rw,nosuid,relatime,size=10240k,nr_inodes=738010,mode=755
/sys sysfs rw,nosuid,nodev,noexec,relatime
/proc proc rw,nosuid,nodev,noexec,relatime
/ btrfs rw,relatime

Maybe there are some other bugs?

Last edited by zasdfgbnm (2011-11-28 15:03:12)

Offline

#17 2011-11-29 15:29:42

zasdfgbnm
Member
From: China
Registered: 2011-11-26
Posts: 38
Website

Re: shutdown hangs when cifs share mounted

Any help?
Should I do something else other than patching /etc/rc.d/functions and change /etc/mtab to a symlink?

Offline

#18 2011-11-29 15:58:55

tomegun
Developer
From: France
Registered: 2010-05-28
Posts: 661

Re: shutdown hangs when cifs share mounted

zasdfgbnm wrote:

Oh, after it works well for some times, the same problem came back sad, shutdown still hangs on unmounting non-API filesystems when my network is connected.
some commands and its' output is listed here:

#file /etc/mtab
/etc/mtab: symbolic link to `/proc/mounts'

# findmnt -mrunRo TARGET,FSTYPE,OPTIONS / | tac
/home btrfs rw,relatime
/var reiserfs rw,relatime
/boot ext2 rw,relatime,errors=continue
/tmp tmpfs rw,nosuid,nodev,relatime
/run tmpfs rw,nosuid,nodev,relatime,size=10240k,mode=755
/dev/shm tmpfs rw,nosuid,nodev,relatime
/dev/pts devpts rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000
/dev devtmpfs rw,nosuid,relatime,size=10240k,nr_inodes=738010,mode=755
/sys sysfs rw,nosuid,nodev,noexec,relatime
/proc proc rw,nosuid,nodev,noexec,relatime
/ btrfs rw,relatime

Maybe there are some other bugs?

It looks like you don't have any network filesystems, so the hang must be a different one than the original report. What do you mean "network is connected"? Do you mean that you have "NETWORK_PERSIST" enabled in rc.conf, or just that the cable is plugged in? Under normal circumstances the network should be brought down early in the shutdown process, so it should not affect what is happening here.

If you wait for shutdown to finish, does it ever continue? Also, do you get complaints about unclean shutdown when you reboot?

Offline

#19 2011-11-30 07:25:50

zasdfgbnm
Member
From: China
Registered: 2011-11-26
Posts: 38
Website

Re: shutdown hangs when cifs share mounted

"network connected" means that after I run netcfg to connect to network. It seems that the problem occurs only after I run netcfg to connect to the network, but I'm not sure the problem won't occur on network not connected.I often open chromium and firefox to surf the internet, so I don't know whether the problem was caused by netcfg, firefox or chromium. But connecting to network didn't always lead to this problem.
Just now, the problem occur again, I waited for nearly 20 minute, but it's still hanging there. So I pushed the power button for force off. After I rebooted my computer, I got:

boot was not cleanly unmounted,check forced.
boot: 29/122000 files (3.4% non-contiguous),33936/489948 blocks.
Reiserfs super block in block 16 on 0x005 of format 3.6 with standard journal
Blocks(total/free): 24414768/22665939 by 4096 bytes
Filesystem is NOT clean
Replaying journal: Trans replayed mountid 234, transid 32875, desc 5613, len 15, commit 5629, next trans offset 5612
...
Replaying journal: Done.
Reiserfs journal '/dev/sda5' in blocks [18.,8211]: 47 transections replayed.

No error was reported at boot time if it didn't hang on unmounting non-api filesystems shutdown

Last edited by zasdfgbnm (2011-11-30 10:01:31)

Offline

#20 2011-12-02 04:25:19

zasdfgbnm
Member
From: China
Registered: 2011-11-26
Posts: 38
Website

Re: shutdown hangs when cifs share mounted

It seems that this problem is caused by firefox. I remove firefox from my computer and use chromium instead, this problem doesn't happen again

Offline

#21 2011-12-02 16:05:18

student975
Member
From: Russian Federation
Registered: 2011-03-05
Posts: 613

Re: shutdown hangs when cifs share mounted

I don't think firefox is a problem root. I guess it is any network activity, say, cifs-mounted (via auotfs) directories for jazz playing back smile
// ----

I have opened new task as far as didn't found existing one related to the issue: https://bugs.archlinux.org/task/27409


"I exist" is the best myth I know..

Offline

#22 2011-12-02 18:53:04

zasdfgbnm
Member
From: China
Registered: 2011-11-26
Posts: 38
Website

Re: shutdown hangs when cifs share mounted

I want to collect some information when the problem happens, so that it will help find how the error happened.  But It seems hard. On that situation all filesystems is unmounted. It is seems unable to log error information to file.
Any good ideas?

Offline

#23 2011-12-08 21:59:09

paziul
Member
From: N.C.
Registered: 2011-11-23
Posts: 27

Re: shutdown hangs when cifs share mounted

tried nfs - hard & soft / tcp & udp / nointr.... non-API umount works well all the time during shutdown
the problem still persists on cifs - with or without _netdev opt
- /etc/mtab is a symlink
- x86_64 3.1.2-1 stock arch & 3.1.4 vanilla

Last edited by paziul (2011-12-08 21:59:49)


"...and it probably never will support anything other than AT-harddisks..."

Offline

#24 2011-12-08 22:04:09

student975
Member
From: Russian Federation
Registered: 2011-03-05
Posts: 613

Re: shutdown hangs when cifs share mounted

Let's vote that issue.


"I exist" is the best myth I know..

Offline

#25 2011-12-11 01:46:28

zasdfgbnm
Member
From: China
Registered: 2011-11-26
Posts: 38
Website

Re: shutdown hangs when cifs share mounted

I find that my problem is happened when unmounting /home (details is commented in https://bugs.archlinux.org/task/27409) ,  but paziul's is because of cifs. We are discussing different problems with the same appearance.

Offline

Board footer

Powered by FluxBB