public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Signal9 <signal9@gmx.net>
To: Alexander Viro <viro@math.psu.edu>
Cc: linux-kernel@vger.kernel.org
Subject: Re: possible bug in VFS ?
Date: Sat, 13 Oct 2001 12:32:15 +0000	[thread overview]
Message-ID: <01101312321500.00286@apocalipsis> (raw)
In-Reply-To: <Pine.GSO.4.21.0110122004080.76-100000@weyl.math.psu.edu>
In-Reply-To: <Pine.GSO.4.21.0110122004080.76-100000@weyl.math.psu.edu>

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;
}

  reply	other threads:[~2001-10-13 10:18 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-10-13  1:50 possible bug in VFS ? Signal9
2001-10-13  0:06 ` Alexander Viro
2001-10-13 12:32   ` Signal9 [this message]
2001-10-13 15:35     ` Alexander Viro

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=01101312321500.00286@apocalipsis \
    --to=signal9@gmx.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=viro@math.psu.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox