lkml.org 
[lkml]   [2001]   [Oct]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: possible bug in VFS ?
Date
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/

\
 
 \ /
  Last update: 2005-03-22 13:08    [W:0.071 / U:0.516 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site