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 1/1]ocfs2: add spinlock protection when dealing with lockres->purge.
Date: Thu, 03 Sep 2009 09:22:27 -0700	[thread overview]
Message-ID: <4A9FED43.2030808@oracle.com> (raw)
In-Reply-To: <200909030758.n837wl02001895@rgminet13.oracle.com>

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

Wengang Wang wrote:
> when we check/modify lockres->purge, we should with the protection of lockres->spinlock.
> in dlm_purge_lockres(), the checking/modifying is not with the protectin.
> this patch fixes it.
>
> Signed-off-by: Wengang Wang <wen.gang.wang@oracle.com>
> ---
>  fs/ocfs2/dlm/dlmthread.c |    6 +++++-
>  1 files changed, 5 insertions(+), 1 deletions(-)
>
> diff --git a/fs/ocfs2/dlm/dlmthread.c b/fs/ocfs2/dlm/dlmthread.c
> index d490b66..98569e8 100644
> --- a/fs/ocfs2/dlm/dlmthread.c
> +++ b/fs/ocfs2/dlm/dlmthread.c
> @@ -212,14 +212,18 @@ static int dlm_purge_lockres(struct dlm_ctxt *dlm,
>  		spin_lock(&dlm->spinlock);
>  	}
>  
> +	spin_lock(&res->spinlock);
>  	if (!list_empty(&res->purge)) {
>  		mlog(0, "removing lockres %.*s:%p from purgelist, "
>  		     "master = %d\n", res->lockname.len, res->lockname.name,
>  		     res, master);
>  		list_del_init(&res->purge);
> +		spin_unlock(&res->spinlock);
>  		dlm_lockres_put(res);
>  		dlm->purge_count--;
> -	}
> +	} else
> +		spin_unlock(&res->spinlock);
> +
>  	__dlm_unhash_lockres(res);
>  
>  	/* lockres is not in the hash now.  drop the flag and wake up
>   

      reply	other threads:[~2009-09-03 16:22 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-03  7:56 [Ocfs2-devel] [PATCH 1/1]ocfs2: add spinlock protection when dealing with lockres->purge Wengang Wang
2009-09-03 16:22 ` Sunil Mushran [this message]

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=4A9FED43.2030808@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.