[Cluster-devel] cluster/gfs-kernel/src/gfs glock.c

[email protected] <[email protected]>
Newsgroups com.redhat.cluster-devel
Message-ID <[email protected]>
CVSROOT:	/cvs/cluster
Module name:	cluster
Branch: 	RHEL51
Changes by:	bmarzins at sourceware.org	2008-01-24 22:23:47

Modified files:
	gfs-kernel/src/gfs: glock.c 

Log message:
	Oops. Reverted fix for bz #426291.  It isn't going into RHEL 5.1

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gfs-kernel/src/gfs/glock.c.diff?cvsroot=cluster&only_with_tag=RHEL51&r1=1.29.2.5.2.1&r2=1.29.2.5.2.2

--- cluster/gfs-kernel/src/gfs/glock.c	2008/01/24 20:08:43	1.29.2.5.2.1
+++ cluster/gfs-kernel/src/gfs/glock.c	2008/01/24 22:23:47	1.29.2.5.2.2
@@ -1618,6 +1618,8 @@
 	struct gfs_sbd *sdp = gl->gl_sbd;
 	struct gfs_glock_operations *glops = gl->gl_ops;
 	struct list_head *pos;
+	struct gfs_holder *tmp_gh = NULL;
+	int count = 0;
 
 	atomic_inc(&gl->gl_sbd->sd_glock_dq_calls);
 
@@ -1628,13 +1630,14 @@
 		set_bit(GLF_SYNC, &gl->gl_flags);
 
 	/* Don't cache glock; request demote to unlock at inter-node scope */
-	if (gh->gh_flags & GL_NOCACHE && gl->gl_holders.next == &gh->gh_list &&
-	    gl->gl_holders.prev == &gh->gh_list)
-		/* There's a race here.  If there are two holders, and both
- 		 * are dq'ed at almost the same time, you can't guarantee that
- 		 * you will call handle_callback. Fixing this will require
- 		 * some refactoring */
-		handle_callback(gl, LM_ST_UNLOCKED);
+	if (gh->gh_flags & GL_NOCACHE) {
+		list_for_each(pos, &gl->gl_holders) {
+			tmp_gh = list_entry(pos, struct gfs_holder, gh_list);
+			++count;
+		}
+		if (tmp_gh == gh && count == 1)
+			handle_callback(gl, LM_ST_UNLOCKED);
+	}
 
 	lock_on_glock(gl);
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.