1. 05 7月, 2017 11 次提交
  2. 05 6月, 2017 1 次提交
  3. 29 5月, 2017 1 次提交
    • A
      ovl: mark upper merge dir with type origin entries "impure" · f3a15685
      Amir Goldstein 提交于
      An upper dir is marked "impure" to let ovl_iterate() know that this
      directory may contain non pure upper entries whose d_ino may need to be
      read from the origin inode.
      
      We already mark a non-merge dir "impure" when moving a non-pure child
      entry inside it, to let ovl_iterate() know not to iterate the non-merge
      dir directly.
      
      Mark also a merge dir "impure" when moving a non-pure child entry inside
      it and when copying up a child entry inside it.
      
      This can be used to optimize ovl_iterate() to perform a "pure merge" of
      upper and lower directories, merging the content of the directories,
      without having to read d_ino from origin inodes.
      Signed-off-by: NAmir Goldstein <amir73il@gmail.com>
      Signed-off-by: NMiklos Szeredi <mszeredi@redhat.com>
      f3a15685
  4. 19 5月, 2017 3 次提交
  5. 18 5月, 2017 1 次提交
  6. 05 5月, 2017 4 次提交
  7. 07 2月, 2017 2 次提交
  8. 16 12月, 2016 11 次提交
    • A
      ovl: clean up kstat usage · 32a3d848
      Al Viro 提交于
      FWIW, there's a bit of abuse of struct kstat in overlayfs object
      creation paths - for one thing, it ends up with a very small subset
      of struct kstat (mode + rdev), for another it also needs link in
      case of symlinks and ends up passing it separately.
      
      IMO it would be better to introduce a separate object for that.
      
      In principle, we might even lift that thing into general API and switch
       ->mkdir()/->mknod()/->symlink() to identical calling conventions.  Hell
      knows, perhaps ->create() as well...
      Signed-off-by: NMiklos Szeredi <mszeredi@redhat.com>
      32a3d848
    • A
      ovl: fold ovl_copy_up_truncate() into ovl_copy_up() · 9aba6521
      Amir Goldstein 提交于
      This removes code duplication.
      Signed-off-by: NAmir Goldstein <amir73il@gmail.com>
      Signed-off-by: NMiklos Szeredi <mszeredi@redhat.com>
      9aba6521
    • M
      ovl: opaque cleanup · 5cf5b477
      Miklos Szeredi 提交于
      oe->opaque is set for
      
       a) whiteouts
       b) directories having the "trusted.overlay.opaque" xattr
      
      Case b can be simplified, since setting the xattr always implies setting
      oe->opaque.  Also once set, the opaque flag is never cleared.
      
      Don't need to set opaque flag for non-directories.
      Signed-off-by: NMiklos Szeredi <mszeredi@redhat.com>
      5cf5b477
    • M
      ovl: redirect on rename-dir · a6c60655
      Miklos Szeredi 提交于
      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: NMiklos Szeredi <mszeredi@redhat.com>
      a6c60655
    • M
      ovl: lookup redirects · 02b69b28
      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: NMiklos Szeredi <mszeredi@redhat.com>
      02b69b28
    • M
      ovl: split super.c · bbb1e54d
      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: NMiklos Szeredi <mszeredi@redhat.com>
      bbb1e54d
    • M
      ovl: rename: simplify handling of lower/merged directory · 370e55ac
      Miklos Szeredi 提交于
      d_is_dir() is safe to call on a negative dentry.  Use this fact to simplify
      handling of the lower or merged directories.
      Signed-off-by: NMiklos Szeredi <mszeredi@redhat.com>
      370e55ac
    • M
      ovl: get rid of PURE type · 38e813db
      Miklos Szeredi 提交于
      The remainging uses of __OVL_PATH_PURE can be replaced by
      ovl_dentry_is_opaque().
      Signed-off-by: NMiklos Szeredi <mszeredi@redhat.com>
      38e813db
    • M
      ovl: check lower existence when removing · 2aff4534
      Miklos Szeredi 提交于
      Currently ovl_lookup() checks existence of lower file even if there's a
      non-directory on upper (which is always opaque).  This is done so that
      remove can decide whether a whiteout is needed or not.
      
      It would be better to defer this check to unlink, since most of the time
      the gathered information about opaqueness will be unused.
      
      This adds a helper ovl_lower_positive() that checks if there's anything on
      the lower layer(s).
      
      The following patches also introduce changes to how the "opaque" attribute
      is updated on directories: this attribute is added when the directory is
      creted or moved over a whiteout or object covering something on the lower
      layer.  However following changes will allow the attribute to remain on the
      directory after being moved, even if the new location doesn't cover
      anything.  Because of this, we need to check lower layers even for opaque
      directories, so that whiteout is only created when necessary.
      
      This function will later be also used to decide about marking a directory
      opaque, so deal with negative dentries as well.  When dealing with
      negative, it's enough to check for being a whiteout
      
      If the dentry is positive but not upper then it also obviously needs
      whiteout/opaque.
      Signed-off-by: NMiklos Szeredi <mszeredi@redhat.com>
      2aff4534
    • M
      ovl: add ovl_dentry_is_whiteout() · c412ce49
      Miklos Szeredi 提交于
      And use it instead of ovl_dentry_is_opaque() where appropriate.
      Signed-off-by: NMiklos Szeredi <mszeredi@redhat.com>
      c412ce49
    • M
      ovl: treat special files like a regular fs · ca4c8a3a
      Miklos Szeredi 提交于
      No sense in opening special files on the underlying layers, they work just
      as well if opened on the overlay.
      
      Side effect is that it's no longer possible to connect one side of a pipe
      opened on overlayfs with the other side opened on the underlying layer.
      Signed-off-by: NMiklos Szeredi <mszeredi@redhat.com>
      ca4c8a3a
  9. 27 9月, 2016 1 次提交
  10. 01 9月, 2016 4 次提交
    • A
      ovl: Switch to generic_getxattr · 0eb45fc3
      Andreas Gruenbacher 提交于
      Now that overlayfs has xattr handlers for iop->{set,remove}xattr, use
      those same handlers for iop->getxattr as well.
      Signed-off-by: NAndreas Gruenbacher <agruenba@redhat.com>
      Signed-off-by: NMiklos Szeredi <mszeredi@redhat.com>
      0eb45fc3
    • A
      ovl: Switch to generic_removexattr · 0e585ccc
      Andreas Gruenbacher 提交于
      Commit d837a49b ("ovl: fix POSIX ACL setting") switches from
      iop->setxattr from ovl_setxattr to generic_setxattr, so switch from
      ovl_removexattr to generic_removexattr as well.  As far as permission
      checking goes, the same rules should apply in either case.
      
      While doing that, rename ovl_setxattr to ovl_xattr_set to indicate that
      this is not an iop->setxattr implementation and remove the unused inode
      argument.
      
      Move ovl_other_xattr_set above ovl_own_xattr_set so that they match the
      order of handlers in ovl_xattr_handlers.
      Signed-off-by: NAndreas Gruenbacher <agruenba@redhat.com>
      Fixes: d837a49b ("ovl: fix POSIX ACL setting")
      Signed-off-by: NMiklos Szeredi <mszeredi@redhat.com>
      0e585ccc
    • A
      ovl: Fix OVL_XATTR_PREFIX · fe2b7595
      Andreas Gruenbacher 提交于
      Make sure ovl_own_xattr_handler only matches attribute names starting
      with "overlay.", not "overlayXXX".
      Signed-off-by: NAndreas Gruenbacher <agruenba@redhat.com>
      Fixes: d837a49b ("ovl: fix POSIX ACL setting")
      Signed-off-by: NMiklos Szeredi <mszeredi@redhat.com>
      fe2b7595
    • M
      ovl: proper cleanup of workdir · eea2fb48
      Miklos Szeredi 提交于
      When mounting overlayfs it needs a clean "work" directory under the
      supplied workdir.
      
      Previously the mount code removed this directory if it already existed and
      created a new one.  If the removal failed (e.g. directory was not empty)
      then it fell back to a read-only mount not using the workdir.
      
      While this has never been reported, it is possible to get a non-empty
      "work" dir from a previous mount of overlayfs in case of crash in the
      middle of an operation using the work directory.
      
      In this case the left over state should be discarded and the overlay
      filesystem will be consistent, guaranteed by the atomicity of operations on
      moving to/from the workdir to the upper layer.
      
      This patch implements cleaning out any files left in workdir.  It is
      implemented using real recursion for simplicity, but the depth is limited
      to 2, because the worst case is that of a directory containing whiteouts
      under "work".
      Signed-off-by: NMiklos Szeredi <mszeredi@redhat.com>
      Cc: <stable@vger.kernel.org>
      eea2fb48
  11. 08 8月, 2016 1 次提交
    • M
      ovl: don't copy up opaqueness · 0956254a
      Miklos Szeredi 提交于
      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: NDerek McGowan <dmcg@drizz.net>
      Link: https://bugzilla.kernel.org/show_bug.cgi?id=151291Signed-off-by: NMiklos Szeredi <mszeredi@redhat.com>
      Cc: <stable@vger.kernel.org>
      0956254a