Commit 998feedb authored by Xiaodong Liu's avatar Xiaodong Liu Committed by Daniel Verkamp
Browse files

nbd: place mop-up ioctl to _nbd_stop



At present, close(dev_fd) is always executed before the
return of ioctl(nbd->dev_fd, NBD_DO_IT). So when executing
these 2 ioctl commands, dev_fd is already closed.

Change-Id: I6fce73c440972af91f662f24c1fbca51a7b95d61
Signed-off-by: default avatarXiaodong Liu <xiaodong.liu@intel.com>
Reviewed-on: https://review.gerrithub.io/391708


Tested-by: default avatarSPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
Reviewed-by: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
parent 122c7db7
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -229,6 +229,8 @@ _nbd_stop(struct spdk_nbd_disk *nbd)
	}

	if (nbd->dev_fd >= 0) {
		ioctl(nbd->dev_fd, NBD_CLEAR_QUE);
		ioctl(nbd->dev_fd, NBD_CLEAR_SOCK);
		close(nbd->dev_fd);
	}

@@ -512,8 +514,7 @@ nbd_start_kernel(void *arg)

	/* This will block in the kernel until we close the spdk_sp_fd. */
	ioctl(dev_fd, NBD_DO_IT);
	ioctl(dev_fd, NBD_CLEAR_QUE);
	ioctl(dev_fd, NBD_CLEAR_SOCK);

	pthread_exit(NULL);
}