Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 8313
b: refs/heads/master
c: 844e8d9
h: refs/heads/master
i:
  8311: d1fc7e8
v: v3
  • Loading branch information
Jun'ichi Nomura authored and Linus Torvalds committed Sep 9, 2005
1 parent ab777b1 commit cff6b98
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: e5dcdd80a60627371f40797426273048630dc8ca
refs/heads/master: 844e8d904a7c1446e3f040683b4a0645c3eb168f
12 changes: 9 additions & 3 deletions trunk/drivers/md/dm-raid1.c
Original file line number Diff line number Diff line change
Expand Up @@ -375,16 +375,18 @@ static void rh_inc(struct region_hash *rh, region_t region)

read_lock(&rh->hash_lock);
reg = __rh_find(rh, region);

atomic_inc(&reg->pending);

spin_lock_irq(&rh->region_lock);
if (reg->state == RH_CLEAN) {
rh->log->type->mark_region(rh->log, reg->key);

spin_lock_irq(&rh->region_lock);
reg->state = RH_DIRTY;
list_del_init(&reg->list); /* take off the clean list */
spin_unlock_irq(&rh->region_lock);
}
spin_unlock_irq(&rh->region_lock);

atomic_inc(&reg->pending);
read_unlock(&rh->hash_lock);
}

Expand All @@ -408,6 +410,10 @@ static void rh_dec(struct region_hash *rh, region_t region)

if (atomic_dec_and_test(&reg->pending)) {
spin_lock_irqsave(&rh->region_lock, flags);
if (atomic_read(&reg->pending)) { /* check race */
spin_unlock_irqrestore(&rh->region_lock, flags);
return;
}
if (reg->state == RH_RECOVERING) {
list_add_tail(&reg->list, &rh->quiesced_regions);
} else {
Expand Down

0 comments on commit cff6b98

Please sign in to comment.