rbd: support timeout in rbd_wait_state_locked()
authorDongsheng Yang <dongsheng.yang@easystack.cn>
Mon, 26 Mar 2018 14:22:55 +0000 (10:22 -0400)
committerIlya Dryomov <idryomov@gmail.com>
Mon, 16 Apr 2018 07:38:40 +0000 (09:38 +0200)
commit34f55d0b3a0a39c95134c0c89173893b846d4c80
treec4421bd5aa961599e55a35a0151f18b528c9f8d6
parent2f18d46683cb3047c41229d57cf7c6e2ee48676f
rbd: support timeout in rbd_wait_state_locked()

currently, the rbd_wait_state_locked() will wait forever if we
can't get our state locked. Example:

rbd map --exclusive test1  --> /dev/rbd0
rbd map test1  --> /dev/rbd1
dd if=/dev/zero of=/dev/rbd1 bs=1M count=1 --> IO blocked

To avoid this problem, this patch introduce a timeout design
in rbd_wait_state_locked(). Then rbd_wait_state_locked() will
return error when we reach a timeout.

This patch allow user to set the lock_timeout in rbd mapping.

Signed-off-by: Dongsheng Yang <dongsheng.yang@easystack.cn>
Reviewed-by: Ilya Dryomov <idryomov@gmail.com>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
drivers/block/rbd.c