[arch-releng] [DRAFT] [archiso] Add archiso_shutdown hook.

Gerardo Exequiel Pozzi vmlinuz386 at yahoo.com.ar
Fri Aug 26 14:24:33 EDT 2011

On 08/26/2011 06:58 AM, Thomas Bächler wrote:
> Am 26.08.2011 11:43, schrieb Gerardo Exequiel Pozzi:
>>> 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...
> Those are kernel modules, not block devices. Depending on kernel
> configuration, they might be present or not.
Sure those are an abstraction of block devices that you have (real or 
> What I am looking for is a counter for the block device itself (LVM
> shows the "open count", I would hope that is not dm-specific).
Not per device, but for the whole abstraction:

Again /sys/module/$blk/refcnt, but seems that needs an example to trust me:

# exec 6< /dev/sda
# cat /sys/module/sd_mod/refcnt
# exec 6< /dev/sda1
# cat /sys/module/sd_mod/refcnt
# exec 8< /dev/sdb
# cat /sys/module/sd_mod/refcnt

>>> 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!
> Sure, that is the kernel's job. But it would also be the kernel's job to
> tell userspace when it actually finished doing so.
That is another issue :)

You can still use sysrq:

for sysrq in S U; do echo $sysrq > /proc/sysrq-trigger ;done

the look for "Emergency Sync complete" and "mergency Remount complete"

but sounds something paranoid.

>> Anyway, so that everyone is happy and friendly, I will use non-lazy
>> optionIts working fine.
> In any case, the lazy umount looks useful for the general use case,
> beyond archiso, if we can solve this.
Yes, at least I, this is what I know.

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

More information about the arch-releng mailing list