Skip to content

Commit 54ebd84

Browse files
authored
Merge pull request #1164 from davvid/new-overlay-mount
env: fix handling of long lowerdir paths in newer kernel/mount versions
2 parents 6b9540a + 9c4f1da commit 54ebd84

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

Diff for: crates/spfs/Cargo.toml

+5
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ default = []
1818
# If enabled, will create the "local" repository in a subdirectory
1919
# of the standard storage root, named "ci/pipeline_${CI_PIPELINE_ID}".
2020
gitlab-ci-local-repo-isolation = []
21+
# Use "mount" commands that are compatible with older centos7-era kernels that
22+
# do not support the "lowerdir+=" overlayfs options. "legacy-mount-options"
23+
# can run into path length limits when mounting many layers.
24+
# https://github.com/spkenv/spk/issues/968
25+
legacy-mount-options = []
2126
sentry = ["dep:sentry"]
2227
server = ["hyper/server", "tokio-util/codec", "tokio-util/io-util"]
2328
"protobuf-src" = ["dep:protobuf-src"]

Diff for: crates/spfs/src/env.rs

+13-4
Original file line numberDiff line numberDiff line change
@@ -1126,10 +1126,19 @@ pub(crate) fn get_overlay_args<P: AsRef<Path>>(
11261126
// the rightmost on the command line is the bottom layer, and the
11271127
// leftmost is on the top). For more details see:
11281128
// https://docs.kernel.org/filesystems/overlayfs.html#multiple-lower-layers
1129-
args.push_str("lowerdir=");
1130-
for path in layer_dirs.iter().rev() {
1131-
args.push_str(&path.as_ref().to_string_lossy());
1132-
args.push(':');
1129+
if cfg!(feature = "legacy-mount-options") {
1130+
args.push_str("lowerdir=");
1131+
for path in layer_dirs.iter().rev() {
1132+
args.push_str(&path.as_ref().to_string_lossy());
1133+
args.push(':');
1134+
}
1135+
} else {
1136+
for path in layer_dirs.iter().rev() {
1137+
args.push_str("lowerdir+=");
1138+
args.push_str(&path.as_ref().to_string_lossy());
1139+
args.push(',');
1140+
}
1141+
args.push_str("lowerdir+=");
11331142
}
11341143
args.push_str(&rt.config.lower_dir.to_string_lossy());
11351144

0 commit comments

Comments
 (0)