[Stgt-devel] [Open-FCoE] [PATCH 1/2] fcoe: fix frame/cmd leak.

Zou, Yi yi.zou
Wed Jul 23 10:36:29 CEST 2008


>We never call fc_frame_free in the xmit path so we leak frames.
>We also never then call the fr_destructor so the scst completion
>function is never called and target_cmd_done is never called which
>leaves stale commands in the target.
>
>Signed-off-by: Mike Christie <michaelc at cs.wisc.edu>
>---
> usr/fcoe/fcoe_dev.c |    3 +++
> 1 files changed, 3 insertions(+), 0 deletions(-)
>
>diff --git a/usr/fcoe/fcoe_dev.c b/usr/fcoe/fcoe_dev.c
>index 0027e79..2d0149c 100644
>--- a/usr/fcoe/fcoe_dev.c
>+++ b/usr/fcoe/fcoe_dev.c
>@@ -88,6 +88,8 @@ static void fcoe_recv_flogi(struct fcoe_softc *fc,
struct
>fc_frame *fp,
> static void fcoe_frame_free(struct fc_frame *fp)
> {
> 	dprintf("%p\n", fp->fr_free_priv);
>+	if (fp->fr_destructor)
>+		fp->fr_destructor(fp->fr_arg);
> 	free(fp->fr_free_priv);
> }
>
>@@ -200,6 +202,7 @@ int fcoe_xmit(struct fcdev *fdev, struct fc_frame
*fp)
> 	ret = write(fdev->fd, eh, total);
> 	if (ret <= 0)
> 		eprintf("%d %d %d\n", fdev->fd, total, ret);
>+	fc_frame_free(fp);
> 	return 0;
> }
>
>--
>1.5.5.1
>
>_______________________________________________
>devel mailing list
>devel at open-fcoe.org
>http://www.open-fcoe.org/mailman/listinfo/devel

Nice, I think this is what caused tgtd to complain about memory
corruption.

yi



More information about the stgt mailing list