dlm: master - dlm_controld: fix plock dev_write no op

David Teigland teigland at fedoraproject.org
Fri Aug 19 15:49:02 UTC 2011


Gitweb:        http://git.fedorahosted.org/git/dlm.git?p=dlm.git;a=commitdiff;h=297eb3800e2b24b764d2bc8483d2ef72b40a0779
Commit:        297eb3800e2b24b764d2bc8483d2ef72b40a0779
Parent:        13a814433588ba0a9d8228dcb2e6c6dba6f3c861
Author:        David Teigland <teigland at redhat.com>
AuthorDate:    Fri Aug 19 10:48:13 2011 -0500
Committer:     David Teigland <teigland at redhat.com>
CommitterDate: Fri Aug 19 10:48:13 2011 -0500

dlm_controld: fix plock dev_write no op

When a plock unlock is received due to the file
being closed (the CLOSE flag is set), we should
not write an unlock result back to the kernel.
If we do, the kernel, which does not expect a
reply, will report the error "dev_write no op".

In cases where dlm_controld encounters and error
handling the unlock operation, it was writing
the error result back to the kernel, even though
the unlock was flagged with CLOSE.  The fix is
to check for the CLOSE flag and skip writing
the error result, as we do with normal results.

This problem is especially visible when using
flocks (not plocks).  This is because the kernel
generates extraneous plock unlock requests
when files are closed with flocks.  Because
dlm_controld finds no plocks on the files,
it replies to the kernel with an error, rather
than skipping the reply to do CLOSE.

bz 731775

Signed-off-by: David Teigland <teigland at 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 3848308..12f35de 100644
--- a/group/dlm_controld/plock.c
+++ b/group/dlm_controld/plock.c
@@ -1641,8 +1641,10 @@ void process_plocks(int ci)
 	return;
 
  fail:
-	info.rv = rv;
-	rv = write(plock_device_fd, &info, sizeof(info));
+	if (!(info.flags & DLM_PLOCK_FL_CLOSE)) {
+		info.rv = rv;
+		rv = write(plock_device_fd, &info, sizeof(info));
+	}
 }
 
 void process_saved_plocks(struct lockspace *ls)


More information about the cluster-commits mailing list