[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

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



patch here to avoid race condition:
 
[root 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 aaastor com>

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]