public inbox for cluster-cvs@sourceware.org
help / color / mirror / Atom feed
From: David Teigland <teigland@fedoraproject.org>
To: cluster-cvs-relay@redhat.com
Subject: dlm: master - dlm_controld: periodically drop plock resources
Date: Thu, 03 Sep 2009 15:33:00 -0000	[thread overview]
Message-ID: <20090903153246.611F71201C5@lists.fedorahosted.org> (raw)

Gitweb:        http://git.fedorahosted.org/git/dlm.git?p=dlm.git;a=commitdiff;h=4a18db00d3afc0996bb8f50853dc5b4370945fbc
Commit:        4a18db00d3afc0996bb8f50853dc5b4370945fbc
Parent:        ae5da189f3515ab7c5dab7f16b8e3c36a2c87c8e
Author:        David Teigland <teigland@redhat.com>
AuthorDate:    Tue Aug 25 10:35:36 2009 -0500
Committer:     David Teigland <teigland@redhat.com>
CommitterDate: Thu Sep 3 10:25:26 2009 -0500

dlm_controld: periodically drop plock resources

instead of only dropping following a plock operation

Signed-off-by: David Teigland <teigland@redhat.com>
---
 group/dlm_controld/dlm_daemon.h |    2 ++
 group/dlm_controld/main.c       |    8 ++++++++
 group/dlm_controld/plock.c      |   37 +++++++++++++++++++++++++++++--------
 3 files changed, 39 insertions(+), 8 deletions(-)

diff --git a/group/dlm_controld/dlm_daemon.h b/group/dlm_controld/dlm_daemon.h
index b3bd58b..0c69278 100644
--- a/group/dlm_controld/dlm_daemon.h
+++ b/group/dlm_controld/dlm_daemon.h
@@ -70,6 +70,7 @@ extern int poll_fencing;
 extern int poll_quorum;
 extern int poll_fs;
 extern int poll_ignore_plock;
+extern int poll_drop_plock;
 extern int plock_fd;
 extern int plock_ci;
 extern struct list_head lockspaces;
@@ -289,6 +290,7 @@ void process_netlink(int ci);
 int setup_plocks(void);
 void close_plocks(void);
 void process_plocks(int ci);
+void drop_resources_all(void);
 int limit_plocks(void);
 void receive_plock(struct lockspace *ls, struct dlm_header *hd, int len);
 void receive_own(struct lockspace *ls, struct dlm_header *hd, int len);
diff --git a/group/dlm_controld/main.c b/group/dlm_controld/main.c
index 88f095c..6866012 100644
--- a/group/dlm_controld/main.c
+++ b/group/dlm_controld/main.c
@@ -963,6 +963,13 @@ static void loop(void)
 			}
 			poll_timeout = 1000;
 		}
+
+		if (poll_drop_plock) {
+			drop_resources_all();
+			if (poll_drop_plock)
+				poll_timeout = 1000;
+		}
+
 		query_unlock();
 	}
  out:
@@ -1248,6 +1255,7 @@ int poll_fencing;
 int poll_quorum;
 int poll_fs;
 int poll_ignore_plock;
+int poll_drop_plock;
 int plock_fd;
 int plock_ci;
 struct list_head lockspaces;
diff --git a/group/dlm_controld/plock.c b/group/dlm_controld/plock.c
index 85628ce..e0adbc6 100644
--- a/group/dlm_controld/plock.c
+++ b/group/dlm_controld/plock.c
@@ -1350,8 +1350,20 @@ static int drop_resources(struct lockspace *ls)
 	struct timeval now;
 	int count = 0;
 
+	if (!cfgd_plock_ownership)
+		return 0;
+
+	if (list_empty(&ls->plock_resources))
+		return 0;
+
 	gettimeofday(&now, NULL);
 
+	if (time_diff_ms(&ls->drop_resources_last, &now) <
+			 cfgd_drop_resources_time)
+		return 1;
+
+	ls->drop_resources_last = now;
+
 	/* try to drop the oldest, unused resources */
 
 	list_for_each_entry_reverse(r, &ls->plock_resources, list) {
@@ -1375,7 +1387,21 @@ static int drop_resources(struct lockspace *ls)
 		}
 	}
 
-	return 0;
+	return 1;
+}
+
+void drop_resources_all(void)
+{
+	struct lockspace *ls;
+	int rv = 0;
+
+	poll_drop_plock = 0;
+
+	list_for_each_entry(ls, &lockspaces, list) {
+		rv = drop_resources(ls);
+		if (rv)
+			poll_drop_plock = 1;
+	}
 }
 
 int limit_plocks(void)
@@ -1494,13 +1520,8 @@ void process_plocks(int ci)
 		save_pending_plock(ls, r, &info);
 	}
 
-	if (cfgd_plock_ownership &&
-	    time_diff_ms(&ls->drop_resources_last, &now) >=
-	    		 cfgd_drop_resources_time) {
-		ls->drop_resources_last = now;
-		drop_resources(ls);
-	}
-
+	if (cfgd_plock_ownership && !list_empty(&ls->plock_resources))
+		poll_drop_plock = 1;
 	return;
 
  fail:


                 reply	other threads:[~2009-09-03 15:33 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090903153246.611F71201C5@lists.fedorahosted.org \
    --to=teigland@fedoraproject.org \
    --cc=cluster-cvs-relay@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).