Re: [NOT FIXED] Re: umount2

From: Alexander Viro (viro@math.psu.edu)
Date: Sat Apr 15 2000 - 07:47:00 EST


On Sat, 15 Apr 2000, Russell King wrote:

> After bootup, if I do the following:
>
> (login as root)
> # shutdown -t3 now
> (wait for single user, kill off minilogd and kerneld if running - why kerneld???)

Ask yourself - your box, your rc scripts...

> # ps ax
> -> shows init, kswapd, kflushd, kupdate, init, /bin/sh and ps ax running

        ? init shown twice?

> # umount -av
> none umounted
> none umounted
> /dev/hda6 umounted
> /dev/hda5 umounted
> umount: /var: device is busy
> /dev/hda1 umounted

Huh? What about more verbose output?

> # mount
> /dev/hda1 on / type ext2 (rw)
> none on /proc type proc (rw)
> /dev/hda3 on /var type ext2 (rw)
> # ls -al /proc/*/fd
> (does not show anything located in /var)
> # echo 1 > /proc/sys/kernel/sysrq
> SysRq: Emergency Remount R/O
> Remounting device 03:01 ... R/O
> Remounting device 03:03 ... OK
> Done.
> # umount /var
> umount: /var: device is busy

Urgh. What about doing the following trick: in fs/super.c::do_umount(),
after shrink_dcache() insert
{
        struct dentry *root = sb->s_root;
        static char buf[4096];
        struct dentry *this_parent = root;
        struct list_head *next;
        int count = root->d_count;

repeat:
        next = this_parent->d_subdirs.next;
resume:
        while (next != &this_parent->d_subdirs) {
                struct list_head *tmp = next;
                struct dentry *dentry = list_entry(tmp, struct dentry, d_child);
                next = tmp->next;
                /* Decrement count for unused children */
                count += (dentry->d_count - 1);
                if (!list_empty(&dentry->d_subdirs)) {
                        this_parent = dentry;
                        goto repeat;
                }
                /* root is busy if any leaf is busy */
                if (dentry->d_count)
                        printk("umount: busy (%s)\n", __d_path(dentry, NULL, root, NULL, buf, 4096));
        }
        /*
         * All done at this level ... ascend and resume the search.
         */
        if (this_parent != root) {
                next = this_parent->d_child.next;
                this_parent = this_parent->d_parent;
                goto resume;
        }
}

and see what it will tell you on umount.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sat Apr 15 2000 - 21:00:26 EST