dm-raid1.c a race bug in rh_dec()
PATCH 1/1 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.c 2005-06-16 14:18:25.000000000 +0800 renamed from dm-raid1.orig.c 2005-06-16 14:17:04.000000000 +0800 +1 -1
@@ -404,7 +404,6 @@ read_lock(&rh->hash_lock); reg = __rh_lookup(rh, region); - read_unlock(&rh->hash_lock); if (atomic_dec_and_test(®->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 <[email protected]>
Alasdair G Kergon
maintainerQuoted 1 line · Zhao Qian
patch here to avoid race condition:
And further analysis turns up several more races too.
But how many are left after applying the following patch?
Alasdair
drivers/md/dm-raid1.c +1 -1
@@ -1229,7 +1230,7 @@ static int __init dm_mirror_init(void)if (r)return r; - _kmirrord_wq =create_workqueue ("kmirrord" ); + _kmirrord_wq =create_singlethread_workqueue ("kmirrord" );if (!_kmirrord_wq) {DMERR ("couldn't start kmirrord" );dm_dirty_log_exit ();