All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wengang Wang <wen.gang.wang@ORACLE.COM>
To: ocfs2-devel@oss.oracle.com
Subject: [Ocfs2-devel] [PATCH] ocfs2: fix __ocfs2_cluster_lock() dead	lock
Date: Wed, 13 Jan 2010 11:20:49 +0800	[thread overview]
Message-ID: <20100113032049.GA4045@laptop.oracle.com> (raw)
In-Reply-To: <20100112015946.GE20285@mail.oracle.com>

Hi Joel and David,

I think the patch to fix the deadlock(or livelock) is not good enough
yet.
my original patch is based on that when we have requested the lock, we
don't allow to downconvert it before we release it.
but per the communications with Joel and Sunil, I found my base is
wrong. so my original patch is not good. and Joel's patch has problem
either.

On 10-01-11 17:59, Joel Becker wrote:
> [Cc'd Mark and Dave]
> Signed-off-by: Joel Becker <joel.becker@oracle.com>
> ---
>  fs/ocfs2/dlmglue.c |   29 +++++++++++++++++++++++++++++
>  1 files changed, 29 insertions(+), 0 deletions(-)
> 
> diff --git a/fs/ocfs2/dlmglue.c b/fs/ocfs2/dlmglue.c
> index 90682a0..eabe53e 100644
> --- a/fs/ocfs2/dlmglue.c
> +++ b/fs/ocfs2/dlmglue.c
> @@ -1313,6 +1313,7 @@ static int __ocfs2_cluster_lock(struct ocfs2_super *osb,
>  	unsigned long flags;
>  	unsigned int gen;
>  	int noqueue_attempted = 0;
> +	int lock_attempted = 0;
>  
>  	mlog_entry_void();
>  
> @@ -1347,6 +1348,25 @@ again:
>  		goto unlock;
>  	}
>  
> +	if (lock_attempted && (lockres->l_level >= level)) {
> +		/*
> +		 * We've attempted to upconvert, and the lock now has
> +		 * a level we can work with.  If we fell through to the
> +		 * next checks, we could spin in an upconvert->downconvert
> +		 * cycle as other nodes pounded us.  Instead, we jump
> +		 * out and let the caller do some work.  If a downconvert
> +		 * has come in, it will do its thing as soon as the caller
> +		 * is done.
> +		 */
> +		goto update_holders;
> +	}

before update_holders, the lock could be DCed(since no BUSY flag set by
here).

and even after update_holders, the lock could be DCed too.

so that we get ocfs2_cluster_lock()(with holders increased) returned sucessfully
but actually we don't hold the dlm lock. --thus more than one node is
considering that they have the (EX) lock.

that's could be the cause of what is happening observed by David.

regards,
wengang.

  parent reply	other threads:[~2010-01-13  3:20 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-06  8:34 [Ocfs2-devel] [PATCH] ocfs2: fix __ocfs2_cluster_lock() dead lock Wengang Wang
2010-01-07  2:00 ` Joel Becker
2010-01-07  5:22   ` Wengang Wang
2010-01-09 18:05   ` Wengang Wang
2010-01-09 18:24     ` Sunil Mushran
2010-01-10 10:05       ` Joel Becker
2010-01-11  1:55         ` Wengang Wang
2010-01-12  1:59     ` Joel Becker
2010-01-12  3:58       ` Wengang Wang
2010-01-12 11:18         ` Joel Becker
2010-01-12 12:04           ` Wengang Wang
2010-01-12 13:01             ` Joel Becker
2010-01-12 14:30               ` Wengang Wang
2010-01-12 19:14                 ` Sunil Mushran
2010-01-13  6:15                   ` Wengang Wang
2010-01-12 19:47       ` David Teigland
2010-01-13  3:20       ` Wengang Wang [this message]
2010-01-13  7:08         ` Wengang Wang
2010-01-13  7:57         ` Joel Becker
2010-01-13  9:23           ` Wengang Wang
2010-01-13  9:31             ` Joel Becker
2010-01-13  9:36               ` Wengang Wang
2010-01-13 19:14           ` Sunil Mushran
2010-01-14  1:01             ` Joel Becker
2010-01-14  4:12               ` Wengang Wang
2010-01-21 15:30             ` David Teigland
2010-01-21 15:41               ` Sunil Mushran

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=20100113032049.GA4045@laptop.oracle.com \
    --to=wen.gang.wang@oracle.com \
    --cc=ocfs2-devel@oss.oracle.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 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.