From: Joel Becker <Joel.Becker@oracle.com>
To: ocfs2-devel@oss.oracle.com
Subject: [Ocfs2-devel] [PATCH] ocfs2: fix __ocfs2_cluster_lock() dead lock
Date: Tue, 12 Jan 2010 05:01:30 -0800 [thread overview]
Message-ID: <20100112130129.GD3821@mail.oracle.com> (raw)
In-Reply-To: <20100112120419.GA4209@laptop.oracle.com>
On Tue, Jan 12, 2010 at 08:04:19PM +0800, Wengang Wang wrote:
> On 10-01-12 03:18, Joel Becker wrote:
> > DC thread only waits on PENDING and holders. If BUSY, it will
> > cancel the upconvert. If not BUSY, it will schedule a downconvert.
> > There's nothing stopping the downconvert, in other words.
...
> in ocfs2_unblock_lock() there are lines after checking for BUSY flag:
>
> if (lockres->l_ops->check_downconvert
> && !lockres->l_ops->check_downconvert(lockres, new_level))
> goto leave_requeue;
...
> if ctl->requeue is set, ocfs2_schedule_blocked_lock() will add the
> lockres to blocked_lock_list. the downconvert will then be rescheduled only
> if ocfs2_wake_downconvert_thread() is called somewhere.
> in this simple case:
> the "somewhere", I think, is in __ocfs2_cluster_unlock().
> so before __ocfs2_cluster_unlock() is called(surely after
> __ocfs2_cluster_lock() returns), the downconvert couldn't
> be rescheduled.
> thus __ocfs2_cluster_lock() is waiting for DC to finish and the DC is
> waiting __ocfs2_cluster_unlock() to be called. --deadlock.
>
> so maybe you don't notice the lockres->l_ops->check_downconvert()?
I notice it. I know what it checks. If the lock is not
currently taken it will return "go ahead and downconvert". So we
won't requeue, we'll downconvert. Specifically, look at
ocfs2_check_meta_downconvert(). It merely checks the caching info. We
can't have any cached data if we don't have the EX yet.
Sunil has observed the livelock behavior (pinging between UC and
DC) in the wild via traces. The UC process never leaves
ocfs2_cluster_lock(). Your change fixes that.
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
next prev parent reply other threads:[~2010-01-12 13:01 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 [this message]
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
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=20100112130129.GD3821@mail.oracle.com \
--to=joel.becker@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.