OSDN Git Service

nbd: fix zero cmd timeout handling v2
authorMike Christie <mchristi@redhat.com>
Tue, 13 Aug 2019 16:39:52 +0000 (11:39 -0500)
committerJens Axboe <axboe@kernel.dk>
Tue, 20 Aug 2019 18:44:05 +0000 (12:44 -0600)
commit2da22da573481cc4837e246d0eee4d518b3f715e
treec87fc744e953da3d4d25e6bb4ce87a2626dffb37
parent887e975c4172d0d5670c39ead2f18ba1e4ec8133
nbd: fix zero cmd timeout handling v2

This fixes a regression added in 4.9 with commit:

commit 0eadf37afc2500e1162c9040ec26a705b9af8d47
Author: Josef Bacik <jbacik@fb.com>
Date:   Thu Sep 8 12:33:40 2016 -0700

    nbd: allow block mq to deal with timeouts

where before the patch userspace would set the timeout to 0 to disable
it. With the above patch, a zero timeout tells the block layer to use
the default value of 30 seconds. For setups where commands can take a
long time or experience transient issues like network disruptions this
then results in IO errors being sent to the application.

To fix this, the patch still uses the common block layer timeout
framework, but if zero is set, nbd just logs a message and then resets
the timer when it expires.

Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Mike Christie <mchristi@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/block/nbd.c