All of lore.kernel.org
 help / color / mirror / Atom feed
* [Ocfs2-devel] [PATCH 1/1] ocfs2: Fix a race in o2dlm lockres mastery(backport to 1.4)
@ 2010-03-23 18:07 Srinivas Eeda
  2010-03-23 19:54 ` Joel Becker
  0 siblings, 1 reply; 2+ messages in thread
From: Srinivas Eeda @ 2010-03-23 18:07 UTC (permalink / raw)
  To: ocfs2-devel

In o2dlm, the master of a lock resource keeps a map of all interested
nodes.  This prevents the master from purging the resource before an
interested node can create a lock.

A race between the mastery thread and the mastery handler allowed an
interested node to discover who the master is without informing the
master directly.  This is easily fixed by holding the dlm spinlock a
little longer in the mastery handler.

Signed-off-by: Srinivas Eeda <srinivas.eeda@oracle.com>
---
 fs/ocfs2/dlm/dlmmaster.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/fs/ocfs2/dlm/dlmmaster.c b/fs/ocfs2/dlm/dlmmaster.c
index 047e7bc..a1cd7b1 100644
--- a/fs/ocfs2/dlm/dlmmaster.c
+++ b/fs/ocfs2/dlm/dlmmaster.c
@@ -1876,7 +1876,6 @@ int dlm_assert_master_handler(struct o2net_msg *msg, u32 len, void *data,
 ok:
 		spin_unlock(&res->spinlock);
 	}
-	spin_unlock(&dlm->spinlock);
 
 	// mlog(0, "woo!  got an assert_master from node %u!\n",
 	// 	     assert->node_idx);
@@ -1927,7 +1926,6 @@ ok:
 		/* master is known, detach if not already detached.
 		 * ensures that only one assert_master call will happen
 		 * on this mle. */
-		spin_lock(&dlm->spinlock);
 		spin_lock(&dlm->master_lock);
 
 		rr = atomic_read(&mle->mle_refs.refcount);
@@ -1960,7 +1958,6 @@ ok:
 			__dlm_put_mle(mle);
 		}
 		spin_unlock(&dlm->master_lock);
-		spin_unlock(&dlm->spinlock);
 	} else if (res) {
 		if (res->owner != assert->node_idx) {
 			mlog(0, "assert_master from %u, but current "
@@ -1968,6 +1965,7 @@ ok:
 			     res->owner, namelen, name);
 		}
 	}
+	spin_unlock(&dlm->spinlock);
 
 done:
 	ret = 0;
-- 
1.5.6.5

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [Ocfs2-devel] [PATCH 1/1] ocfs2: Fix a race in o2dlm lockres mastery(backport to 1.4)
  2010-03-23 18:07 [Ocfs2-devel] [PATCH 1/1] ocfs2: Fix a race in o2dlm lockres mastery(backport to 1.4) Srinivas Eeda
@ 2010-03-23 19:54 ` Joel Becker
  0 siblings, 0 replies; 2+ messages in thread
From: Joel Becker @ 2010-03-23 19:54 UTC (permalink / raw)
  To: ocfs2-devel

On Tue, Mar 23, 2010 at 11:07:59AM -0700, Srinivas Eeda wrote:
> In o2dlm, the master of a lock resource keeps a map of all interested
> nodes.  This prevents the master from purging the resource before an
> interested node can create a lock.
> 
> A race between the mastery thread and the mastery handler allowed an
> interested node to discover who the master is without informing the
> master directly.  This is easily fixed by holding the dlm spinlock a
> little longer in the mastery handler.
> 
> Signed-off-by: Srinivas Eeda <srinivas.eeda@oracle.com>

	Has this patch changed at all since the one I took earlier?

Joel

-- 

"I don't even butter my bread; I consider that cooking."
         - Katherine Cebrian

Joel Becker
Principal Software Developer
Oracle
E-mail: joel.becker at oracle.com
Phone: (650) 506-8127

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-03-23 19:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-03-23 18:07 [Ocfs2-devel] [PATCH 1/1] ocfs2: Fix a race in o2dlm lockres mastery(backport to 1.4) Srinivas Eeda
2010-03-23 19:54 ` Joel Becker

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.