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: be within spinlock when checking the owner of a lockres
Date: Wed, 24 Mar 2010 14:41:51 -0700	[thread overview]
Message-ID: <4BAA871F.7030200@oracle.com> (raw)
In-Reply-To: <201003241442.o2NAdfs4028087@acsinet15.oracle.com>

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


Wengang Wang wrote:
> The checking of lockres owner in dlm_update_lvb() is not with spinlock
> protection. I don't see problem in current call path of dlm_update_lvb().
> But just for code robustness.
>
> Signed-off-by: Wengang Wang <wen.gang.wang@oracle.com>
> ---
>  fs/ocfs2/dlm/dlmast.c |    5 ++---
>  1 files changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/fs/ocfs2/dlm/dlmast.c b/fs/ocfs2/dlm/dlmast.c
> index dccc439..b7a25ef 100644
> --- a/fs/ocfs2/dlm/dlmast.c
> +++ b/fs/ocfs2/dlm/dlmast.c
> @@ -185,9 +185,8 @@ static void dlm_update_lvb(struct dlm_ctxt *dlm, struct dlm_lock_resource *res,
>  	BUG_ON(!lksb);
>  
>  	/* only updates if this node masters the lockres */
> +	spin_lock(&res->spinlock);
>  	if (res->owner == dlm->node_num) {
> -
> -		spin_lock(&res->spinlock);
>  		/* check the lksb flags for the direction */
>  		if (lksb->flags & DLM_LKSB_GET_LVB) {
>  			mlog(0, "getting lvb from lockres for %s node\n",
> @@ -202,8 +201,8 @@ static void dlm_update_lvb(struct dlm_ctxt *dlm, struct dlm_lock_resource *res,
>   		 * here. In the future we might want to clear it at the time
>   		 * the put is actually done.
>  		 */
> -		spin_unlock(&res->spinlock);
>  	}
> +	spin_unlock(&res->spinlock);
>  
>  	/* reset any lvb flags on the lksb */
>  	lksb->flags &= ~(DLM_LKSB_PUT_LVB|DLM_LKSB_GET_LVB);
>   

  reply	other threads:[~2010-03-24 21:41 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-24 14:40 [Ocfs2-devel] [PATCH] ocfs2: be within spinlock when checking the owner of a lockres Wengang Wang
2010-03-24 21:41 ` Sunil Mushran [this message]
2010-04-01  0:52 ` 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=4BAA871F.7030200@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.