Revision ac7cf246dfdbec3d8fed296c7bf30e16f5099dac authored by Joseph Qi on 25 March 2016, 21:21:26 UTC, committed by Linus Torvalds on 25 March 2016, 23:37:42 UTC
There is a race window between dlmconvert_remote and
dlm_move_lockres_to_recovery_list, which will cause a lock with
OCFS2_LOCK_BUSY in grant list, thus system hangs.

dlmconvert_remote
{
        spin_lock(&res->spinlock);
        list_move_tail(&lock->list, &res->converting);
        lock->convert_pending = 1;
        spin_unlock(&res->spinlock);

        status = dlm_send_remote_convert_request();
        >>>>>> race window, master has queued ast and return DLM_NORMAL,
               and then down before sending ast.
               this node detects master down and calls
               dlm_move_lockres_to_recovery_list, which will revert the
               lock to grant list.
               Then OCFS2_LOCK_BUSY won't be cleared as new master won't
               send ast any more because it thinks already be authorized.

        spin_lock(&res->spinlock);
        lock->convert_pending = 0;
        if (status != DLM_NORMAL)
                dlm_revert_pending_convert(res, lock);
        spin_unlock(&res->spinlock);
}

In this case, check if res->state has DLM_LOCK_RES_RECOVERING bit set
(res is still in recovering) or res master changed (new master has
finished recovery), reset the status to DLM_RECOVERING, then it will
retry convert.

Signed-off-by: Joseph Qi <joseph.qi@huawei.com>
Reported-by: Yiwen Jiang <jiangyiwen@huawei.com>
Reviewed-by: Junxiao Bi <junxiao.bi@oracle.com>
Cc: Mark Fasheh <mfasheh@suse.de>
Cc: Joel Becker <jlbec@evilplan.org>
Cc: Tariq Saeed <tariq.x.saeed@oracle.com>
Cc: Junxiao Bi <junxiao.bi@oracle.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 2888868
History
File Mode Size
hvc
ipwireless
serial
vt
Kconfig -rw-r--r-- 16.9 KB
Makefile -rw-r--r-- 1.2 KB
amiserial.c -rw-r--r-- 45.6 KB
bfin_jtag_comm.c -rw-r--r-- 9.0 KB
cyclades.c -rw-r--r-- 109.8 KB
ehv_bytechan.c -rw-r--r-- 21.5 KB
goldfish.c -rw-r--r-- 9.0 KB
isicom.c -rw-r--r-- 41.3 KB
metag_da.c -rw-r--r-- 16.5 KB
mips_ejtag_fdc.c -rw-r--r-- 35.3 KB
moxa.c -rw-r--r-- 52.5 KB
moxa.h -rw-r--r-- 8.4 KB
mxser.c -rw-r--r-- 70.7 KB
mxser.h -rw-r--r-- 4.5 KB
n_gsm.c -rw-r--r-- 78.5 KB
n_hdlc.c -rw-r--r-- 26.8 KB
n_r3964.c -rw-r--r-- 30.8 KB
n_tracerouter.c -rw-r--r-- 7.1 KB
n_tracesink.c -rw-r--r-- 7.1 KB
n_tracesink.h -rw-r--r-- 1.3 KB
n_tty.c -rw-r--r-- 60.6 KB
nozomi.c -rw-r--r-- 47.9 KB
pty.c -rw-r--r-- 22.8 KB
rocket.c -rw-r--r-- 92.9 KB
rocket.h -rw-r--r-- 3.8 KB
rocket_int.h -rw-r--r-- 41.5 KB
synclink.c -rw-r--r-- 229.4 KB
synclink_gt.c -rw-r--r-- 131.7 KB
synclinkmp.c -rw-r--r-- 146.8 KB
sysrq.c -rw-r--r-- 26.2 KB
tty_audit.c -rw-r--r-- 5.7 KB
tty_buffer.c -rw-r--r-- 16.1 KB
tty_io.c -rw-r--r-- 90.1 KB
tty_ioctl.c -rw-r--r-- 30.2 KB
tty_ldisc.c -rw-r--r-- 19.2 KB
tty_ldsem.c -rw-r--r-- 11.2 KB
tty_mutex.c -rw-r--r-- 1.1 KB
tty_port.c -rw-r--r-- 15.3 KB

back to top