[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[dm-devel] [PATCH] dm-mpath: Track invalid map_context



The map_context pointer should always be set. However, we
have reports that upon requeing it is not set correctly.
So add a BUG_ON() statement and clear the pointer to
track the issue properly.

Cc: Alasdair Kergon <akg redhat com>
Cc: Mike Snitzer <snitzer redhat com>
Signed-off-by: Hannes Reinecke <hare suse de>
Tested-by: Heiko Carstens <heiko carstens de ibm com>
Acked-by: Dave Wysochanski <dwysocha redhat com>
---
 drivers/md/dm-mpath.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/drivers/md/dm-mpath.c b/drivers/md/dm-mpath.c
index 801d92d..94a91d6 100644
--- a/drivers/md/dm-mpath.c
+++ b/drivers/md/dm-mpath.c
@@ -920,8 +920,10 @@ static int multipath_map(struct dm_target *ti, struct request *clone,
 	map_context->ptr = mpio;
 	clone->cmd_flags |= REQ_FAILFAST_TRANSPORT;
 	r = map_io(m, clone, mpio, 0);
-	if (r < 0 || r == DM_MAPIO_REQUEUE)
+	if (r < 0 || r == DM_MAPIO_REQUEUE) {
 		mempool_free(mpio, m->mpio_pool);
+		map_context->ptr = NULL;
+	}
 
 	return r;
 }
@@ -1228,6 +1230,8 @@ static int do_end_io(struct multipath *m, struct request *clone,
 	int r = DM_ENDIO_REQUEUE;
 	unsigned long flags;
 
+	BUG_ON(!mpio);
+
 	if (!error && !clone->errors)
 		return 0;	/* I/O complete */
 
-- 
1.6.0.2


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]