All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sunil Mushran <sunil.mushran@oracle.com>
To: ocfs2-devel@oss.oracle.com
Subject: [Ocfs2-devel] [PATCH] ocfs2/dlm: remove potential deadlock -V3
Date: Fri, 30 Jul 2010 10:06:04 -0700	[thread overview]
Message-ID: <4C53067C.4090204@oracle.com> (raw)
In-Reply-To: <201007301519.o6UFJ5ch018098@acsinet15.oracle.com>

Acked-by: Sunil Mushran <sunil.mushran@oracle.com>

On 07/30/2010 08:18 AM, Wengang Wang wrote:
> When we need to take both dlm_domain_lock and dlm->spinlock, we should take
> them in order of: dlm_domain_lock then dlm->spinlock.
>
> There is pathes disobey this order. That is calling dlm_lockres_put() with
> dlm->spinlock held in dlm_run_purge_list. dlm_lockres_put() calls dlm_put() at
> the ref and dlm_put() locks on dlm_domain_lock.
>
> Fix:
> Don't grab/put the dlm when the initialising/releasing lockres.
> That grab is not required because we don't call dlm_unregister_domain()
> based on refcount.
>
> Signed-off-by: Wengang Wang<wen.gang.wang@oracle.com>
> ---
>   fs/ocfs2/dlm/dlmmaster.c |    4 ----
>   1 file changed, 4 deletions(-)
>
> diff --git a/fs/ocfs2/dlm/dlmmaster.c b/fs/ocfs2/dlm/dlmmaster.c
> index 94b97fc..0fe7c4d 100644
> --- a/fs/ocfs2/dlm/dlmmaster.c
> +++ b/fs/ocfs2/dlm/dlmmaster.c
> @@ -511,8 +511,6 @@ static void dlm_lockres_release(struct kref *kref)
>
>   	atomic_dec(&dlm->res_cur_count);
>
> -	dlm_put(dlm);
> -
>   	if (!hlist_unhashed(&res->hash_node) ||
>   	    !list_empty(&res->granted) ||
>   	    !list_empty(&res->converting) ||
> @@ -585,8 +583,6 @@ static void dlm_init_lockres(struct dlm_ctxt *dlm,
>   	res->migration_pending = 0;
>   	res->inflight_locks = 0;
>
> -	/* put in dlm_lockres_release */
> -	dlm_grab(dlm);
>   	res->dlm = dlm;
>
>   	kref_init(&res->refs);
>    

  reply	other threads:[~2010-07-30 17:06 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-30 13:53 [Ocfs2-devel] [PATCH] ocfs2/dlm: remove potential deadlock -V3 Wengang Wang
2010-07-30 14:45 ` Sunil Mushran
2010-07-30 15:08   ` Wengang Wang
2010-07-30 15:18   ` Wengang Wang
2010-07-30 17:06     ` Sunil Mushran [this message]
2010-08-07 18:40     ` Joel Becker

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=4C53067C.4090204@oracle.com \
    --to=sunil.mushran@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.