Skip to content

Commit 9412812

Browse files
amir73ilMiklos Szeredi
authored andcommitted
ovl: document copying layers restrictions with inodes index
The inodes index feature introduces a behavior change - on mount, upper root origin file handle is verified to match the lower root dir. This implies that copied layers cannot be mounted with the inodes index feature enabled, without explicitly removing the upper dir origin xattr and the index dir. The inodes index feature is required to support: - Prevent breaking hardlinks on copy up - NFS export support (upcoming) - Overlayfs snapshots (POC) Signed-off-by: Amir Goldstein <[email protected]> Signed-off-by: Miklos Szeredi <[email protected]>
1 parent caf70cb commit 9412812

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

Documentation/filesystems/overlayfs.txt

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,40 @@ rightmost one and going left. In the above example lower1 will be the
201201
top, lower2 the middle and lower3 the bottom layer.
202202

203203

204+
Sharing and copying layers
205+
--------------------------
206+
207+
Lower layers may be shared among several overlay mounts and that is indeed
208+
a very common practice. An overlay mount may use the same lower layer
209+
path as another overlay mount and it may use a lower layer path that is
210+
beneath or above the path of another overlay lower layer path.
211+
212+
Using an upper layer path and/or a workdir path that are already used by
213+
another overlay mount is not allowed and will fail with EBUSY. Using
214+
partially overlapping paths is not allowed but will not fail with EBUSY.
215+
216+
Mounting an overlay using an upper layer path, where the upper layer path
217+
was previously used by another mounted overlay in combination with a
218+
different lower layer path, is allowed, unless the "inodes index" feature
219+
is enabled.
220+
221+
With the "inodes index" feature, on the first time mount, an NFS file
222+
handle of the lower layer root directory, along with the UUID of the lower
223+
filesystem, are encoded and stored in the "trusted.overlay.origin" extended
224+
attribute on the upper layer root directory. On subsequent mount attempts,
225+
the lower root directory file handle and lower filesystem UUID are compared
226+
to the stored origin in upper root directory. On failure to verify the
227+
lower root origin, mount will fail with ESTALE. An overlayfs mount with
228+
"inodes index" enabled will fail with EOPNOTSUPP if the lower filesystem
229+
does not support NFS export, lower filesystem does not have a valid UUID or
230+
if the upper filesystem does not support extended attributes.
231+
232+
It is quite a common practice to copy overlay layers to a different
233+
directory tree on the same or different underlying filesystem, and even
234+
to a different machine. With the "inodes index" feature, trying to mount
235+
the copied layers will fail the verification of the lower root file handle.
236+
237+
204238
Non-standard behavior
205239
---------------------
206240

0 commit comments

Comments
 (0)