cache: do not ignore readonly option

Signed-off-by: Kohei Tokunaga <ktokunaga.mail@gmail.com>
master
Kohei Tokunaga 2022-01-16 13:20:17 +09:00
parent 2dc3e743fd
commit f8c9a756e3
1 changed files with 6 additions and 0 deletions

6
cache/refs.go vendored
View File

@ -775,6 +775,9 @@ func (sr *immutableRef) Mount(ctx context.Context, readonly bool, s session.Grou
defer sr.mu.Unlock()
if sr.mountCache != nil {
if readonly {
return setReadonly(sr.mountCache), nil
}
return sr.mountCache, nil
}
@ -1258,6 +1261,9 @@ func (sr *mutableRef) Mount(ctx context.Context, readonly bool, s session.Group)
defer sr.mu.Unlock()
if sr.mountCache != nil {
if readonly {
return setReadonly(sr.mountCache), nil
}
return sr.mountCache, nil
}