From: Zhi Yong Wu <wuzhy@xxxxxxxxxxxxxxxxxx> Signed-off-by: Zhi Yong Wu <wuzhy@xxxxxxxxxxxxxxxxxx> --- drivers/target/tcm_vhost/tcm_vhost_scsi.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-) diff --git a/drivers/target/tcm_vhost/tcm_vhost_scsi.c b/drivers/target/tcm_vhost/tcm_vhost_scsi.c index 27caac4..30a2b1c 100644 --- a/drivers/target/tcm_vhost/tcm_vhost_scsi.c +++ b/drivers/target/tcm_vhost/tcm_vhost_scsi.c @@ -563,6 +563,13 @@ static int vhost_scsi_release(struct inode *inode, struct file *f) { struct vhost_scsi *s = f->private_data; + if (s->vs_tpg && s->vs_tpg->tport) { + struct vhost_vring_target backend; + memcpy(backend.vhost_wwpn, s->vs_tpg->tport->tport_name, sizeof(backend.vhost_wwpn)); + backend.vhost_tpgt = s->vs_tpg->tport_tpgt; + vhost_scsi_clear_endpoint(s, &backend); + } + vhost_dev_cleanup(&s->dev, false); kfree(s); return 0; -- 1.7.6 -- To unsubscribe from this list: send the line "unsubscribe target-devel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html