On 08/26/2011 04:00 AM, Thomas Bächler wrote:
Am 26.08.2011 07:49, schrieb Gerardo Exequiel Pozzi:
On 08/24/2011 08:23 PM, Gerardo Exequiel Pozzi wrote:
STATUS:
      Works for standard boot and with cow_device :)
TODO:
      Testing needed for archiso_loop_mnt and archiso_pxe_nbd
      Also for copytoram=y, and mix of options/hooks.
NEEDS:
      This commit [#2] in initscripts to work (no release at this time).
      Also this other [#3] for mkinitcpio (fix /run that is mounted as
noexec)

This hook is based on work from Tom Gundersen[#1], but adapted for
archiso things.

Motivation for this is for unmount property all filesystem, mostly for
dm-snapshot persistent.

[#1]
http://mailman.archlinux.org/pipermail/arch-projects/2011-July/001549.html

[#2]
http://projects.archlinux.org/initscripts.git/commit/?id=1fa7b4b453e96533ae1db3630031285e5fc302b3

[#3]
http://mailman.archlinux.org/pipermail/arch-projects/2011-August/001749.html

+
+# Lazy unmount /oldroot and all things inside.
+umount -l /oldroot
+
+# Remove all dm-snapshot devices.
+dmsetup remove_all
+
+# Detach each loop device in reverse order (archiso start from 100 to
N).
+for _lup in $(ls -r /dev/loop???); do
+    losetup -d ${_lup}
+done
+

@Thomas: If you do not want lazy unmount, then these are the commands
needed.
Looks good to me. I am not against lazy umount in principle, if you have
a way of making sure that the umount finished.

I have the way, but you did not like. Maybe I did not explain well on IRC.

You need to look for block fs at /proc/filesystem and for each one, look at /sys/module/$fs/refcnt if it is 0 (zero).

for _fs in $(awk '$1 !~ /^nodev/ { print $1}' /proc/filesystems); do
    echo ${_fs} $(cat /sys/module/${_fs}/refcnt)
done

----
INIT: version 2.88 reloading
udf 0
xfs 0
squashfs 0
ext4 0
[  188.509060] sd 0:0:0:0: [sda] Stopping disk
[  188.510270] ACPI: Preparing to enter system sleep state S5
[  188.511209] Disabling non-boot CPUs ...
[  188.511842] Power down.
[  188.513144] acpi_power_off called
----

If you ask me how to do this is filesystem are built-in in kernel, I do not know.

--
Gerardo Exequiel Pozzi
\cos^2\alpha + \sin^2\alpha = 1

Reply via email to