Skip to contentSkip to conversation

DLM: Add some cond_resched statements to recovery

PATCH New Bob Peterson 1 participant 1 message Jun 21, 2017 1 message not in the archive Distributed lock manager (DLM)

lore
Share & tools
lore
#1 lore raw

PATCH 1/1 DLM: Add some cond_resched statements to recovery

In reply to a message not in the archive

Hi,

This patch adds some cond_resched statements to dlm's recovery process to allow other processes to run, such as corosync.

---
 fs/dlm/lock.c    | 2 ++
 fs/dlm/recover.c | 5 ++++-
 2 files changed, 6 insertions(+), 1 deletion(-)
fs/dlm/lock.c +2 -0
index d4aadde..da28be8 100644
@@ -1736,6 +1736,7 @@ static void shrink_bucket(struct dlm_ls *ls, int b)
 	 */
 
 	for (i = 0; i < remote_count; i++) {
+		cond_resched();
 		name = ls->ls_remove_names[i];
 		len = ls->ls_remove_lens[i];
 
@@ -1914,6 +1915,7 @@ void dlm_scan_timeout(struct dlm_ls *ls)
 		unlock_rsb(r);
 		unhold_rsb(r);
 		dlm_put_lkb(lkb);
+		cond_resched();
 	}
 }
 
fs/dlm/recover.c +4 -1
index eaea789..3346971 100644
@@ -23,7 +23,6 @@
 #include "member.h"
 #include "recover.h"
 
-
 /*
  * Recovery waiting routines: these functions wait for a particular reply from
  * a remote node, or for the remote node to report a certain status.  They need
@@ -651,6 +650,7 @@ static int recover_locks(struct dlm_rsb *r)
 		rsb_clear_flag(r, RSB_NEW_MASTER);
  out:
 	unlock_rsb(r);
+	cond_resched();
 	return error;
 }
 
@@ -879,6 +879,7 @@ void dlm_recover_rsbs(struct dlm_ls *ls)
 		rsb_clear_flag(r, RSB_RECOVER_LVB_INVAL);
 		rsb_clear_flag(r, RSB_NEW_MASTER2);
 		unlock_rsb(r);
+		cond_resched();
 	}
 	up_read(&ls->ls_root_sem);
 
@@ -912,6 +913,7 @@ int dlm_create_root_list(struct dlm_ls *ls)
 		if (!RB_EMPTY_ROOT(&ls->ls_rsbtbl[i].toss))
 			log_error(ls, "dlm_create_root_list toss not empty");
 		spin_unlock(&ls->ls_rsbtbl[i].lock);
+		cond_resched();
 	}
  out:
 	up_write(&ls->ls_root_sem);
@@ -947,6 +949,7 @@ void dlm_clear_toss(struct dlm_ls *ls)
 			count++;
 		}
 		spin_unlock(&ls->ls_rsbtbl[i].lock);
+		cond_resched();
 	}
 
 	if (count)