@@ -504,6 +504,29 @@ directory tree on the same or different underlying filesystem, and even
504
504
to a different machine. With the "inodes index" feature, trying to mount
505
505
the copied layers will fail the verification of the lower root file handle.
506
506
507
+ Nesting overlayfs mounts
508
+ ------------------------
509
+
510
+ It is possible to use a lower directory that is stored on an overlayfs
511
+ mount. For regular files this does not need any special care. However, files
512
+ that have overlayfs attributes, such as whiteouts or "overlay.*" xattrs will be
513
+ interpreted by the underlying overlayfs mount and stripped out. In order to
514
+ allow the second overlayfs mount to see the attributes they must be escaped.
515
+
516
+ Overlayfs specific xattrs are escaped by using a special prefix of
517
+ "overlay.overlay.". So, a file with a "trusted.overlay.overlay.metacopy" xattr
518
+ in the lower dir will be exposed as a regular file with a
519
+ "trusted.overlay.metacopy" xattr in the overlayfs mount. This can be nested by
520
+ repeating the prefix multiple time, as each instance only removes one prefix.
521
+
522
+ A lower dir with a regular whiteout will always be handled by the overlayfs
523
+ mount, so to support storing an effective whiteout file in an overlayfs mount an
524
+ alternative form of whiteout is supported. This form is a regular, zero-size
525
+ file with the "overlay.whiteout" xattr set, inside a directory with the
526
+ "overlay.whiteouts" xattr set. Such whiteouts are never created by overlayfs,
527
+ but can be used by userspace tools (like containers) that generate lower layers.
528
+ These alternative whiteouts can be escaped using the standard xattr escape
529
+ mechanism in order to properly nest to any depth.
507
530
508
531
Non-standard behavior
509
532
---------------------
0 commit comments