public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Kevin Corry <kevcorry@us.ibm.com>
To: Andrew Morton <akpm@osdl.org>
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH] DM 3/5: dm-io: Error handling
Date: Mon, 14 Jun 2004 13:18:09 +0000	[thread overview]
Message-ID: <200406141318.09070.kevcorry@us.ibm.com> (raw)
In-Reply-To: <200406141309.31127.kevcorry@us.ibm.com>

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

Signed-off-by: Kevin Corry <kevcorry@us.ibm.com>

--- 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;

  parent reply	other threads:[~2004-06-14 18:15 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-06-14 13:09 [PATCH] DM 0/5: Device-mapper cleanups Kevin Corry
2004-06-14 13:16 ` [PATCH] DM 1/5: Create/destroy kcopyd on demand Kevin Corry
2004-06-14 13:17 ` [PATCH] DM 2/5: Use structure assignments instead of memcpy Kevin Corry
2004-06-14 13:18 ` Kevin Corry [this message]
2004-06-14 13:18 ` [PATCH] DM 4/5: dm-raid1.c: Make delayed_bios a bio_list Kevin Corry
2004-06-14 13:19 ` [PATCH] DM 5/5: dm-raid1.c: Use list_for_each_entry_safe Kevin Corry

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200406141318.09070.kevcorry@us.ibm.com \
    --to=kevcorry@us.ibm.com \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox