On Mon, Mar 26, 2018 at 4:08 PM, 杨东升 <dongsheng.yang@xxxxxxxxxxxx> wrote: > > > > > > > > At 2018-03-26 19:52:32, "Ilya Dryomov" <idryomov@xxxxxxxxx> wrote: >>On Mon, Mar 26, 2018 at 11:50 AM, Dongsheng Yang >><dongsheng.yang@xxxxxxxxxxxx> wrote: >>> 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@xxxxxxxxxxxx> >>> --- >>> drivers/block/rbd.c | 51 >>> +++++++++++++++++++++++++++++++++++++++------------ >>> 1 file changed, 39 insertions(+), 12 deletions(-) >>> >>> diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c >>> index f1d9e60..8824053 100644 >>> --- a/drivers/block/rbd.c >>> +++ b/drivers/block/rbd.c >>> @@ -726,6 +726,7 @@ static struct rbd_client *rbd_client_find(struct >>> ceph_options *ceph_opts) >>> */ >>> enum { >>> Opt_queue_depth, >>> + Opt_lock_timeout, >>> Opt_last_int, >>> /* int args above */ >>> Opt_last_string, >>> @@ -739,6 +740,7 @@ enum { >>> >>> static match_table_t rbd_opts_tokens = { >>> {Opt_queue_depth, "queue_depth=%d"}, >>> + {Opt_lock_timeout, "lock_timeout=%d"}, >>> /* int args above */ >>> /* string args above */ >>> {Opt_read_only, "read_only"}, >>> @@ -751,16 +753,18 @@ enum { >>> }; >>> >>> struct rbd_options { >>> - int queue_depth; >>> - bool read_only; >>> - bool lock_on_read; >>> - bool exclusive; >>> + int queue_depth; >>> + unsigned long lock_timeout; >>> + bool read_only; >>> + bool lock_on_read; >>> + bool exclusive; >> >>No need to change whitespace, just add lock_timeout field. >> >>> }; >>> >>> -#define RBD_QUEUE_DEPTH_DEFAULT BLKDEV_MAX_RQ >>> -#define RBD_READ_ONLY_DEFAULT false >>> -#define RBD_LOCK_ON_READ_DEFAULT false >>> -#define RBD_EXCLUSIVE_DEFAULT false >>> +#define RBD_QUEUE_DEPTH_DEFAULT BLKDEV_MAX_RQ >>> +#define RBD_READ_ONLY_DEFAULT false >>> +#define RBD_LOCK_ON_READ_DEFAULT false >>> +#define RBD_EXCLUSIVE_DEFAULT false >>> +#define RBD_LOCK_TIMEOUT_DEFAULT 0 /* no timeout */ >> >>Same here. > > So, do we need another cleanup patch to make them aligned? No, it is fine as is. Thanks, Ilya -- To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html