Commit 11774a35 authored by Shuhei Matsumoto's avatar Shuhei Matsumoto Committed by Jim Harris
Browse files

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: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/391321


Tested-by: default avatarSPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
parent ded506f7
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -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;
}