Commit bcd1661f authored by Kevin Corry's avatar Kevin Corry Committed by Linus Torvalds

[PATCH] dm: dm-io: Error handling

dm-io: Proper error handling when someone is trying to read from multiple
regions.
Signed-off-by: default avatarKevin Corry <kevcorry@us.ibm.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 1ede2e87
...@@ -537,7 +537,10 @@ static int sync_io(unsigned int num_regions, struct io_region *where, ...@@ -537,7 +537,10 @@ static int sync_io(unsigned int num_regions, struct io_region *where,
{ {
struct io io; struct io io;
BUG_ON(num_regions > 1 && rw != WRITE); if (num_regions > 1 && rw != WRITE) {
WARN_ON(1);
return -EIO;
}
io.error = 0; io.error = 0;
atomic_set(&io.count, 1); /* see dispatch_io() */ atomic_set(&io.count, 1); /* see dispatch_io() */
...@@ -565,8 +568,15 @@ static int sync_io(unsigned int num_regions, struct io_region *where, ...@@ -565,8 +568,15 @@ static int sync_io(unsigned int num_regions, struct io_region *where,
static int async_io(unsigned int num_regions, struct io_region *where, int rw, static int async_io(unsigned int num_regions, struct io_region *where, int rw,
struct dpages *dp, io_notify_fn fn, void *context) 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; io->error = 0;
atomic_set(&io->count, 1); /* see dispatch_io() */ atomic_set(&io->count, 1); /* see dispatch_io() */
io->sleeper = NULL; io->sleeper = NULL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment