On Friday 11 June 2004 5:40 pm, Kevin Corry wrote: > dm-io: Proper error handling when someone is trying to read from multiple > regions. > > [We still might be debating this one, but here's the latest patch for > review.] Here's a new version of this patch with WARN_ON()'s added before returning an error to the caller. This should help track down invalid uses of the APIs. -- Kevin Corry kevcorry@xxxxxxxxxx http://evms.sourceforge.net/ dm-io: Proper error handling when someone is trying to read from multiple regions. --- diff/drivers/md/dm-io.c 2004-06-14 10:46:31.944583472 +0000 +++ source/drivers/md/dm-io.c 2004-06-14 10:47:10.568711712 +0000 @@ -537,7 +537,10 @@ { struct io io; - BUG_ON(num_regions > 1 && rw != WRITE); + if (num_regions > 1 && rw != WRITE) { + WARN_ON(1); + return -EIO; + } io.error = 0; atomic_set(&io.count, 1); /* see dispatch_io() */ @@ -565,8 +568,15 @@ static int async_io(unsigned int num_regions, struct io_region *where, int rw, struct dpages *dp, io_notify_fn fn, void *context) { - struct io *io = mempool_alloc(_io_pool, GFP_NOIO); + struct io *io; + + if (num_regions > 1 && rw != WRITE) { + WARN_ON(1); + fn(1, context); + return -EIO; + } + io = mempool_alloc(_io_pool, GFP_NOIO); io->error = 0; atomic_set(&io->count, 1); /* see dispatch_io() */ io->sleeper = NULL;