Gitweb:
http://git.fedorahosted.org/git/dlm.git?p=dlm.git;a=commitdiff;h=29ddcc7d...
Commit: 29ddcc7de91828a7d96cd2f07dd054daba7b1e1f
Parent: 27b09badd40a2d1500500fa6945aeb532f75bd13
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Fri Mar 19 13:29:17 2010 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Thu Mar 25 14:00:12 2010 -0500
dlm_controld: avoid full plock unlock when no resource exists
When a plock unlock operation is read, we can immediately return if
the resource does not exist. If there were any locks to unlock, the
resource would exist. This optimization avoids creating/caching the
resource and sending the unlock message unnecessarily.
(When a process holding an *flock* exits without unlocking it, the
vfs cleanup code sends us a full plock unlock on the file, even if
the process has never used plocks. This means we can potentially
see a lot of plock activity for processes that never touch plocks.
This patch reduces it, although it would be nice to detect that a
process has no plocks earlier, while still in the kernel.)
bz 575103
Signed-off-by: David Teigland <teigland(a)redhat.com>
---
group/dlm_controld/plock.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/group/dlm_controld/plock.c b/group/dlm_controld/plock.c
index 7e5b735..981e9be 100644
--- a/group/dlm_controld/plock.c
+++ b/group/dlm_controld/plock.c
@@ -1451,7 +1451,7 @@ void process_plocks(int ci)
struct dlm_plock_info info;
struct timeval now;
uint64_t usec;
- int rv;
+ int create, rv;
if (limit_plocks()) {
poll_ignore_plock = 1;
@@ -1506,7 +1506,9 @@ void process_plocks(int ci)
plock_rate_delays = 0;
}
- rv = find_resource(ls, info.number, 1, &r);
+ create = (info.optype == DLM_PLOCK_OP_UNLOCK) ? 0 : 1;
+
+ rv = find_resource(ls, info.number, create, &r);
if (rv)
goto fail;