replication: handle context cancellation errors as GlobalError

This commit is contained in:
Christian Schwarz
2018-10-21 19:06:30 +02:00
parent 36265ff349
commit 1691839c6b
2 changed files with 21 additions and 1 deletions
+8 -1
View File
@@ -459,7 +459,14 @@ func stateWorking(ctx context.Context, ka *watchdog.KeepAlive, sender Sender, re
}).rsf()
if err != nil {
if err.LocalToFS() {
if err.ContextErr() && ctx.Err() != nil {
getLogger(ctx).WithError(err).
Info("filesystem replication was cancelled")
u(func(r*Replication) {
r.err = GlobalError{Err: err, Temporary: false}
r.state = PermanentError
})
} else if err.LocalToFS() {
getLogger(ctx).WithError(err).
Error("filesystem replication encountered a filesystem-specific error")
// we stay in this state and let the queuing logic above de-prioritize this failing FS