From 22481ce7438e2e16a7d870c957bfaed05d115037 Mon Sep 17 00:00:00 2001 From: Donald Buczek Date: Thu, 11 Mar 2021 13:35:34 +0100 Subject: [PATCH] mxraid: Add deadlock workaround to mdcheck.safe Sometimes, when the check is paused by setting sync_action to "idle", the array deadlocks. It can be continued by setting array_state to active. If it takes more 10 seconds to set the sync_action to idle and the array state is write-pending, then try to continue the array by setting its state to active. --- mxraid/mdcheck.safe | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/mxraid/mdcheck.safe b/mxraid/mdcheck.safe index 700c3e2..01eda55 100755 --- a/mxraid/mdcheck.safe +++ b/mxraid/mdcheck.safe @@ -160,7 +160,13 @@ do rm -f $fl continue; fi - echo idle > $sys/md/sync_action + echo idle > $sys/md/sync_action & + pid=$! + sleep 10 + if [ -d /proc/$pid -a "$(cat $sys/md/array_state)" = write-pending ]; then + logger -p daemon.info restart hanging $dev + echo active > $sys/md/array_state + fi cat $sys/md/sync_min > $fl logger -p daemon.info pause checking $dev at `cat $fl` done