+13
−4
Loading
It is theoretically possible for an asynchronous hotremove request to be finished before the hotplug request that was started first. This is obviously not expected and will most likely result in a resource leak. For SCSI target hotplug, we immediately update the whole vhost device object and then asynchronously ask each vhost session to poll the changes. For hotremove, we see the device attached in the whole vhost device object, so we immediately mark it as "still being removed" and proceed aynchronously asking the sessions to hotremove. When session receives the hotremove event first, it will either fail an assertion (when debug is on), or do nothing. The subsequent hotplug event will attach the target again - and that target won't be ever freed. Change-Id: I784c979fb47127a4238038ad9fb5ed1cac3ced04 Signed-off-by:Darek Stojaczyk <dariusz.stojaczyk@intel.com> Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/449391 Tested-by:
SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by:
Pawel Wodkowski <pawelx.wodkowski@intel.com> Reviewed-by:
Changpeng Liu <changpeng.liu@intel.com> Reviewed-by:
Jim Harris <james.r.harris@intel.com>