nbd: add pthread_detach for created thread

Using pthead_detach to let system take back the resources owned
by SPDK created thread for nbd kernel module.

Change-Id: I39f3c0b60ecf57f3227a7b4733a0f144a6e169c5
Signed-off-by: Xiaodong Liu <xiaodong.liu@intel.com>
Reviewed-on: https://review.gerrithub.io/388722
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
Xiaodong Liu 2017-11-22 22:31:27 -05:00 committed by Daniel Verkamp
parent 9c35e39c54
commit df14d53dfe

View File

@ -455,6 +455,13 @@ spdk_nbd_start(struct spdk_bdev *bdev, const char *nbd_path)
goto err;
}
rc = pthread_detach(tid);
if (rc != 0) {
spdk_strerror_r(rc, buf, sizeof(buf));
SPDK_ERRLOG("could not detach thread for nbd kernel: %s\n", buf);
goto err;
}
fcntl(nbd->spdk_sp_fd, F_SETFL, O_NONBLOCK);
to_be32(&nbd->io.resp.magic, NBD_REPLY_MAGIC);