There are cases where you want to use an overlayfs mount as a lowerdir for another overlayfs mount. For example, if the system rootfs is on overlayfs due to composefs, or to make it volatile (via tmps), then you cannot currently store a lowerdir on the rootfs, becasue the inner overlayfs will eat all the whiteouts and overlay xattrs. This means you can't e.g. store on the rootfs a prepared container image for use using overlayfs. This patch series adds support for nesting of overlayfs mounts by escaping the problematic features on and unescaping them when exposing to the overlayfs user. This series is also available here: https://github.com/alexlarsson/linux/tree/ovl-nesting And xfstest to test it is available here: https://github.com/alexlarsson/xfstests/tree/overlayfs-nesting Changes since v1: * Moved all xattr handling to xattr.c * Made creation of escaped whiteouts atomic Alexander Larsson (5): ovl: Move xattr support to new xattrs.c file ovl: Add OVL_XATTR_TRUSTED/USER_PREFIX_LEN macros ovl: Support escaped overlay.* xattrs ovl: Support creation of whiteout files on overlayfs ovl: Add documentation on nesting of overlayfs mounts Documentation/filesystems/overlayfs.rst | 22 ++ fs/overlayfs/Makefile | 2 +- fs/overlayfs/dir.c | 24 ++- fs/overlayfs/inode.c | 124 ----------- fs/overlayfs/namei.c | 14 +- fs/overlayfs/overlayfs.h | 40 +++- fs/overlayfs/readdir.c | 7 +- fs/overlayfs/super.c | 67 +----- fs/overlayfs/util.c | 20 ++ fs/overlayfs/xattrs.c | 268 ++++++++++++++++++++++++ 10 files changed, 376 insertions(+), 212 deletions(-) create mode 100644 fs/overlayfs/xattrs.c -- 2.41.0