From e0d733c8713ef72feb05bbe2b1d4f4ab3c7f5926 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= Date: Mon, 7 Jul 2025 13:34:37 +0200 Subject: [PATCH] blockfile: Ensure required options are always set MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When using blockfile snapshotter and passing specific filesystem mount options, the users may be caught by surprise by the fact that some options are required but not documented anywhere. The easiest way to solve this is by ensuring that the "loop" required option is always added to the mount options. Signed-off-by: Fabiano FidĂȘncio --- plugins/snapshots/blockfile/blockfile.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/plugins/snapshots/blockfile/blockfile.go b/plugins/snapshots/blockfile/blockfile.go index 2d44c2d90c..17e22a7071 100644 --- a/plugins/snapshots/blockfile/blockfile.go +++ b/plugins/snapshots/blockfile/blockfile.go @@ -23,6 +23,7 @@ import ( "os" "path/filepath" "runtime" + "slices" "github.com/containerd/containerd/v2/core/mount" "github.com/containerd/containerd/v2/core/snapshots" @@ -160,6 +161,10 @@ func NewSnapshotter(root string, opts ...Opt) (snapshots.Snapshotter, error) { config.mountOptions = []string{"loop"} } + if !slices.Contains(config.mountOptions, "loop") { + config.mountOptions = append(config.mountOptions, "loop") + } + ms, err := storage.NewMetaStore(filepath.Join(root, "metadata.db")) if err != nil { return nil, err