25 Dec, 2017

1 commit

  • commit 3382290ed2d5e275429cef510ab21889d3ccd164 upstream.

    [ Note, this is a Git cherry-pick of the following commit:

    506458efaf15 ("locking/barriers: Convert users of lockless_dereference() to READ_ONCE()")

    ... for easier x86 PTI code testing and back-porting. ]

    READ_ONCE() now has an implicit smp_read_barrier_depends() call, so it
    can be used instead of lockless_dereference() without any change in
    semantics.

    Signed-off-by: Will Deacon
    Cc: Linus Torvalds
    Cc: Paul E. McKenney
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Link: http://lkml.kernel.org/r/1508840570-22169-4-git-send-email-will.deacon@arm.com
    Signed-off-by: Ingo Molnar
    Signed-off-by: Greg Kroah-Hartman

    Will Deacon
     

05 Oct, 2017

1 commit

  • Enforcing exclusive ownership on upper/work dirs caused a docker
    regression: https://github.com/moby/moby/issues/34672.

    Euan spotted the regression and pointed to the offending commit.
    Vivek has brought the regression to my attention and provided this
    reproducer:

    Terminal 1:

    mount -t overlay -o workdir=work,lowerdir=lower,upperdir=upper none
    merged/

    Terminal 2:

    unshare -m

    Terminal 1:

    umount merged
    mount -t overlay -o workdir=work,lowerdir=lower,upperdir=upper none
    merged/
    mount: /root/overlay-testing/merged: none already mounted or mount point
    busy

    To fix the regression, I replaced the error with an alarming warning.
    With index feature enabled, mount does fail, but logs a suggestion to
    override exclusive dir protection by disabling index.
    Note that index=off mount does take the inuse locks, so a concurrent
    index=off will issue the warning and a concurrent index=on mount will fail.

    Documentation was updated to reflect this change.

    Fixes: 2cac0c00a6cd ("ovl: get exclusive ownership on upper/work dirs")
    Cc: # v4.13
    Reported-by: Euan Kemp
    Reported-by: Vivek Goyal
    Signed-off-by: Amir Goldstein
    Signed-off-by: Miklos Szeredi

    Amir Goldstein
     

05 Jul, 2017

10 commits


19 May, 2017

1 commit

  • When moving a merge dir or non-dir with copy up origin into a non-merge
    upper dir (a.k.a pure upper dir), we are marking the target parent dir
    "impure". ovl_iterate() iterates pure upper dirs directly, because there is
    no need to filter out whiteouts and merge dir content with lower dir. But
    for the case of an "impure" upper dir, ovl_iterate() will not be able to
    iterate the real upper dir directly, because it will need to lookup the
    origin inode and use it to fill d_ino.

    Signed-off-by: Amir Goldstein
    Signed-off-by: Miklos Szeredi

    Amir Goldstein
     

18 May, 2017

1 commit


05 May, 2017

1 commit

  • Some features can only work when all layers are on the same fs. Test this
    condition during mount time, so features can check them later.

    Add helper ovl_same_sb() to return the common super block in case all
    layers are on the same fs.

    Signed-off-by: Amir Goldstein
    Signed-off-by: Miklos Szeredi

    Amir Goldstein
     

07 Feb, 2017

2 commits


16 Dec, 2016

4 commits

  • Current code returns EXDEV when a directory would need to be copied up to
    move. We could copy up the directory tree in this case, but there's
    another, simpler solution: point to old lower directory from moved upper
    directory.

    This is achieved with a "trusted.overlay.redirect" xattr storing the path
    relative to the root of the overlay. After such attribute has been set,
    the directory can be moved without further actions required.

    This is a backward incompatible feature, old kernels won't be able to
    correctly mount an overlay containing redirected directories.

    Signed-off-by: Miklos Szeredi

    Miklos Szeredi
     
  • If a directory has the "trusted.overlay.redirect" xattr, it means that the
    value of the xattr should be used to find the underlying directory on the
    next lower layer.

    The redirect may be relative or absolute. Absolute redirects begin with a
    slash.

    A relative redirect means: instead of the current dentry's name use the
    value of the redirect to find the directory in the next lower
    layer. Relative redirects must not contain a slash.

    An absolute redirect means: look up the directory relative to the root of
    the overlay using the value of the redirect in the next lower layer.

    Redirects work on lower layers as well.

    Signed-off-by: Miklos Szeredi

    Miklos Szeredi
     
  • We already calculate f_namelen in statfs as the maximum of the name lengths
    provided by the filesystems taking part in the overlay.

    Signed-off-by: Miklos Szeredi

    Miklos Szeredi
     
  • fs/overlayfs/super.c is the biggest of the overlayfs source files and it
    contains various utility functions as well as the rather complicated lookup
    code. Split these parts out to separate files.

    Before:

    1446 fs/overlayfs/super.c

    After:

    919 fs/overlayfs/super.c
    267 fs/overlayfs/namei.c
    235 fs/overlayfs/util.c
    51 fs/overlayfs/ovl_entry.h

    Signed-off-by: Miklos Szeredi

    Miklos Szeredi