Skip to content

Conversation

@tjwoodall
Copy link

st_ino needs to be unique for all inodes on a device otherwise things like mmap can become confused.

When all the layers are on the same device we pass the st_ino from the underlying device through to stat/readdir.

If they are not on the same device then, by default, we pass through the nodeid instead. This is guaranteed to be unique but is not stable across mounts. For almost all usecases this is sufficient (and as fast as passing through st_dev)

Additionally we add --xino={on,auto,off}
xino=off is the same as not passing it above, use st_dev or nodeid as above.
xino=on requires that nfs-filehandles are available on all the layers and we use a hash of the filehandle as st_dev where we would use nodeid otherwise. The mount will fail if nfs-filehandles are not supported, even if all the files are on the same layer.
xino=auto will use nfs-filehandles in place of nodeid if they are available but will fall back to nodeid if they are not available.

Note that we always use passthrough st_ino if all the layers are on the same device regardless of the xino setting.

One other change, where FUSE_CAP_NO_EXPORT_SUPPORT is supported by fuse, if the fuse-overlayfs inodes are not stable across mounts then we prevent the fuse-overlayfs mount from being used with nfs filehandles. N.B. If all the layers are on the same underlying device then we do NOT check that that supports NFS filehandles/has stable inodes across mounts. We are only considering un-mounting and re-mounting the fuse-overlayfs device with regards to stable inodes, not re-mounts of the underlying layers.

Signed-off-by: Tim Woodall [email protected]

mmap depends on st_ino being unique for all files on a device.

When all the layers are on the same device we pass the st_ino from the
underlying device through to stat/readdir. This is identical to previous
behaviour.

If they are not on the same device then, by default, we pass through the
nodeid instead. This is guaranteed to be unique but is not stable across
mounts. For almost all usecases this is sufficient (and as fast as
passing through st_dev)

Additionally we add --xino={on,auto,off}
xino=off is the same as not passing it above, use st_dev or nodeid as
above.
xino=on requires that nfs-filehandles are available on all the layers
and we use a hash of the filehandle as st_dev where we would use nodeid
otherwise. The mount will fail if nfs-filehandles are not supported,
even if all the files are on the same layer.
xino=auto will use nfs-filehandles in place of nodeid if they are
available but will fall back to nodeid if they are not available.

Note that we always use passthrough st_ino if all the layers are on the
same device regardless of the xino setting.

One other change, where FUSE_CAP_NO_EXPORT_SUPPORT is supported by fuse,
if the fuse-overlayfs inodes are not stable across mounts then we
prevent the fuse-overlayfs mount from being used with nfs filehandles.
N.B. If all the layers are on the same underlying device then we do NOT
check that that supports NFS filehandles/has stable inodes across
mounts. We are only considering un-mounting and re-mounting the
fuse-overlayfs device with regards to stable inodes, not re-mounts of
the underlying layers.

Signed-off-by: Tim Woodall <[email protected]>
@tjwoodall
Copy link
Author

Don't know if I've got unlucky but I've found a case where it doesn't work when being used to host a system with 32 bit st_ino. Need to investigate what is going wrong there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant