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.
Anyway, I say that the lock can be removed altogether. Ditto for mknod as
well.
-pat
-
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/