* [Ocfs2-devel] [patch 25/25] ocfs2/dlm: move lock to the tail of grant queue while doing in-place convert
@ 2016-03-23 20:12 akpm at linux-foundation.org
2016-03-24 0:21 ` Joseph Qi
0 siblings, 1 reply; 2+ messages in thread
From: akpm at linux-foundation.org @ 2016-03-23 20:12 UTC (permalink / raw)
To: ocfs2-devel
From: xuejiufei <xuejiufei@huawei.com>
Subject: ocfs2/dlm: move lock to the tail of grant queue while doing in-place convert
We have found a bug when two nodes doing umount one after another.
1) Node 1 migrate a lockres that has 3 locks in grant queue such as
N2(PR)<->N3(NL)<->N4(PR) to N2. After migration, lvb of the lock
N3(NL) and N4(PR) are empty on node 2 because migration target do not
copy lvb to these two lock.
2) Node 3 want to convert to PR, it can be granted in
__dlmconvert_master(), and the order of these locks is unchanged. The
lvb of the lock N3(PR) on node 2 is copyed from lockres in function
dlm_update_lvb() while the lvb of lock N4(PR) is still empty.
3) Node 2 want to leave domain, it will migrate this lockres to node 3.
Then node 2 will trigger the BUG in dlm_prepare_lvb_for_migration()
when adding the lock N4(PR) to mres with the following message because
the lvb of mres is already copied from lock N3(PR), but the lvb of lock
N4(PR) is empty.
"Mismatched lvb in lock cookie=%u:%llu, name=%.*s, node=%u"
[akpm at linux-foundation.org: tweak comment]
Signed-off-by: xuejiufei <xuejiufei@huawei.com>
Cc: Mark Fasheh <mfasheh@suse.de>
Cc: Joel Becker <jlbec@evilplan.org>
Cc: Junxiao Bi <junxiao.bi@oracle.com>
Cc: Joseph Qi <joseph.qi@huawei.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
fs/ocfs2/dlm/dlmconvert.c | 6 ++++++
1 file changed, 6 insertions(+)
diff -puN fs/ocfs2/dlm/dlmconvert.c~ocfs2-dlm-move-lock-to-the-tail-of-grant-queue-while-doing-in-place-convert fs/ocfs2/dlm/dlmconvert.c
--- a/fs/ocfs2/dlm/dlmconvert.c~ocfs2-dlm-move-lock-to-the-tail-of-grant-queue-while-doing-in-place-convert
+++ a/fs/ocfs2/dlm/dlmconvert.c
@@ -212,6 +212,12 @@ grant:
if (lock->lksb->flags & DLM_LKSB_PUT_LVB)
memcpy(res->lvb, lock->lksb->lvb, DLM_LVB_LEN);
+ /*
+ * Move the lock to the tail because it may be the only lock which has
+ * an invalid lvb.
+ */
+ list_move_tail(&lock->list, &res->granted);
+
status = DLM_NORMAL;
*call_ast = 1;
goto unlock_exit;
_
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Ocfs2-devel] [patch 25/25] ocfs2/dlm: move lock to the tail of grant queue while doing in-place convert
2016-03-23 20:12 [Ocfs2-devel] [patch 25/25] ocfs2/dlm: move lock to the tail of grant queue while doing in-place convert akpm at linux-foundation.org
@ 2016-03-24 0:21 ` Joseph Qi
0 siblings, 0 replies; 2+ messages in thread
From: Joseph Qi @ 2016-03-24 0:21 UTC (permalink / raw)
To: ocfs2-devel
On 2016/3/24 4:12, akpm at linux-foundation.org wrote:
> From: xuejiufei <xuejiufei@huawei.com>
> Subject: ocfs2/dlm: move lock to the tail of grant queue while doing in-place convert
>
> We have found a bug when two nodes doing umount one after another.
>
> 1) Node 1 migrate a lockres that has 3 locks in grant queue such as
> N2(PR)<->N3(NL)<->N4(PR) to N2. After migration, lvb of the lock
> N3(NL) and N4(PR) are empty on node 2 because migration target do not
> copy lvb to these two lock.
>
> 2) Node 3 want to convert to PR, it can be granted in
> __dlmconvert_master(), and the order of these locks is unchanged. The
> lvb of the lock N3(PR) on node 2 is copyed from lockres in function
> dlm_update_lvb() while the lvb of lock N4(PR) is still empty.
>
> 3) Node 2 want to leave domain, it will migrate this lockres to node 3.
> Then node 2 will trigger the BUG in dlm_prepare_lvb_for_migration()
> when adding the lock N4(PR) to mres with the following message because
> the lvb of mres is already copied from lock N3(PR), but the lvb of lock
> N4(PR) is empty.
>
> "Mismatched lvb in lock cookie=%u:%llu, name=%.*s, node=%u"
>
> [akpm at linux-foundation.org: tweak comment]
> Signed-off-by: xuejiufei <xuejiufei@huawei.com>
Acked-by: Joseph Qi <joseph.qi@huawei.com>
> Cc: Mark Fasheh <mfasheh@suse.de>
> Cc: Joel Becker <jlbec@evilplan.org>
> Cc: Junxiao Bi <junxiao.bi@oracle.com>
> Cc: Joseph Qi <joseph.qi@huawei.com>
> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
> ---
>
> fs/ocfs2/dlm/dlmconvert.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff -puN fs/ocfs2/dlm/dlmconvert.c~ocfs2-dlm-move-lock-to-the-tail-of-grant-queue-while-doing-in-place-convert fs/ocfs2/dlm/dlmconvert.c
> --- a/fs/ocfs2/dlm/dlmconvert.c~ocfs2-dlm-move-lock-to-the-tail-of-grant-queue-while-doing-in-place-convert
> +++ a/fs/ocfs2/dlm/dlmconvert.c
> @@ -212,6 +212,12 @@ grant:
> if (lock->lksb->flags & DLM_LKSB_PUT_LVB)
> memcpy(res->lvb, lock->lksb->lvb, DLM_LVB_LEN);
>
> + /*
> + * Move the lock to the tail because it may be the only lock which has
> + * an invalid lvb.
> + */
> + list_move_tail(&lock->list, &res->granted);
> +
> status = DLM_NORMAL;
> *call_ast = 1;
> goto unlock_exit;
> _
>
> .
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-03-24 0:21 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-23 20:12 [Ocfs2-devel] [patch 25/25] ocfs2/dlm: move lock to the tail of grant queue while doing in-place convert akpm at linux-foundation.org
2016-03-24 0:21 ` Joseph Qi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).