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

Matthew Jacob mj at feral.com
Wed Nov 10 22:02:37 UTC 2010


It's going to take me a bit to digest this. I have a huge set of diffs I 
haven't brought in yet.


On 11/10/2010 12:41 PM, Oleg Sharoyko wrote:
> 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.
>


More information about the freebsd-geom mailing list