]> rtime.felk.cvut.cz Git - hercules2020/nv-tegra/linux-4.4.git/commit
ocfs2/dlm: fix race between convert and migration
authorJoseph Qi <joseph.qi@huawei.com>
Mon, 19 Sep 2016 21:43:55 +0000 (14:43 -0700)
committerIshan Mittal <imittal@nvidia.com>
Fri, 6 Jan 2017 10:13:17 +0000 (15:43 +0530)
commitce6fac15f1430a7291702a1df4b3074b12288cdb
treea8d423552ef4b0612110dcb29b6f0a97a8de3c44
parent1d2c8e8ed2e60cb2acaca3e10722801690f58849
ocfs2/dlm: fix race between convert and migration

commit e6f0c6e6170fec175fe676495f29029aecdf486c upstream.

Commit ac7cf246dfdb ("ocfs2/dlm: fix race between convert and recovery")
checks if lockres master has changed to identify whether new master has
finished recovery or not.  This will introduce a race that right after
old master does umount ( means master will change), a new convert
request comes.

In this case, it will reset lockres state to DLM_RECOVERING and then
retry convert, and then fail with lockres->l_action being set to
OCFS2_AST_INVALID, which will cause inconsistent lock level between
ocfs2 and dlm, and then finally BUG.

Since dlm recovery will clear lock->convert_pending in
dlm_move_lockres_to_recovery_list, we can use it to correctly identify
the race case between convert and recovery.  So fix it.

Fixes: ac7cf246dfdb ("ocfs2/dlm: fix race between convert and recovery")
Link: http://lkml.kernel.org/r/57CE1569.8010704@huawei.com
Signed-off-by: Joseph Qi <joseph.qi@huawei.com>
Signed-off-by: Jun Piao <piaojun@huawei.com>
Cc: Mark Fasheh <mfasheh@suse.de>
Cc: Joel Becker <jlbec@evilplan.org>
Cc: Junxiao Bi <junxiao.bi@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/ocfs2/dlm/dlmconvert.c