[PATCH 4.12 11/41] MD: not clear ->safemode for external metadata array

From: Greg Kroah-Hartman
Date: Tue Aug 22 2017 - 15:16:44 EST


4.12-stable review patch. If anyone has any objections, please let me know.

------------------

From: Shaohua Li <shli@xxxxxx>

commit afc1f55ca44e257f69da8f43e0714a76686ae8d1 upstream.

->safemode should be triggered by mdadm for external metadaa array, otherwise
array's state confuses mdadm.

Fixes: 33182d15c6bf(md: always clear ->safemode when md_check_recovery gets the mddev lock.)
Cc: NeilBrown <neilb@xxxxxxxx>
Signed-off-by: Shaohua Li <shli@xxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>

---
drivers/md/md.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -8639,7 +8639,7 @@ void md_check_recovery(struct mddev *mdd
if (mddev_trylock(mddev)) {
int spares = 0;

- if (mddev->safemode == 1)
+ if (!mddev->external && mddev->safemode == 1)
mddev->safemode = 0;

if (mddev->ro) {