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.] --- diff/drivers/md/dm-io.c 2004-06-11 10:19:45.201235056 +0000 +++ source/drivers/md/dm-io.c 2004-06-11 10:31:17.833938880 +0000 @@ -537,7 +537,9 @@ { struct io io; - BUG_ON(num_regions > 1 && rw != WRITE); + if (num_regions > 1 && rw != WRITE) { + return -EIO; + } io.error = 0; atomic_set(&io.count, 1); /* see dispatch_io() */ @@ -565,8 +567,14 @@ 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) { + 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;