mirror of
https://github.com/containerd/containerd.git
synced 2026-08-09 01:21:15 +00:00
NewSnapshotter auto-appends "index=off" unless the configured mount_options already carry an index option — but the check used hasOption(..., "index", false), which compares against the literal string "index". No valid mount option ever equals "index" (it is always valued, "index=on"/"index=off"), so the append happened unconditionally whenever the kernel exposes the overlay index parameter. Mount options are last-wins in the kernel, so a user-configured "index=on" was silently overridden. Worse, configuring mount_options = ["index=on", "nfs_export=on"] (the documented way to make overlay mounts NFS-exportable) produced "index=on,nfs_export=on,index=off", which the kernel rejects with EINVAL (nfs_export=on conflicts with an explicit index=off) — breaking every snapshot mount including image unpack. Make hasOption match the key of a "key[=value]" option so callers need not care whether the option takes a value, and add a regression test. Signed-off-by: AprilNEA <github@sku.moe>