linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Al Viro <viro@ZenIV.linux.org.uk>
To: Waiman Long <Waiman.Long@hp.com>
Cc: Jeff Layton <jlayton@redhat.com>,
	Miklos Szeredi <mszeredi@suse.cz>, Ian Kent <raven@themaw.net>,
	Sage Weil <sage@inktank.com>, Steve French <sfrench@samba.org>,
	Trond Myklebust <Trond.Myklebust@netapp.com>,
	Eric Paris <eparis@redhat.com>,
	linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
	autofs@vger.kernel.org, ceph-devel@vger.kernel.org,
	linux-cifs@vger.kernel.org, samba-technical@lists.samba.org,
	linux-nfs@vger.kernel.org, "Chandramouleeswaran,
	Aswin" <aswin@hp.com>, "Norton, Scott J" <scott.norton@hp.com>,
	Andi Kleen <andi@firstfloor.org>,
	Dave Chinner <david@fromorbit.com>
Subject: Re: [PATCH v2 1/4] dcache: Don't take unnecessary lock in d_count update
Date: Fri, 5 Apr 2013 18:12:20 +0100	[thread overview]
Message-ID: <20130405171220.GD4068@ZenIV.linux.org.uk> (raw)
In-Reply-To: <1365181061-30787-2-git-send-email-Waiman.Long@hp.com>

> @@ -635,22 +640,14 @@ struct dentry *dget_parent(struct dentry *dentry)
>  {
>  	struct dentry *ret;
>  
> -repeat:
> -	/*
> -	 * Don't need rcu_dereference because we re-check it was correct under
> -	 * the lock.
> -	 */
>  	rcu_read_lock();
> -	ret = dentry->d_parent;
> -	spin_lock(&ret->d_lock);
> -	if (unlikely(ret != dentry->d_parent)) {
> -		spin_unlock(&ret->d_lock);
> -		rcu_read_unlock();
> -		goto repeat;
> -	}
> +	ret = rcu_dereference(dentry->d_parent);
>  	rcu_read_unlock();
> +	if (dcount_inc_cmpxchg(ret))
> +		return ret;
> +	spin_lock(&ret->d_lock);

And WTF is going to protect your "ret" from being freed just as you'd done
rcu_read_unlock()?

  reply	other threads:[~2013-04-05 17:12 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-05 16:57 [PATCH v2 0/4] dcache: make dcache more scalable on large system Waiman Long
2013-04-05 16:57 ` [PATCH v2 1/4] dcache: Don't take unnecessary lock in d_count update Waiman Long
2013-04-05 17:12   ` Al Viro [this message]
     [not found]     ` <20130405171220.GD4068-3bDd1+5oDREiFSDQTTA3OLVCufUGDwFn@public.gmane.org>
2013-04-05 20:26       ` Waiman Long
2013-04-05 16:57 ` Waiman Long
2013-04-05 16:57 ` [PATCH RFC v2 2/4] dcache: introduce a new sequence read/write lock type Waiman Long
     [not found] ` <1365181061-30787-1-git-send-email-Waiman.Long-VXdhtT5mjnY@public.gmane.org>
2013-04-05 16:57   ` Waiman Long
2013-04-05 16:57   ` [PATCH v2 4/4] dcache: don't need to take d_lock in prepend_path() Waiman Long
2013-04-05 16:57 ` [PATCH v2 RFC 3/4] dcache: change rename_lock to a sequence read/write lock Waiman Long
2013-04-05 16:57 ` Waiman Long
2013-04-05 16:57 ` [PATCH v2 4/4] dcache: don't need to take d_lock in prepend_path() Waiman Long

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=20130405171220.GD4068@ZenIV.linux.org.uk \
    --to=viro@zeniv.linux.org.uk \
    --cc=Trond.Myklebust@netapp.com \
    --cc=Waiman.Long@hp.com \
    --cc=andi@firstfloor.org \
    --cc=aswin@hp.com \
    --cc=autofs@vger.kernel.org \
    --cc=ceph-devel@vger.kernel.org \
    --cc=david@fromorbit.com \
    --cc=eparis@redhat.com \
    --cc=jlayton@redhat.com \
    --cc=linux-cifs@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=mszeredi@suse.cz \
    --cc=raven@themaw.net \
    --cc=sage@inktank.com \
    --cc=samba-technical@lists.samba.org \
    --cc=scott.norton@hp.com \
    --cc=sfrench@samba.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).