[dm-devel] [patch] dm-raid1.c a race bug in rh_dec()

Zhao Qian zhaoqian at aaastor.com
Thu Jun 16 06:40:05 UTC 2005


patch here to avoid race condition:

[root at darkstar md]# diff -u dm-raid1.orig.c dm-raid1.c 
--- dm-raid1.orig.c     2005-06-16 14:17:04.000000000 +0800
+++ dm-raid1.c  2005-06-16 14:18:25.000000000 +0800
@@ -404,7 +404,6 @@
 
        read_lock(&rh->hash_lock);
        reg = __rh_lookup(rh, region);
-       read_unlock(&rh->hash_lock);
 
        if (atomic_dec_and_test(&reg->pending)) {
                spin_lock_irqsave(&rh->region_lock, flags);
@@ -418,6 +417,7 @@
                should_wake = 1;
        }
 
+       read_unlock(&rh->hash_lock);
        if (should_wake)
                wake();
 }



Sincerely,
    AiM9 <zhaoqian at aaastor.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/dm-devel/attachments/20050616/a6047aef/attachment.htm>


More information about the dm-devel mailing list