Ensure that st_ino is unique for a mountpoint #452
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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]