Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 104294
b: refs/heads/master
c: a8d41b5
h: refs/heads/master
v: v3
  • Loading branch information
Mikulas Patocka authored and Alasdair G Kergon committed Jul 21, 2008
1 parent b79ac2c commit 7f4078f
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: cd45daffd1f7b53aac0835b23e97f814ec3f10dc
refs/heads/master: a8d41b59f3f5a7ac19452ef442a7fc1b5fa17366
28 changes: 28 additions & 0 deletions trunk/drivers/md/dm-snap.c
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,27 @@ static void stop_tracking_chunk(struct dm_snapshot *s,
mempool_free(c, s->tracked_chunk_pool);
}

static int __chunk_is_tracked(struct dm_snapshot *s, chunk_t chunk)
{
struct dm_snap_tracked_chunk *c;
struct hlist_node *hn;
int found = 0;

spin_lock_irq(&s->tracked_chunk_lock);

hlist_for_each_entry(c, hn,
&s->tracked_chunk_hash[DM_TRACKED_CHUNK_HASH(chunk)], node) {
if (c->chunk == chunk) {
found = 1;
break;
}
}

spin_unlock_irq(&s->tracked_chunk_lock);

return found;
}

/*
* One of these per registered origin, held in the snapshot_origins hash
*/
Expand Down Expand Up @@ -839,6 +860,13 @@ static void pending_complete(struct dm_snap_pending_exception *pe, int success)
goto out;
}

/*
* Check for conflicting reads. This is extremely improbable,
* so yield() is sufficient and there is no need for a wait queue.
*/
while (__chunk_is_tracked(s, pe->e.old_chunk))
yield();

/*
* Add a proper exception, and remove the
* in-flight exception from the list.
Expand Down

0 comments on commit 7f4078f

Please sign in to comment.