On 08/26/2011 06:10 AM, Thomas Bächler wrote:
Am 26.08.2011 10:48, schrieb Gerardo Exequiel Pozzi:
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 ---- Hm, I did not see that, or misinterpreted it. Looks good, but ...
If you ask me how to do this is filesystem are built-in in kernel, I do not know. Yes, it only works for modules. If we had refcounts for the block devices themselves, that would be great. Yes look at /proc/devices for blocks devs then: /sys/module/sd_mod/refcnt /sys/module/loop/refcnt etc, etc...
In our kernel, we do not have built-in file systems, but it is still not a generic solution.
Looks like we are going beyond what we can see... This is more heuristic, if you have already unmounted all filesystem, is the task of the kernel to flush buffers for each block device, then (if apply) sync device cache and stop it! Anyway, so that everyone is happy and friendly, I will use non-lazy optionIts working fine. -- Gerardo Exequiel Pozzi \cos^2\alpha + \sin^2\alpha = 1