[dm-devel] RFC: switch rh_in_sync to blocking in do_reads

Jonathan Brassow jbrassow at redhat.com
Thu Apr 5 15:22:27 UTC 2007


I think this was an oversight and the rh_in_sync call should be allowed
to block in do_reads.  Any reason why it is not coded that way?

 brassow

do_reads happens in the mirror worker thread and operations there are
allowed to block.  The call to rh_in_sync should be allowed to block.

This is especially important for cluster mirroring.  Since the
cluster log must ensure the region is in_sync cluster-wide and
must do network operations to ensure that, it will always return
-EWOULDBLOCK if 0 is given for the blocking argument.  The way
the code is written, a cluster mirror would never be allowed to
'choose_mirror'.

Index: linux-2.6.21-rc5-mm4/drivers/md/dm-raid1.c
===================================================================
--- linux-2.6.21-rc5-mm4.orig/drivers/md/dm-raid1.c
+++ linux-2.6.21-rc5-mm4/drivers/md/dm-raid1.c
@@ -741,7 +741,7 @@ static void do_reads(struct mirror_set *
 		/*
 		 * We can only read balance if the region is in sync.
 		 */
-		if (rh_in_sync(&ms->rh, region, 0))
+		if (rh_in_sync(&ms->rh, region, 1))
 			m = choose_mirror(ms, bio->bi_sector);
 		else
 			m = ms->default_mirror;





More information about the dm-devel mailing list