summaryrefslogtreecommitdiffstats
path: root/sys/geom
diff options
context:
space:
mode:
authorle <le@FreeBSD.org>2004-06-22 14:54:31 +0000
committerle <le@FreeBSD.org>2004-06-22 14:54:31 +0000
commit853033de651b9a9b37673c846130b9e045dcac90 (patch)
treec0162a46317212a8097fb92c5449a5e398eedd51 /sys/geom
parent1201cc464b96b7ef6d817edcaeae16c46d69cb6f (diff)
downloadFreeBSD-src-853033de651b9a9b37673c846130b9e045dcac90.zip
FreeBSD-src-853033de651b9a9b37673c846130b9e045dcac90.tar.gz
Don't sleep in the g_down path. More error checks to come.
Diffstat (limited to 'sys/geom')
-rw-r--r--sys/geom/vinum/geom_vinum_raid5.c36
1 files changed, 27 insertions, 9 deletions
diff --git a/sys/geom/vinum/geom_vinum_raid5.c b/sys/geom/vinum/geom_vinum_raid5.c
index 62b6ea9..6d67b1c 100644
--- a/sys/geom/vinum/geom_vinum_raid5.c
+++ b/sys/geom/vinum/geom_vinum_raid5.c
@@ -357,7 +357,9 @@ gv_build_raid5_req(struct gv_raid5_packet *wp, struct bio *bp, caddr_t addr,
* the desired data.
*/
if (wp->type == DEGRADED) {
- wp->buf = g_malloc(wp->length, M_WAITOK | M_ZERO);
+ wp->buf = g_malloc(wp->length, M_NOWAIT | M_ZERO);
+ if (wp->buf == NULL)
+ return (ENOMEM);
wp->bufmalloc = 1;
LIST_FOREACH(s, &p->subdisks, in_plex) {
/* Skip the broken subdisk. */
@@ -369,7 +371,9 @@ gv_build_raid5_req(struct gv_raid5_packet *wp, struct bio *bp, caddr_t addr,
if (rbp->bio == NULL)
return (ENOMEM);
rbp->buf = g_malloc(wp->length,
- M_WAITOK | M_ZERO);
+ M_NOWAIT | M_ZERO);
+ if (rbp->buf == NULL)
+ return (ENOMEM);
rbp->malloc = 1;
rbp->bio->bio_cmd = BIO_READ;
rbp->bio->bio_offset = wp->offset;
@@ -414,7 +418,9 @@ gv_build_raid5_req(struct gv_raid5_packet *wp, struct bio *bp, caddr_t addr,
* write the parity stripe back out.
*/
if (wp->type == DEGRADED) {
- wp->buf = g_malloc(wp->length, M_WAITOK | M_ZERO);
+ wp->buf = g_malloc(wp->length, M_NOWAIT | M_ZERO);
+ if (wp->buf == NULL)
+ return (ENOMEM);
wp->bufmalloc = 1;
/* Copy the original data. */
@@ -432,7 +438,9 @@ gv_build_raid5_req(struct gv_raid5_packet *wp, struct bio *bp, caddr_t addr,
if (rbp->bio == NULL)
return (ENOMEM);
rbp->buf = g_malloc(wp->length,
- M_WAITOK | M_ZERO);
+ M_NOWAIT | M_ZERO);
+ if (rbp->buf == NULL)
+ return (ENOMEM);
rbp->malloc = 1;
rbp->bio->bio_cmd = BIO_READ;
rbp->bio->bio_data = rbp->buf;
@@ -476,7 +484,9 @@ gv_build_raid5_req(struct gv_raid5_packet *wp, struct bio *bp, caddr_t addr,
* recalculate the parity again.
*/
} else if (wp->type == COMBINED) {
- wp->buf = g_malloc(wp->length, M_WAITOK | M_ZERO);
+ wp->buf = g_malloc(wp->length, M_NOWAIT | M_ZERO);
+ if (wp->buf == NULL)
+ return (ENOMEM);
wp->bufmalloc = 1;
/* Get the data from all subdisks. */
@@ -492,7 +502,9 @@ gv_build_raid5_req(struct gv_raid5_packet *wp, struct bio *bp, caddr_t addr,
return (ENOMEM);
rbp->bio->bio_cmd = BIO_READ;
rbp->buf = g_malloc(wp->length,
- M_WAITOK | M_ZERO);
+ M_NOWAIT | M_ZERO);
+ if (rbp->buf == NULL)
+ return (ENOMEM);
rbp->malloc = 1;
rbp->bio->bio_data = rbp->buf;
rbp->bio->bio_offset = wp->offset;
@@ -544,7 +556,9 @@ gv_build_raid5_req(struct gv_raid5_packet *wp, struct bio *bp, caddr_t addr,
return (ENOMEM);
rbp->bio->bio_cmd = BIO_READ;
rbp->buf = g_malloc(wp->length,
- M_WAITOK | M_ZERO);
+ M_NOWAIT | M_ZERO);
+ if (rbp->buf == NULL)
+ return (ENOMEM);
rbp->malloc = 1;
rbp->bio->bio_data = rbp->buf;
rbp->bio->bio_offset = wp->offset;
@@ -568,7 +582,9 @@ gv_build_raid5_req(struct gv_raid5_packet *wp, struct bio *bp, caddr_t addr,
* out the parity again.
*/
} else {
- wp->buf = g_malloc(wp->length, M_WAITOK | M_ZERO);
+ wp->buf = g_malloc(wp->length, M_NOWAIT | M_ZERO);
+ if (wp->buf == NULL)
+ return (ENOMEM);
wp->bufmalloc = 1;
LIST_FOREACH(s, &p->subdisks, in_plex) {
/* Skip the parity stripe. */
@@ -591,7 +607,9 @@ gv_build_raid5_req(struct gv_raid5_packet *wp, struct bio *bp, caddr_t addr,
} else {
rbp->bio->bio_cmd = BIO_READ;
rbp->buf = g_malloc(wp->length,
- M_WAITOK | M_ZERO);
+ M_NOWAIT | M_ZERO);
+ if (rbp->buf == NULL)
+ return (ENOMEM);
rbp->malloc = 1;
}
rbp->bio->bio_data = rbp->buf;
OpenPOWER on IntegriCloud