persist readonly state to volume info (#5977)

This commit is contained in:
Bruce
2024-09-05 22:58:24 +08:00
committed by GitHub
parent 310d41998d
commit f9e141a412
5 changed files with 525 additions and 499 deletions

View File

@@ -43,6 +43,11 @@ func (v *Volume) load(alsoLoadIndex bool, createDatIfMissing bool, needleMapKind
hasVolumeInfoFile := v.maybeLoadVolumeInfo()
if v.volumeInfo.ReadOnly && !v.HasRemoteFile() {
// this covers the case where the volume is marked as read-only and has no remote file
v.noWriteOrDelete = true
}
if v.HasRemoteFile() {
v.noWriteCanDelete = true
v.noWriteOrDelete = false