[PATCH] DM 3/5: dm-io: Error handling

From: Kevin Corry
Date: Mon Jun 14 2004 - 13:18:48 EST


dm-io: Proper error handling when someone is trying to read from multiple
regions.

Signed-off-by: Kevin Corry <kevcorry@xxxxxxxxxx>

--- 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;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/