Skip to content

Commit f994e78

Browse files
Add special case for rw bind mounts
In case of a rw bind mount, we return the source directly. Signed-off-by: Gabriel Adrian Samfira <[email protected]>
1 parent cf05c75 commit f994e78

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

snapshot/localmounter_windows.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,13 @@ func (lm *localMounter) Mount() (string, error) {
3636
}
3737

3838
if m.Type == "bind" || m.Type == "rbind" {
39+
if !m.ReadOnly() {
40+
// This is a rw bind mount, we can simply return the source.
41+
// NOTE(gabriel-samfira): This is safe to do if the source of the bind mount is a DOS path
42+
// of a local folder. If it's a \\?\Volume{} (for any reason that I can't think of now)
43+
// we should allow bindfilter.ApplyFileBinding() to mount it.
44+
return m.Source, nil
45+
}
3946
// The Windows snapshotter does not have any notion of bind mounts. We emulate
4047
// bind mounts here using the bind filter.
4148
if err := bindfilter.ApplyFileBinding(dir, m.Source, m.ReadOnly()); err != nil {

0 commit comments

Comments
 (0)