Re: [RFC/PATCH 4/8] revoke: core code V7

From: Al Viro
Date: Sun Apr 13 2008 - 16:43:40 EST


On Fri, Dec 14, 2007 at 05:16:54PM +0200, Pekka J Enberg wrote:
> +static void revoke_aliases(struct inode *inode)
> +{
> + struct dentry *dentry;
> +restart:
> + spin_lock(&dcache_lock);
> + list_for_each_entry(dentry, &inode->i_dentry, d_alias) {
> + spin_lock(&dentry->d_lock);
> + if (!d_unhashed(dentry)) {
> + dget_locked(dentry);
> + __d_drop(dentry);
> + spin_unlock(&dentry->d_lock);
> + spin_unlock(&dcache_lock);
> + dput(dentry);
> + goto restart;
> + }
> + spin_unlock(&dentry->d_lock);
> + }
> + spin_unlock(&dcache_lock);
> +}

Don't do that to directories, kids...

> +static int revoke_files(struct inode *inode)
> +{
> + struct super_block *sb;
> + struct file *file;
> + int err = 0;
> +
> + sb = inode->i_sb;
> + if (!sb)
> + return -EINVAL;
> +
> +restart:
> + file_list_lock();
> + list_for_each_entry(file, &sb->s_files, f_u.fu_list) {
> + struct dentry *dentry = file->f_path.dentry;
> +
> + if (dentry->d_inode != inode)
> + continue;
> +
> + if (file->f_op != inode->i_fop)
> + continue;

Skip everything that has reassigned ->f_op in open()? That includes all
char devices, to start with...

> + err = file->f_op->revoke(file);
> + make_revoked_file(inode, file);

*Um*

Where exactly do we terminate operations in progress and how the devil is
locking supposed to be done in driver?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/