• Miklos Szeredi's avatar
    ovl: don't copy up opaqueness · 5737dae5
    Miklos Szeredi authored
    commit 0956254a upstream.
    
    When a copy up of a directory occurs which has the opaque xattr set, the
    xattr remains in the upper directory. The immediate behavior with overlayfs
    is that the upper directory is not treated as opaque, however after a
    remount the opaque flag is used and upper directory is treated as opaque.
    This causes files created in the lower layer to be hidden when using
    multiple lower directories.
    
    Fix by not copying up the opaque flag.
    
    To reproduce:
    
     ----8<---------8<---------8<---------8<---------8<---------8<----
    mkdir -p l/d/s u v w mnt
    mount -t overlay overlay -olowerdir=l,upperdir=u,workdir=w mnt
    rm -rf mnt/d/
    mkdir -p mnt/d/n
    umount mnt
    mount -t overlay overlay -olowerdir=u:l,upperdir=v,workdir=w mnt
    touch mnt/d/foo
    umount mnt
    mount -t overlay overlay -olowerdir=u:l,upperdir=v,workdir=w mnt
    ls mnt/d
     ----8<---------8<---------8<---------8<---------8<---------8<----
    
    output should be:  "foo  n"
    Reported-by: default avatarDerek McGowan <dmcg@drizz.net>
    Link: https://bugzilla.kernel.org/show_bug.cgi?id=151291Signed-off-by: default avatarMiklos Szeredi <mszeredi@redhat.com>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    5737dae5
copy_up.c 9.3 KB