Re: possible bug in VFS ?

From: Signal9 (signal9@gmx.net)
Date: Sat Oct 13 2001 - 07:32:15 EST


On Saturday 13 October 2001 00:06, you wrote:
> On Sat, 13 Oct 2001, Signal9 wrote:
> > root = current->fs->rootmnt;
> > list_for_each(ptr, &root->mnt_list) {
> > mnt = list_entry(ptr, struct vfsmount, mnt_list);
> > sb = mnt ? mnt->mnt_sb : NULL;
> > if (NULL != sb && dev == sb->s_dev)
> > <============ mntget(mnt);
> > }
>
> What the hell is it trying to do?

 Here goes the complete function:
static
int bc_lock_dev(struct bc_disk *bd, struct bc_device *bc, kdev_t dev,
                int lock)
{
        struct super_block *sb;
        struct vfsmount *mnt, *root;
        struct list_head *ptr;

        if (!capable(CAP_SYS_ADMIN))
                return -EPERM;

        if (!bd->bd_flags.configured) {
                if (!lock)
                        return 0;
                printk(KERN_ERR "bc: attempt to lock free device.\n");
                return -ENXIO;
        }

        if (lock && !bd->bd_flags.mounted) {
                root = current->fs->rootmnt;
                list_for_each(ptr, &root->mnt_list) {
                        mnt = list_entry(ptr, struct vfsmount, mnt_list);
                        sb = mnt ? mnt->mnt_sb : NULL;
             
                   printk (KERN_WARNING "\n\n[++++] The pointer to sb is: %08x\nAnd
the name is: %s\n\n",
                                        sb, mnt->mnt_devname);
             
                   if (NULL != sb && dev == sb->s_dev)
                                        mntget(mnt);
                }
                bd->bd_flags.mounted = 1;
                bc->bc_refcnt++;
        } else if (!lock && bd->bd_flags.mounted) {
                root = current->fs->rootmnt;
                list_for_each(ptr, &root->mnt_list) {
                        mnt = list_entry(ptr, struct vfsmount, mnt_list);
                        sb = mnt ? mnt->mnt_sb : NULL;

                        if (NULL != sb && dev == sb->s_dev)
                                        mntget(mnt);
                }
                bd->bd_flags.mounted = 0;
                bc->bc_refcnt--;
       }
        return 0;
}
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Mon Oct 15 2001 - 21:00:48 EST