All of lore.kernel.org
 help / color / mirror / Atom feed
* [Ocfs2-devel] Patch to recover orphans in offline slots
@ 2009-02-19 22:45 Srinivas Eeda
  2009-02-19 22:45 ` [Ocfs2-devel] [PATCH 1/1] Patch to clean orphans in all offline slots during recovery Srinivas Eeda
  2009-02-19 22:50 ` [Ocfs2-devel] Patch to recover orphans in offline slots Sunil Mushran
  0 siblings, 2 replies; 3+ messages in thread
From: Srinivas Eeda @ 2009-02-19 22:45 UTC (permalink / raw)
  To: ocfs2-devel


This patch is against ocfs2-1.4 and also applies to ocfs2-1.2. ocfs2 mainline
requires only the first portion of the patch and hence will make a separate
patch for that.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Ocfs2-devel] [PATCH 1/1] Patch to clean orphans in all offline slots during recovery.
  2009-02-19 22:45 [Ocfs2-devel] Patch to recover orphans in offline slots Srinivas Eeda
@ 2009-02-19 22:45 ` Srinivas Eeda
  2009-02-19 22:50 ` [Ocfs2-devel] Patch to recover orphans in offline slots Sunil Mushran
  1 sibling, 0 replies; 3+ messages in thread
From: Srinivas Eeda @ 2009-02-19 22:45 UTC (permalink / raw)
  To: ocfs2-devel

In the current recovery procedure, a node recovers orphans from the slot it
is holding and the nodes being recovered. If a dead node was holding an orphan
in another offline node's slot then it may be left around for a while.

This patch clears orphans in all offline slots. This patch does two things:
a) Recover orphans during mount of the slot that it is using.
b) Recover orphans in all offline slots during recovery.

Signed-off-by: Srinivas Eeda <srinivas.eeda@oracle.com>
---
 fs/ocfs2/journal.c |   44 +++++++++++++++++++++++++++-----------------
 1 files changed, 27 insertions(+), 17 deletions(-)

diff --git a/fs/ocfs2/journal.c b/fs/ocfs2/journal.c
index 03fb378..3d55892 100644
--- a/fs/ocfs2/journal.c
+++ b/fs/ocfs2/journal.c
@@ -845,24 +845,22 @@ void ocfs2_complete_mount_recovery(struct ocfs2_super *osb)
 {
 	struct ocfs2_journal *journal = osb->journal;
 
-	if (osb->dirty) {
-		/* No need to queue up our truncate_log as regular
-		 * cleanup will catch that. */
-		ocfs2_queue_recovery_completion(journal,
-						osb->slot_num,
-						osb->local_alloc_copy,
-						NULL);
-		ocfs2_schedule_truncate_log_flush(osb, 0);
-
-		osb->local_alloc_copy = NULL;
-		osb->dirty = 0;
-	}
+	/* No need to queue up our truncate_log as regular cleanup will 
+	 * catch that. */
+	ocfs2_queue_recovery_completion(journal, osb->slot_num,
+					osb->local_alloc_copy, NULL);
+	ocfs2_schedule_truncate_log_flush(osb, 0);
+
+	osb->local_alloc_copy = NULL;
+	osb->dirty = 0;
 }
 
 static int __ocfs2_recovery_thread(void *arg)
 {
 	int status, node_num;
 	struct ocfs2_super *osb = arg;
+	int slot_arr[OCFS2_MAX_SLOTS];
+	int i, saveslots = 1;
 
 	mlog_entry_void();
 
@@ -878,6 +876,16 @@ restart:
 		goto bail;
 	}
 
+	/* 
+	 * copy slots array so we can recovery offline slots that were not
+	 * recovered
+	 */
+	if (saveslots) {
+		saveslots = 0;
+		for (i = 0; i < osb->slot_info->si_num_slots; i++)
+			slot_arr[i] = osb->slot_info->si_global_node_nums[i];
+	}
+
 	while(!ocfs2_node_map_is_empty(osb, &osb->recovery_map)) {
 		node_num = ocfs2_node_map_first_set_bit(osb,
 							&osb->recovery_map);
@@ -905,14 +913,16 @@ restart:
 	if (status < 0)
 		mlog_errno(status);
 
-	ocfs2_super_unlock(osb, 1);
-
-	/* We always run recovery on our own orphan dir - the dead
-	 * node(s) may have disallowd a previos inode delete. Re-processing
+	/* We always run recovery on our own and offline orphan dirs - the dead
+	 * node(s) may have disallowed a previous inode delete. Re-processing
 	 * is therefore required. */
-	ocfs2_queue_recovery_completion(osb->journal, osb->slot_num, NULL,
+	for (i = 0; i < osb->slot_info->si_num_slots; i++)
+		if (slot_arr[i] == OCFS2_INVALID_SLOT || osb->slot_num == i)
+			ocfs2_queue_recovery_completion(osb->journal, i, NULL,
 					NULL);
 
+	ocfs2_super_unlock(osb, 1);
+
 bail:
 	mutex_lock(&osb->recovery_lock);
 	if (!status &&
-- 
1.5.6.5

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [Ocfs2-devel] Patch to recover orphans in offline slots
  2009-02-19 22:45 [Ocfs2-devel] Patch to recover orphans in offline slots Srinivas Eeda
  2009-02-19 22:45 ` [Ocfs2-devel] [PATCH 1/1] Patch to clean orphans in all offline slots during recovery Srinivas Eeda
@ 2009-02-19 22:50 ` Sunil Mushran
  1 sibling, 0 replies; 3+ messages in thread
From: Sunil Mushran @ 2009-02-19 22:50 UTC (permalink / raw)
  To: ocfs2-devel

Srini,

Please can you send the mainline one for review.

Sunil

Srinivas Eeda wrote:
> This patch is against ocfs2-1.4 and also applies to ocfs2-1.2. ocfs2 mainline
> requires only the first portion of the patch and hence will make a separate
> patch for that.
>   

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-02-19 22:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-19 22:45 [Ocfs2-devel] Patch to recover orphans in offline slots Srinivas Eeda
2009-02-19 22:45 ` [Ocfs2-devel] [PATCH 1/1] Patch to clean orphans in all offline slots during recovery Srinivas Eeda
2009-02-19 22:50 ` [Ocfs2-devel] Patch to recover orphans in offline slots Sunil Mushran

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.