Skip to content

Commit

Permalink
env: fix handling of long lowerdir paths in newer kernel/mount versions
Browse files Browse the repository at this point in the history
The new "lowerdir+" option can be used to specify multiple layers
when mounting. This avoids a limitation with the "lowerdir" option which
is limited to a max of 256 characters.

Fixes: #968
  • Loading branch information
davvid committed Dec 28, 2024
1 parent 6cadc75 commit b23fc83
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions crates/spfs/src/env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1126,11 +1126,12 @@ pub(crate) fn get_overlay_args<P: AsRef<Path>>(
// the rightmost on the command line is the bottom layer, and the
// leftmost is on the top). For more details see:
// https://docs.kernel.org/filesystems/overlayfs.html#multiple-lower-layers
args.push_str("lowerdir=");
for path in layer_dirs.iter().rev() {
args.push_str("lowerdir+=");
args.push_str(&path.as_ref().to_string_lossy());
args.push(':');
args.push(',');
}
args.push_str("lowerdir+=");
args.push_str(&rt.config.lower_dir.to_string_lossy());

args.push_str(",upperdir=");
Expand Down

0 comments on commit b23fc83

Please sign in to comment.