linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Al Viro <viro@ZenIV.linux.org.uk>
To: Pekka J Enberg <penberg@cs.helsinki.fi>
Cc: alan@redhat.com, hch@infradead.org, peterz@infradead.org,
	linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org
Subject: Re: [RFC/PATCH 4/8] revoke: core code V7
Date: Sun, 13 Apr 2008 21:43:15 +0100	[thread overview]
Message-ID: <20080413204315.GQ9785@ZenIV.linux.org.uk> (raw)
In-Reply-To: <Pine.LNX.4.64.0712141716370.28689@sbz-30.cs.Helsinki.FI>

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?

      parent reply	other threads:[~2008-04-13 20:43 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-14 15:16 [RFC/PATCH 4/8] revoke: core code V7 Pekka J Enberg
2008-01-15 15:14 ` Peter Zijlstra
2008-01-15 17:27   ` Christoph Hellwig
2008-01-16  8:35     ` Pekka J Enberg
2008-04-13 20:43 ` Al Viro [this message]

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=20080413204315.GQ9785@ZenIV.linux.org.uk \
    --to=viro@zeniv.linux.org.uk \
    --cc=alan@redhat.com \
    --cc=hch@infradead.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=penberg@cs.helsinki.fi \
    --cc=peterz@infradead.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;
as well as URLs for NNTP newsgroup(s).