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

[dm-devel] (no subject)



Hi Joe,

For the test in multipath_map:
if (m->current_path && atomic_dec_and_test(&m->count))

atomic_dec_and_test returns true when count is zero, so I was seeing a 
new path selected every multipath_map call. The attached patch built 
against udm3 cleans up multipath_map and fixes this bug.


Mike Christie
mikenc us ibm com


 

--- linux-2.6.0-test10/drivers/md/dm-mpath.c	2003-12-23 01:48:00.628636037 -0800
+++ linux-2.6.0-test10-udm3/drivers/md/dm-mpath.c	2003-12-23 01:46:32.357982181 -0800
@@ -598,19 +598,16 @@ static int multipath_map(struct dm_targe
 	/*
 	 * Do we need to choose a new path?
 	 */
-	if (m->current_path && atomic_dec_and_test(&m->count))
-		path = m->current_path;
-
-	else {
+	if (!m->current_path || atomic_dec_and_test(&m->count)) {
 		if (__choose_path(m)) {
 			/* no paths */
 			spin_unlock_irqrestore(&m->path_lock, flags);
 			return -EIO;
-		} else
-			path = m->current_path;
+		}
 	}
-	spin_unlock_irqrestore(&m->path_lock, flags);
 
+	path = m->current_path;
+	spin_unlock_irqrestore(&m->path_lock, flags);
 	/* map */
 	bio->bi_rw |= (1 << BIO_RW_FAILFAST);
 	bio->bi_bdev = path->dev->bdev;

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