From 76a88f56e5799140d316aaaaabd51b23b2461826 Mon Sep 17 00:00:00 2001
From: antirez <antirez@gmail.com>
Date: Wed, 13 Nov 2013 17:02:09 +0100
Subject: [PATCH] Sentinel: safer slave reconfig, master reported role should
 match.

---
 src/sentinel.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/sentinel.c b/src/sentinel.c
index b60c375d..d6b394be 100644
--- a/src/sentinel.c
+++ b/src/sentinel.c
@@ -1605,6 +1605,7 @@ void sentinelRefreshInstanceInfo(sentinelRedisInstance *ri, const char *info) {
             /* Make sure the master is sane before reconfiguring this instance
              * into a slave. */
             if (ri->master->flags & SRI_MASTER &&
+                ri->master->role_reported == SRI_MASTER &&
                 (ri->master->flags & (SRI_S_DOWN|SRI_O_DOWN)) == 0 &&
                 (mstime() - ri->master->info_refresh) < SENTINEL_INFO_PERIOD*2)
             {