diff --git a/glusterd2/brickmux/demultiplex.go b/glusterd2/brickmux/demultiplex.go index 212eb5508..d7399bfc4 100644 --- a/glusterd2/brickmux/demultiplex.go +++ b/glusterd2/brickmux/demultiplex.go @@ -32,11 +32,17 @@ func Demultiplex(b brick.Brickinfo) error { if err != nil { return err } - if pidOnFile, err = daemon.ReadPidFromFile(brickDaemon.PidFile()); err == nil { + if pidOnFile, err = daemon.ReadPidFromFile(brickDaemon.PidFile()); err != nil { log.WithFields(log.Fields{"brick": b.String(), "pidfile": brickDaemon.PidFile()}).Error("Failed to read the pidfile") return err + } + if pidOnFile == -1 { + log.WithFields(log.Fields{"brick": b.String(), + "pidfile": brickDaemon.PidFile()}).Error("Pid is -1") + return err + } brickDaemon.Socketfilepath, err = glusterdGetSockFromBrickPid(pidOnFile) if err != nil {