nbd: relocate 2 mop-up ioctls
If spdk_nbd_stop is called because of socket error, ioctl of NBD_CLEAR_QUE and NBD_CLEAR_SOCK may be blocked which will cause deadlock. close(kernel_sp_fd/spdk_sp_fd) first, then nbd kernel module will not block them . Change-Id: I9527d74986cbd2b6188b9a91154de8b0b85d2836 Signed-off-by: Xiaodong Liu <xiaodong.liu@intel.com> Reviewed-on: https://review.gerrithub.io/393581 Tested-by: SPDK Automated Test System <sys_sgsw@intel.com> Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
parent
f869082a91
commit
96353bb19b
@ -228,12 +228,6 @@ _nbd_stop(struct spdk_nbd_disk *nbd)
|
||||
spdk_bdev_close(nbd->bdev_desc);
|
||||
}
|
||||
|
||||
if (nbd->dev_fd >= 0) {
|
||||
ioctl(nbd->dev_fd, NBD_CLEAR_QUE);
|
||||
ioctl(nbd->dev_fd, NBD_CLEAR_SOCK);
|
||||
close(nbd->dev_fd);
|
||||
}
|
||||
|
||||
if (nbd->nbd_path) {
|
||||
free(nbd->nbd_path);
|
||||
}
|
||||
@ -246,6 +240,12 @@ _nbd_stop(struct spdk_nbd_disk *nbd)
|
||||
close(nbd->kernel_sp_fd);
|
||||
}
|
||||
|
||||
if (nbd->dev_fd >= 0) {
|
||||
ioctl(nbd->dev_fd, NBD_CLEAR_QUE);
|
||||
ioctl(nbd->dev_fd, NBD_CLEAR_SOCK);
|
||||
close(nbd->dev_fd);
|
||||
}
|
||||
|
||||
if (nbd->nbd_poller) {
|
||||
spdk_poller_unregister(&nbd->nbd_poller);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user