All of lore.kernel.org
 help / color / mirror / Atom feed
From: Coly Li <coly.li@suse.de>
To: ocfs2-devel@oss.oracle.com
Subject: [Ocfs2-devel] [PATCH 9/9] ocfs2/dlm: Fix race during lockres mastery
Date: Wed, 24 Dec 2008 05:05:33 +0800	[thread overview]
Message-ID: <4951529D.2030803@suse.de> (raw)
In-Reply-To: <1229471363-15887-10-git-send-email-sunil.mushran@oracle.com>

Hi Sunil,

I do not find this patch in upstream yet. Do we have a recent plan to push this patch into upstream
? Once this patch get merged into linus tree, I can add it into sles10 sp2 kernel.

Thanks.

Sunil Mushran Wrote:
> dlm_get_lock_resource() is supposed to return a lock resource with a proper
> master. If multiple concurrent threads attempt to lookup the lockres for the
> same lockid while the lock mastery in underway, one or more threads are likely
> to return a lockres without a proper master.
> 
> This patch makes the threads wait in dlm_get_lock_resource() while the mastery
> is underway, ensuring all threads return the lockres with a proper master.
> 
> This issue is known to be limited to users using the flock() syscall. For all
> other fs operations, the ocfs2 dlmglue layer serializes the dlm op for each
> lockid.
> 
> Patch fixes Novell bz#425491
> https://bugzilla.novell.com/show_bug.cgi?id=425491
> 
> Users encountering this bug will see flock() return EINVAL and dmesg have the
> following error:
> ERROR: Dlm error "DLM_BADARGS" while calling dlmlock on resource <LOCKID>: bad api args
> 
> Reported-by: Coly Li <coyli@suse.de>
> Signed-off-by: Sunil Mushran <sunil.mushran@oracle.com>
> ---
>  fs/ocfs2/dlm/dlmmaster.c |    9 ++++++++-
>  1 files changed, 8 insertions(+), 1 deletions(-)
> 
> diff --git a/fs/ocfs2/dlm/dlmmaster.c b/fs/ocfs2/dlm/dlmmaster.c
> index cbf3abe..54e182a 100644
> --- a/fs/ocfs2/dlm/dlmmaster.c
> +++ b/fs/ocfs2/dlm/dlmmaster.c
> @@ -732,14 +732,21 @@ lookup:
>  	if (tmpres) {
>  		int dropping_ref = 0;
>  
> +		spin_unlock(&dlm->spinlock);
> +
>  		spin_lock(&tmpres->spinlock);
> +		/* We wait for the other thread that is mastering the resource */
> +		if (tmpres->owner == DLM_LOCK_RES_OWNER_UNKNOWN) {
> +			__dlm_wait_on_lockres(tmpres);
> +			BUG_ON(tmpres->owner == DLM_LOCK_RES_OWNER_UNKNOWN);
> +		}
> +
>  		if (tmpres->owner == dlm->node_num) {
>  			BUG_ON(tmpres->state & DLM_LOCK_RES_DROPPING_REF);
>  			dlm_lockres_grab_inflight_ref(dlm, tmpres);
>  		} else if (tmpres->state & DLM_LOCK_RES_DROPPING_REF)
>  			dropping_ref = 1;
>  		spin_unlock(&tmpres->spinlock);
> -		spin_unlock(&dlm->spinlock);
>  
>  		/* wait until done messaging the master, drop our ref to allow
>  		 * the lockres to be purged, start over. */

-- 
Coly Li
SuSE PRC Labs

  parent reply	other threads:[~2008-12-23 21:05 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-16 23:49 [Ocfs2-devel] Patches for the next merge window Sunil Mushran
2008-12-16 23:49 ` [Ocfs2-devel] [PATCH 1/9] ocfs2/hb: Exposes list of heartbeating nodes via debugfs Sunil Mushran
2008-12-17  1:08   ` Mark Fasheh
2008-12-17  9:03   ` tristan.ye
2008-12-17 18:52     ` Sunil Mushran
2008-12-16 23:49 ` [Ocfs2-devel] [PATCH 2/9] ocfs2: Moves struct recovery_map to a header file Sunil Mushran
2008-12-16 23:49 ` [Ocfs2-devel] [PATCH 3/9] ocfs2: Exposes the file system state via debugfs Sunil Mushran
2008-12-17  1:16   ` Mark Fasheh
2008-12-17 19:18     ` Sunil Mushran
2008-12-16 23:49 ` [Ocfs2-devel] [PATCH 4/9] ocfs2: Remove debugfs file local_alloc_stats Sunil Mushran
2008-12-16 23:49 ` [Ocfs2-devel] [PATCH 5/9] ocfs2/dlm: Fixes race between migrate request and exit domain Sunil Mushran
2008-12-16 23:49 ` [Ocfs2-devel] [PATCH 6/9] ocfs2/dlm: Clean errors in dlm_proxy_ast_handler() Sunil Mushran
2008-12-16 23:49 ` [Ocfs2-devel] [PATCH 7/9] ocfs2/dlm: Hold off sending lockres drop ref message while lockres is migrating Sunil Mushran
2008-12-16 23:49 ` [Ocfs2-devel] [PATCH 8/9] ocfs2/dlm: Fix race in adding/removing lockres' to/from the tracking list Sunil Mushran
2008-12-16 23:49 ` [Ocfs2-devel] [PATCH 9/9] ocfs2/dlm: Fix race during lockres mastery Sunil Mushran
2008-12-17  0:25   ` Mark Fasheh
2008-12-17  0:40     ` Sunil Mushran
2008-12-17  1:30   ` Mark Fasheh
2008-12-23 21:05   ` Coly Li [this message]
2008-12-23 21:06     ` 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=4951529D.2030803@suse.de \
    --to=coly.li@suse.de \
    --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.