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
Kconfig -rw-r--r-- 13.1 KB
Makefile -rw-r--r-- 1.6 KB
amd76xrom.c -rw-r--r-- 9.2 KB
bfin-async-flash.c -rw-r--r-- 5.0 KB
cfi_flagadm.c -rw-r--r-- 3.9 KB
ck804xrom.c -rw-r--r-- 10.6 KB
dc21285.c -rw-r--r-- 5.4 KB
esb2rom.c -rw-r--r-- 12.7 KB
gpio-addr-flash.c -rw-r--r-- 8.0 KB
ichxrom.c -rw-r--r-- 9.7 KB
impa7.c -rw-r--r-- 2.8 KB
intel_vr_nor.c -rw-r--r-- 6.8 KB
ixp4xx.c -rw-r--r-- 6.0 KB
l440gx.c -rw-r--r-- 4.0 KB
lantiq-flash.c -rw-r--r-- 5.4 KB
latch-addr-flash.c -rw-r--r-- 5.3 KB
map_funcs.c -rw-r--r-- 1.1 KB
netsc520.c -rw-r--r-- 4.1 KB
nettel.c -rw-r--r-- 11.5 KB
pci.c -rw-r--r-- 7.5 KB
pcmciamtd.c -rw-r--r-- 19.8 KB
physmap.c -rw-r--r-- 6.7 KB
physmap_of.c -rw-r--r-- 9.3 KB
pismo.c -rw-r--r-- 6.1 KB
plat-ram.c -rw-r--r-- 5.8 KB
pmcmsp-flash.c -rw-r--r-- 6.1 KB
pxa2xx-flash.c -rw-r--r-- 3.5 KB
rbtx4939-flash.c -rw-r--r-- 3.1 KB
sa1100-flash.c -rw-r--r-- 6.3 KB
sbc_gxx.c -rw-r--r-- 6.2 KB
sc520cdp.c -rw-r--r-- 8.9 KB
scb2_flash.c -rw-r--r-- 7.1 KB
scx200_docflash.c -rw-r--r-- 5.4 KB
solutionengine.c -rw-r--r-- 2.4 KB
sun_uflash.c -rw-r--r-- 3.5 KB
ts5500_flash.c -rw-r--r-- 2.8 KB
tsunami_flash.c -rw-r--r-- 2.5 KB
uclinux.c -rw-r--r-- 3.5 KB
vmu-flash.c -rw-r--r-- 19.4 KB

back to top