NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

bin/41766: system will hang in reboot or shutdown if tmpfs contains more data than phys mem available

>Number:         41766
>Category:       bin
>Synopsis:       system will hang in reboot or shutdown if tmpfs contains more 
>data than phys mem available
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Wed Jul 22 12:45:00 +0000 2009
>Originator:     Wolfgang Stukenbrock
>Release:        NetBSD 4.0
Dr. Nagler & Company GmbH
System: NetBSD s012 4.0 NetBSD 4.0 (NSW-S012) #9: Fri Mar 13 12:31:52 CET 2009 
wgstuken@s012:/usr/src/sys/arch/amd64/compile/NSW-S012 amd64
Architecture: x86_64
Machine: amd64
        During reboot or shutdown the last step is to execute /etc/rc.d/swap1 
in case
        "swapoff=YES" is set in rc.conf. Setting this is required if the swap 
space resides
        on a raid device to avoid rebuilding the parity on every boot.
        If there are some tmpfs filesystems, the data of theese resides in the 
swap space and
        if there is a large amount of data present, unmounting of the swap 
space will fail.
        The system will hang.
        Setup a large swap space, add a tmpfs, fill e.g. twice the amount of 
data of the phys memory
        available in the system into the tmpfs.
        Set swapoff=YES in rc.conf and try to reboot the system. You will get 
into problems.
        The fix below simply removes all tmpfs filesystems prior unmounting the 
swap space.
        The fix is added to swap1 that is executed as last script according to 
the rcorder output
        created in rc.shutdown.
        remark: If someone is using network swap space it may be already too 
late to do it here,
                but umounting in the swap2 script would happen too early and 
some problems with
                still running processes may pop up.
        It is clear that this fix will not solve all possible problems with 
"out of swap space" during
        shutdown. E.g. if there is more memroy allocated to processes than phys 
memory is available,
        this fix will help nothing. but in this case the kernel itself tries to 
work around the problem
        by killing some processes.

        The following patch will add the removeal of all tmpfs filesystems in 
        in front of the swapspace removal.

--- swap1       2009/07/22 12:32:13     1.1
+++ swap1       2009/07/22 12:32:24
@@ -29,6 +29,16 @@
        if checkyesno swapoff || [ -n "$rc_force" ]; then
                echo "Removing block-type swap devices"
+#      Check if there is tmpfs present.
+#      The problem is that we my hang in swapctl -U if there
+#      is not enougth physical memory to hold the contents.
+#      Remark: We assume that there are no other mount points inside of tmpfs
+#              and this will not solve the problem for more process memory
+#              than physical memory.
+               umount -aft tmpfs
                swapctl -U -t blk


Home | Main Index | Thread Index | Old Index