Commit 079b8057 authored by Sunil Mushran's avatar Sunil Mushran Committed by Joel Becker

ocfs2: Plugs race between the dc thread and an unlock ast message

This patch plugs a race between the downconvert thread and an unlock ast message.
Specifically, after the downconvert worker has done its task, the dc thread needs
to check whether an unlock ast made the downconvert moot.
Reported-by: default avatarDavid Teigland <teigland@redhat.com>
Signed-off-by: default avatarSunil Mushran <sunil.mushran@oracle.com>
Acked-by: default avatarMark Fasheh <mfasheh@sus.com>
Signed-off-by: default avatarJoel Becker <joel.becker@oracle.com>
parent db0f6ce6
...@@ -3384,6 +3384,7 @@ static int ocfs2_unblock_lock(struct ocfs2_super *osb, ...@@ -3384,6 +3384,7 @@ static int ocfs2_unblock_lock(struct ocfs2_super *osb,
unsigned long flags; unsigned long flags;
int blocking; int blocking;
int new_level; int new_level;
int level;
int ret = 0; int ret = 0;
int set_lvb = 0; int set_lvb = 0;
unsigned int gen; unsigned int gen;
...@@ -3503,6 +3504,7 @@ static int ocfs2_unblock_lock(struct ocfs2_super *osb, ...@@ -3503,6 +3504,7 @@ static int ocfs2_unblock_lock(struct ocfs2_super *osb,
* may sleep, so we save off a copy of what we're blocking as * may sleep, so we save off a copy of what we're blocking as
* it may change while we're not holding the spin lock. */ * it may change while we're not holding the spin lock. */
blocking = lockres->l_blocking; blocking = lockres->l_blocking;
level = lockres->l_level;
spin_unlock_irqrestore(&lockres->l_lock, flags); spin_unlock_irqrestore(&lockres->l_lock, flags);
ctl->unblock_action = lockres->l_ops->downconvert_worker(lockres, blocking); ctl->unblock_action = lockres->l_ops->downconvert_worker(lockres, blocking);
...@@ -3511,7 +3513,7 @@ static int ocfs2_unblock_lock(struct ocfs2_super *osb, ...@@ -3511,7 +3513,7 @@ static int ocfs2_unblock_lock(struct ocfs2_super *osb,
goto leave; goto leave;
spin_lock_irqsave(&lockres->l_lock, flags); spin_lock_irqsave(&lockres->l_lock, flags);
if (blocking != lockres->l_blocking) { if ((blocking != lockres->l_blocking) || (level != lockres->l_level)) {
/* If this changed underneath us, then we can't drop /* If this changed underneath us, then we can't drop
* it just yet. */ * it just yet. */
goto recheck; goto recheck;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment