[patch] [geom_multipath] detached device used as an active path

Oleg Sharoyko osharoiko at gmail.com
Wed Nov 10 21:12:17 UTC 2010


Hi Matthew,

Please take a look at the patch I'm attaching to this mail. It fixes
couple of issues with cp->active being left pointing to detached
device. I have as well tried to remove code duplication a bit by using
g_multipath_rotate() in g_mpd() and g_multipath_done_error() instead
of identical loops.

One thing which I'm not 100% sure about is this part (this is within
g_multipath_access()):

@@ -258,7 +268,7 @@

 	LIST_FOREACH(cp, &gp->consumer, consumer) {
 		error = g_access(cp, dr, dw, de);
-		if (error) {
+		if (error && error != ENXIO) {
 			badcp = cp;
 			goto fail;
 		}

This change fixes undesired behavior in the following case:

While running

while true; do
  echo
  date
  dd if=/dev/multipath/test of=/dev/null bs=512 count=1
  sleep 1
done

disconnect currently active path of /dev/multipath/test.

Without "&& error != ENXIO" I have exactly one failed dd. Whith it -
none of dd fails.

Shouldn't the overall logic of g_multipath_access() be as follows: try
to do what we're asked to do while there are at least one available
path, and remove from g_multipath any path for which g_access() call
has failed? I would suppose that multipath device should try to work
as long as there is at least one workable path, and any path which has
failed (no matter if it was a physical failure or, f.e. ENOMEM in
device driver) should be detached from multipath device.

-- 
Oleg Sharoyko
-------------- next part --------------
A non-text attachment was scrubbed...
Name: g_multipath.diff
Type: text/x-patch
Size: 3369 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-geom/attachments/20101110/3b1d3324/g_multipath.bin


More information about the freebsd-geom mailing list