iscsi: Stale pointer when deleting PG and then IG

This bug is detected by test/iscsi_tgt/rpc_config

Due to the PG-IG map tree, IG-map is added to PG-map.
When PG was deleted first, PG-map was not deleted but PG was
deleted because PG-map has IG-maps.

PG-IG map tree was designed such that when PG was deleted first,
delete all IG-maps belonging to the PG-map, the PG-map, and then
PG.

By this change stale pointer which will cause memory leak is
removed.

Change-Id: I15c2ef48bad34608e53d0b44459c90a0cffda24d
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/391321
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:
Shuhei Matsumoto 2017-12-12 09:17:32 +09:00 committed by Jim Harris
parent ded506f742
commit 11774a35a8

View File

@ -601,9 +601,11 @@ spdk_iscsi_tgt_node_delete_pg_map(struct spdk_iscsi_tgt_node *target,
}
if (pg_map->num_ig_maps > 0) {
return -ENOTEMPTY;
SPDK_DEBUGLOG(SPDK_LOG_ISCSI, "delete %d ig_maps forcefully\n",
pg_map->num_ig_maps);
}
spdk_iscsi_pg_map_delete_all_ig_maps(pg_map);
_spdk_iscsi_tgt_node_delete_pg_map(target, pg_map);
return 0;
}