Commit f7fbfdd1 authored by Mark Fasheh's avatar Mark Fasheh

ocfs2: Check for refreshing locks in generic unblock function

Tidy up the exit path a bit too.
Signed-off-by: default avatarMark Fasheh <mark.fasheh@oracle.com>
parent b80fc012
...@@ -2640,22 +2640,22 @@ static int ocfs2_generic_unblock_lock(struct ocfs2_super *osb, ...@@ -2640,22 +2640,22 @@ static int ocfs2_generic_unblock_lock(struct ocfs2_super *osb,
/* if we're blocking an exclusive and we have *any* holders, /* if we're blocking an exclusive and we have *any* holders,
* then requeue. */ * then requeue. */
if ((lockres->l_blocking == LKM_EXMODE) if ((lockres->l_blocking == LKM_EXMODE)
&& (lockres->l_ex_holders || lockres->l_ro_holders)) { && (lockres->l_ex_holders || lockres->l_ro_holders))
spin_unlock_irqrestore(&lockres->l_lock, flags); goto leave_requeue;
ctl->requeue = 1;
ret = 0;
goto leave;
}
/* If it's a PR we're blocking, then only /* If it's a PR we're blocking, then only
* requeue if we've got any EX holders */ * requeue if we've got any EX holders */
if (lockres->l_blocking == LKM_PRMODE && if (lockres->l_blocking == LKM_PRMODE &&
lockres->l_ex_holders) { lockres->l_ex_holders)
spin_unlock_irqrestore(&lockres->l_lock, flags); goto leave_requeue;
ctl->requeue = 1;
ret = 0; /*
goto leave; * Can we get a lock in this state if the holder counts are
} * zero? The meta data unblock code used to check this.
*/
if ((lockres->l_ops->flags & LOCK_TYPE_REQUIRES_REFRESH)
&& (lockres->l_flags & OCFS2_LOCK_REFRESHING))
goto leave_requeue;
/* If we get here, then we know that there are no more /* If we get here, then we know that there are no more
* incompatible holders (and anyone asking for an incompatible * incompatible holders (and anyone asking for an incompatible
...@@ -2692,6 +2692,13 @@ static int ocfs2_generic_unblock_lock(struct ocfs2_super *osb, ...@@ -2692,6 +2692,13 @@ static int ocfs2_generic_unblock_lock(struct ocfs2_super *osb,
leave: leave:
mlog_exit(ret); mlog_exit(ret);
return ret; return ret;
leave_requeue:
spin_unlock_irqrestore(&lockres->l_lock, flags);
ctl->requeue = 1;
mlog_exit(0);
return 0;
} }
static int ocfs2_data_convert_worker(struct ocfs2_lock_res *lockres, static int ocfs2_data_convert_worker(struct ocfs2_lock_res *lockres,
......
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