nbd: clear DISCONNECT_REQUESTED flag once disconnection occurs.
authorKevin Vigor <kvigor@fb.com>
Wed, 30 May 2018 16:45:11 +0000 (10:45 -0600)
committerJens Axboe <axboe@kernel.dk>
Wed, 30 May 2018 17:30:42 +0000 (11:30 -0600)
commit5e3c3a7ecefefaebc7c9a626fe4522cb85bbdaad
tree03f7f01f6c8164298296f87344a71dd754fab70b
parent2ab74cd29622c48e9852d85618081c061b6ac6d9
nbd: clear DISCONNECT_REQUESTED flag once disconnection occurs.

When a userspace client requests a NBD device be disconnected, the
DISCONNECT_REQUESTED flag is set. While this flag is set, the driver
will not inform userspace when a connection is closed.

Unfortunately the flag was never cleared, so once a disconnect was
requested the driver would thereafter never tell userspace about a
closed connection. Thus when connections failed due to timeout, no
attempt to reconnect was made and eventually the device would fail.

Fix by clearing the DISCONNECT_REQUESTED flag (and setting the
DISCONNECTED flag) once all connections are closed.

Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Kevin Vigor <kvigor@fb.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/block/nbd.c