On Mon, Apr 24, 2017 at 3:59 PM, Vivek Goyal <vgoyal@xxxxxxxxxx> wrote: > > On Mon, Apr 24, 2017 at 12:14:06PM +0300, Amir Goldstein wrote: > > [..] > > diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c > > index c072a0c..671bac0 100644 > > --- a/fs/overlayfs/super.c > > +++ b/fs/overlayfs/super.c > > @@ -961,6 +961,7 @@ static int ovl_fill_super(struct super_block *sb, void *data, int silent) > > kfree(stack); > > > > root_dentry->d_fsdata = oe; > > + ovl_update_type(root_dentry, true); > > > > realinode = d_inode(ovl_dentry_real(root_dentry)); > > ovl_inode_init(d_inode(root_dentry), realinode, !!upperpath.dentry); > > diff --git a/fs/overlayfs/util.c b/fs/overlayfs/util.c > > index 1953986..6a857fb 100644 > > --- a/fs/overlayfs/util.c > > +++ b/fs/overlayfs/util.c > > @@ -70,21 +70,38 @@ bool ovl_dentry_weird(struct dentry *dentry) > > enum ovl_path_type ovl_path_type(struct dentry *dentry) > > { > > struct ovl_entry *oe = dentry->d_fsdata; > > - enum ovl_path_type type = 0; > > + enum ovl_path_type type = oe->__type; > > > > - if (oe->__upperdentry) { > > - type = __OVL_PATH_UPPER; > > + /* Matches smp_wmb() in ovl_update_type() */ > > + smp_rmb(); > > + return type; > > Hi Amir, > > I never manage to understand barriers so I will ask. Why this barrier is > required and what can go wrong if we don't use this barrier. > Hi Vivek, Miklos was kind enough to answer that question for me when he made the comment about missing memmory barrier on v1 of the patch: http://www.spinics.net/lists/linux-unionfs/msg01687.html Whether or not I got it right, we shall see shortly ;-) Amir.