ocfs2: Stop orphan scan as early as possible during umount

Previous thread: ocfs2: Fix ocfs2_osb_dump() by Linux Kernel Mailing List on Wednesday, June 24, 2009 - 11:59 am. (1 message)

Next thread: ocfs2: Do not initialize lvb in ocfs2_orphan_scan_lock_res_init() by Linux Kernel Mailing List on Wednesday, June 24, 2009 - 11:59 am. (1 message)
From: Linux Kernel Mailing List
Date: Wednesday, June 24, 2009 - 11:59 am

Gitweb:     http://git.kernel.org/linus/692684e19e317a374c18e70a44d6413e51f71c11
Commit:     692684e19e317a374c18e70a44d6413e51f71c11
Parent:     c3d38840abaa45c1c5a5fabbb8ffc9a0d1a764d1
Author:     Sunil Mushran <sunil.mushran@oracle.com>
AuthorDate: Fri Jun 19 16:53:17 2009 -0700
Committer:  Joel Becker <joel.becker@oracle.com>
CommitDate: Mon Jun 22 14:24:51 2009 -0700

    ocfs2: Stop orphan scan as early as possible during umount
    
    Currently if the orphan scan fires a tick before the user issues the umount,
    the umount will wait for the queued orphan scan tasks to complete.
    
    This patch makes the umount stop the orphan scan as early as possible so as
    to reduce the probability of the queued tasks slowing down the umount.
    
    Signed-off-by: Sunil Mushran <sunil.mushran@oracle.com>
    Signed-off-by: Joel Becker <joel.becker@oracle.com>
---
 fs/ocfs2/journal.c |   14 ++++++++++++--
 fs/ocfs2/ocfs2.h   |    6 ++++++
 fs/ocfs2/super.c   |    5 +++--
 3 files changed, 21 insertions(+), 4 deletions(-)

diff --git a/fs/ocfs2/journal.c b/fs/ocfs2/journal.c
index 4a3b9e6..70215a2 100644
--- a/fs/ocfs2/journal.c
+++ b/fs/ocfs2/journal.c
@@ -1880,6 +1880,9 @@ void ocfs2_queue_orphan_scan(struct ocfs2_super *osb)
 
 	os = &osb->osb_orphan_scan;
 
+	if (atomic_read(&os->os_state) == ORPHAN_SCAN_INACTIVE)
+		goto out;
+
 	status = ocfs2_orphan_scan_lock(osb, &seqno, DLM_LOCK_EX);
 	if (status < 0) {
 		if (status != -EAGAIN)
@@ -1887,6 +1890,10 @@ void ocfs2_queue_orphan_scan(struct ocfs2_super *osb)
 		goto out;
 	}
 
+	/* Do no queue the tasks if the volume is being umounted */
+	if (atomic_read(&os->os_state) == ORPHAN_SCAN_INACTIVE)
+		goto unlock;
+
 	if (os->os_seqno != seqno) {
 		os->os_seqno = seqno;
 		goto unlock;
@@ -1920,8 +1927,9 @@ void ocfs2_orphan_scan_work(struct work_struct *work)
 
 	mutex_lock(&os->os_lock);
 	ocfs2_queue_orphan_scan(osb);
-	schedule_delayed_work(&os->os_orphan_scan_work,
-			      ...
Previous thread: ocfs2: Fix ocfs2_osb_dump() by Linux Kernel Mailing List on Wednesday, June 24, 2009 - 11:59 am. (1 message)

Next thread: ocfs2: Do not initialize lvb in ocfs2_orphan_scan_lock_res_init() by Linux Kernel Mailing List on Wednesday, June 24, 2009 - 11:59 am. (1 message)