lkml.org 
[lkml]   [2013]   [Apr]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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()?


\
 
 \ /
  Last update: 2013-04-05 19:41    [W:0.168 / U:0.052 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site