From 33c8cb18b329d2e596960cb49308de44f2fb9036 Mon Sep 17 00:00:00 2001 From: Mike Smith Date: Sat, 16 Oct 1999 03:21:20 +0000 Subject: [PATCH] Use a much larger buffer for message log retrieval until we are sure that 32 bytes is safe. Handle successful completion of message log retrieval commands. With these changes, the driver correctly handles the consequences of drive death and replacement in a reliable array. Note that the massive backlog of I/O during handling of such an event can kill the system if softupdates is enabled. --- sys/dev/mlx/mlx.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/sys/dev/mlx/mlx.c b/sys/dev/mlx/mlx.c index 6b4e30ddcdd..94376f8a6f9 100644 --- a/sys/dev/mlx/mlx.c +++ b/sys/dev/mlx/mlx.c @@ -1103,7 +1103,7 @@ mlx_periodic_eventlog_poll(struct mlx_softc *sc) if ((mc = mlx_alloccmd(sc)) == NULL) goto out; /* allocate the response structure */ - if ((result = malloc(sizeof(struct mlx_eventlog_entry), M_DEVBUF, M_NOWAIT)) == NULL) + if ((result = malloc(/*sizeof(struct mlx_eventlog_entry)*/1024, M_DEVBUF, M_NOWAIT)) == NULL) goto out; /* get a command slot */ if (mlx_getslot(mc)) @@ -1111,7 +1111,7 @@ mlx_periodic_eventlog_poll(struct mlx_softc *sc) /* map the command so the controller can see it */ mc->mc_data = result; - mc->mc_length = sizeof(struct mlx_eventlog_entry); + mc->mc_length = /*sizeof(struct mlx_eventlog_entry)*/1024; mlx_mapcmd(mc); /* build the command to get one entry */ @@ -1125,14 +1125,14 @@ mlx_periodic_eventlog_poll(struct mlx_softc *sc) error = 0; /* success */ out: - if (mc != NULL) - mlx_releasecmd(mc); - if ((error != 0) && (result != NULL)) { - free(result, M_DEVBUF); - } - /* abort this event */ - if (error != 0) + if (error != 0) { + if (mc != NULL) + mlx_releasecmd(mc); + if (result != NULL) + free(result, M_DEVBUF); + /* abort this event */ MLX_PERIODIC_UNBUSY(sc); + } } /******************************************************************************** @@ -1404,6 +1404,7 @@ mlx_enquire(struct mlx_softc *sc, int command, size_t bufsize, void (* complete) /* we got a command, but nobody else will free it */ if ((complete == NULL) && (mc != NULL)) mlx_releasecmd(mc); + /* we got an error, and we allocated a result */ if ((error != 0) && (result != NULL)) { free(result, M_DEVBUF); result = NULL;