From: Dave Hansen <haveblue@us.ibm.com>
To: Patrick Mochel <mochel@osdl.org>
Cc: Greg KH <gregkh@us.ibm.com>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] remove BKL from driverfs
Date: Sun, 07 Jul 2002 17:41:02 -0700 [thread overview]
Message-ID: <3D28DF9E.20907@us.ibm.com> (raw)
In-Reply-To: Pine.LNX.4.33.0207051043120.8496-100000@geena.pdx.osdl.net
Patrick Mochel wrote:
>>>I see no reason to hold the BKL in your situation. I replaced it with
>>>i_sem in some places and just plain removed it in others. I believe
>>>that you get all of the protection that you need from dcache_lock in
>>>the dentry insert and activate. Can you prove me wrong?
>>
>>No, and I'm not about to try very hard. It appears that the place you
>>removed it should be fine. In driverfs_unlink, you replace it with i_sem.
>>ramfs, which driverfs mimmicks, doesn't hold any lock during unlink. It
>>seems it could be removed altogether.
>
>
> Actually, taking i_sem is completely wrong. Look at vfs_unlink() in
> fs/namei.c:
>
> down(&dentry->d_inode->i_sem);
> if (d_mountpoint(dentry))
> error = -EBUSY;
> else {
> error = dir->i_op->unlink(dir, dentry);
> if (!error)
> d_delete(dentry);
> }
> up(&dentry->d_inode->i_sem);
>
> Then, in driverfs_unlink:
>
> struct inode *inode = dentry->d_inode;
>
> down(&inode->i_sem);
>
>
> You didn't test this on file removal did you? A good way to verify that
> you have most of your bases covered is to plug/unplug a USB device a few
> times. I learned that one from Greg, and it's caught several bugs.
I need to get some USB devices that work in Linux!
> Anyway, I say that the lock can be removed altogether. Ditto for mknod as
> well.
I agree. It looks like vfs_unlink() provides all of the protection
that is needed. No BKL, no more i_sem uses. I'm asking Al Viro about
driverfs_get_inode(). It looks like it will be safe and correct to
use i_sem there, but stay tuned, it may not be necessary at all.
--
Dave Hansen
haveblue@us.ibm.com
next prev parent reply other threads:[~2002-07-08 0:38 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-07-04 6:26 [PATCH] remove BKL from driverfs Dave Hansen
2002-07-04 7:10 ` Greg KH
2002-07-04 7:26 ` Dave Hansen
2002-07-04 22:23 ` Greg KH
2002-07-04 23:38 ` Dave Hansen
2002-07-04 23:58 ` Alexander Viro
2002-07-05 0:08 ` Dave Hansen
2002-07-05 17:09 ` Patrick Mochel
2002-07-05 17:47 ` Patrick Mochel
2002-07-08 0:41 ` Dave Hansen [this message]
2002-07-08 2:43 ` Greg KH
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=3D28DF9E.20907@us.ibm.com \
--to=haveblue@us.ibm.com \
--cc=gregkh@us.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mochel@osdl.org \
/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