On Wed, Sep 11, 2019 at 01:05:37AM +0800, zhengbin wrote: > diff --git a/fs/dcache.c b/fs/dcache.c > index e88cf05..0a07671 100644 > --- a/fs/dcache.c > +++ b/fs/dcache.c > @@ -1767,6 +1767,16 @@ struct dentry *d_alloc(struct dentry * parent, const struct qstr *name) > struct dentry *dentry = __d_alloc(parent->d_sb, name); > if (!dentry) > return NULL; > + > + /* > + * need to ensure that dentry->d_child.next is initialized > + * (__d_alloc->INIT_LIST_HEAD) before dentry is added to > + * parent->d_subdirs, Otherwise in next_positive(do not have > + * spin_lock), we may visit uninitialized value because of cpu > + * run optimization(first add dentry to parent->d_subdirs). > + */ > + smp_wmb(); > + > spin_lock(&parent->d_lock); > /* > * don't need child lock because it is not subject > -- > 2.7.4 Unfortunately, that's not all - see the reply upthread ;-/