[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20130405171220.GD4068@ZenIV.linux.org.uk>
Date: Fri, 5 Apr 2013 18:12:20 +0100
From: Al Viro <viro@...IV.linux.org.uk>
To: Waiman Long <Waiman.Long@...com>
Cc: Jeff Layton <jlayton@...hat.com>,
Miklos Szeredi <mszeredi@...e.cz>, Ian Kent <raven@...maw.net>,
Sage Weil <sage@...tank.com>, Steve French <sfrench@...ba.org>,
Trond Myklebust <Trond.Myklebust@...app.com>,
Eric Paris <eparis@...hat.com>, linux-fsdevel@...r.kernel.org,
linux-kernel@...r.kernel.org, autofs@...r.kernel.org,
ceph-devel@...r.kernel.org, linux-cifs@...r.kernel.org,
samba-technical@...ts.samba.org, linux-nfs@...r.kernel.org,
"Chandramouleeswaran, Aswin" <aswin@...com>,
"Norton, Scott J" <scott.norton@...com>,
Andi Kleen <andi@...stfloor.org>,
Dave Chinner <david@...morbit.com>
Subject: Re: [PATCH v2 1/4] dcache: Don't take unnecessary lock in d_count
update
> @@ -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()?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists