linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: Barry Naujok <bnaujok@sgi.com>
Cc: Anton Altaparmakov <aia21@cam.ac.uk>,
	Christoph Hellwig <hch@infradead.org>,
	xfs@oss.sgi.com, linux-fsdevel <linux-fsdevel@vger.kernel.org>
Subject: Re: [PATCH 3/4] XFS: Return case-insensitive match for dentry cache
Date: Tue, 20 May 2008 14:23:15 -0400	[thread overview]
Message-ID: <20080520182315.GA8456@infradead.org> (raw)
In-Reply-To: <op.ubfkzvjx3jf8g2@pc-bnaujok.melbourne.sgi.com>

On Tue, May 20, 2008 at 12:24:57PM +1000, Barry Naujok wrote:
> +/**
> + * d_drop_neg_children - drop negative child dentries
> + * @parent: parent dentry
> + *
> + * Searches the children of the @parent dentry for negative dentries and
> + * drops them as they are found.
> + *
> + * This is primarily useful for case-insensitive filesystems to drop these
> + * entries when a new entry is created in the parent. The new entry must
> + * be instantiated before calling this function.
> + */
> +
> +void d_drop_neg_children(struct dentry *parent)

please spell out the negative :)  also no empty line between the
kerneldoc sand the actual function please.

> +{
> +	struct dentry *dentry;
> +
> +	spin_lock(&dcache_lock);
> +	list_for_each_entry(dentry, &parent->d_subdirs, d_u.d_child) {
> +		if (!dentry->d_inode) {
> +			spin_lock(&dentry->d_lock);
> +			__d_drop(dentry);
> +			spin_unlock(&dentry->d_lock);
> +			cond_resched_lock(&dcache_lock);

The cond_resched_lock here is not safe here, because the pointer you
are going to dereference in list_for_each_entry might not be valid
anymore.  This should look more like:

void d_drop_negative_children(struct dentry *parent)
{
	struct dentry *dentry;

 again:
	spin_lock(&dcache_lock);
	list_for_each_entry(dentry, &parent->d_subdirs, d_u.d_child) {
		if !dentry->d_inode)
			continue;

		spin_lock(&dentry->d_lock);
		__d_drop(dentry);
		spin_unlock(&dentry->d_lock);

		if (need_resched()) {
			spin_unlock(&dcache_lock);
			cond_resched();
			goto again;
		}
	}
	spin_unlock(&dcache_lock);
}


Btw, any reason you haven't commited patches 1 and 2 yet?  Also maybe
splitting 3 and 4 differently with one patch for the two new functions
in dcache.c and one for the full XFS ascii CI support might be best.

  reply	other threads:[~2008-05-20 18:23 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-13  7:57 [PATCH 0/4] XFS: Case-insensitive support - ASCII only Barry Naujok
2008-05-13  7:57 ` [PATCH 1/4] XFS: Name operation vector for hash and compare Barry Naujok
2008-05-13  8:31   ` Christoph Hellwig
2008-05-13  7:57 ` [PATCH 2/4] XFS: add op_flags field and helpers to xfs_da_args Barry Naujok
2008-05-13  8:34   ` Christoph Hellwig
2008-05-14  6:12     ` Barry Naujok
2008-05-13  7:57 ` [PATCH 3/4] XFS: Return case-insensitive match for dentry cache Barry Naujok
2008-05-13  8:57   ` Christoph Hellwig
2008-05-14  6:15     ` Barry Naujok
2008-05-14  7:55     ` Barry Naujok
2008-05-15  4:57       ` Christoph Hellwig
2008-05-15  5:14         ` Barry Naujok
2008-05-15 13:43           ` Anton Altaparmakov
2008-05-15 14:11             ` Christoph Hellwig
2008-05-16  0:30               ` Barry Naujok
2008-05-16  7:25               ` Anton Altaparmakov
2008-05-20  2:24             ` Barry Naujok
2008-05-20 18:23               ` Christoph Hellwig [this message]
2008-05-20 20:50                 ` Sunil Mushran
2008-05-13  7:57 ` [PATCH 4/4] XFS: ASCII case-insensitive support Barry Naujok
2008-05-13  8:58   ` Christoph Hellwig
  -- strict thread matches above, loose matches on Subject: below --
2008-05-14  7:52 [PATCH 0/4] XFS: ASCII case-insensitivity support Barry Naujok
2008-05-14  7:52 ` [PATCH 3/4] XFS: Return case-insensitive match for dentry cache Barry Naujok

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=20080520182315.GA8456@infradead.org \
    --to=hch@infradead.org \
    --cc=aia21@cam.ac.uk \
    --cc=bnaujok@sgi.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=xfs@oss.sgi.com \
    /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).