Skip to contentSkip to conversation

RFC: switch rh_in_sync to blocking in do_reads

PATCH Jonathan Brassow 1 participant 1 message Apr 5, 2007 Device mapper

lore
Share & tools
lore
#0 lore raw

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'.

drivers/md/dm-raid1.c +1 -1
Index: 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;