[dm-devel] [PATCH] Round-robin path selector adds paths in wrong order.

Jonathan Brassow jbrassow at redhat.com
Wed Nov 1 18:53:04 UTC 2006


 brassow

When adding paths to the round-robin path selector, we expect to get
a FIFO behavior.  Instead, we get FILO.  This can be especially bad
if we specify a repeat count of 0, because it will result in us never
getting the path we wanted.

Here is an example of the problem:
[root at neo-04 ~]# echo "0 1024 error" | dmsetup create error
[root at neo-04 ~]# echo "0 1024 zero" | dmsetup create zero
[root at neo-04 ~]# echo "0 1024 multipath 0 0 1 1 round-robin 0 2 1 /dev/mapper/error 0 /dev/mapper/zero 0" | dmsetup create mpath
[root at neo-04 ~]# dd if=/dev/mapper/mpath of=/dev/null
1024+0 records in
1024+0 records out
[root at neo-04 ~]# dmsetup status mpath
0 1024 multipath 1 0 0 1 1 A 0 2 0 253:2 A 0 253:3 A 0
[root at neo-04 ~]# dmsetup remove mpath
[root at neo-04 ~]# echo "0 1024 multipath 0 0 1 1 round-robin 0 2 1 /dev/mapper/zero 0 /dev/mapper/error 0" | dmsetup create mpath
[root at neo-04 ~]# dd if=/dev/mapper/mpath of=/dev/null
1024+0 records in
1024+0 records out
[root at neo-04 ~]# dmsetup status mpath
0 1024 multipath 1 0 0 1 1 A 0 2 0 253:3 A 0 253:2 F 1

The problem stems from using 'list_add' where 'list_add_tail' should have
been used.

Index: linux-2.6.18.1/drivers/md/dm-round-robin.c
===================================================================
--- linux-2.6.18.1.orig/drivers/md/dm-round-robin.c	2006-10-31 14:21:33.000000000 -0600
+++ linux-2.6.18.1/drivers/md/dm-round-robin.c	2006-11-01 12:41:13.000000000 -0600
@@ -136,7 +136,7 @@ static int rr_add_path(struct path_selec
 
 	path->pscontext = pi;
 
-	list_add(&pi->list, &s->valid_paths);
+	list_add_tail(&pi->list, &s->valid_paths);
 
 	return 0;
 }





More information about the dm-devel mailing list