nfs-server: a pending share is carried only by the export line for the same folder (issue 1971, review round 2)
mesh/delivery merged: source.main moved to novox/mesh-catalog@559939aa8ce1
mesh/check pass 87fd0cd8b985 on 559939aa8ce1 | carried from 211186edd769 | unit 625 run, 4127 kept, 13 skipped | integration 676 run, 4136 kept, 22 sk…
mesh/delivery merged: source.main moved to novox/mesh-catalog@559939aa8ce1
mesh/check pass 87fd0cd8b985 on 559939aa8ce1 | carried from 211186edd769 | unit 625 run, 4127 kept, 13 skipped | integration 676 run, 4136 kept, 22 sk…
Claude-Session: https://claude.ai/code/session_01JG73KJNrH5EgFXMKKYSrig
This commit is contained in:
@@ -508,4 +508,13 @@ func TestARestartKeepsTheExportedShareWhileItsFirstLookRuns(t *testing.T) {
|
||||
if len(held) != 1 || refusedWhy(s, "clean") != "" || f.read(ExportFile) != before || countExportfs(f.ran) != 0 {
|
||||
t.Errorf("a restart with an unfinished walk unexported the share: %+v, ran %v", s.Refused, f.ran)
|
||||
}
|
||||
// The same name, a new folder holding a repository, the walk unfinished: refused, not carried by name.
|
||||
f.restic("/srv/other/backup")
|
||||
f.file(ConfigFile, grantsConfig("clean=/srv/other", "clean=ws:rw"))
|
||||
m3 := f.machine()
|
||||
m3.Beside = func(func()) {}
|
||||
s = m3.Pass(context.Background(), &s)
|
||||
if refusedWhy(s, "clean") == "" || strings.Contains(f.read(ExportFile), "/srv/other") {
|
||||
t.Errorf("a share moved to a new folder was exported unlooked: %+v", s.Refused)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -456,7 +456,7 @@ func (m *Machine) Judge(c Config, roster map[string]string, wants map[string][]W
|
||||
no(fmt.Sprintf("The share %s's folder %s%s holds a backup repository (%s), and backups are never exported: share the folders beside it instead.", s.Name, real, via, holds))
|
||||
continue
|
||||
}
|
||||
if pending && !carries(onDisk, s.Name, real) {
|
||||
if pending && !carries(onDisk, real) {
|
||||
no(fmt.Sprintf("The share %s's folder %s%s has not been looked through yet for a backup repository (the look runs beside the pass and takes a while on a large folder), so it is not exported yet.", s.Name, real, via))
|
||||
continue
|
||||
}
|
||||
@@ -531,12 +531,12 @@ func (m *Machine) Judge(c Config, roster map[string]string, wants map[string][]W
|
||||
return out, refused, said
|
||||
}
|
||||
|
||||
// carries says whether the export file already carries a share: its line, or the note that it goes to no
|
||||
// node. While a share's first look is unfinished (after a restart) it stays as the previous process judged
|
||||
// carries says whether the export file already holds the line for this real folder (a share exported to no
|
||||
// node has none and waits for its look; a share whose folder changed is a new folder). While a share's first look is unfinished (after a restart) it stays as the previous process judged
|
||||
// it, so a delivery never unexports a share clients have mounted.
|
||||
func carries(file, name, real string) bool {
|
||||
func carries(file, real string) bool {
|
||||
for _, l := range strings.Split(file, "\n") {
|
||||
if strings.HasPrefix(l, real+" ") || l == "# share "+name || strings.HasPrefix(l, "# share "+name+":") {
|
||||
if strings.HasPrefix(l, real+" ") {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user