[dm-devel] Calltrace in dm-snapshot in 2.6.27 kernel
Mikulas Patocka
mpatocka at redhat.com
Wed Oct 22 15:45:07 UTC 2008
On Wed, 22 Oct 2008, aluno3 at poczta.onet.pl wrote:
> Hi
>
> I used your patch and I ran test the same workload. After a few hours
> test, everything is OK. Is it possible? Test is still running.When I get
> something wrong from kernel I write to You again.
Hi
That's good that it works. So try this. Keep the first patch (it is this
one ---
http://people.redhat.com/mpatocka/patches/kernel/2.6.27/dm-snapshot-fix-primary-pe-race.patch
--- I think Milan already sent it to you and you have it applied). Undo
the second patch (that one that hides deallocation with /* */ ). And apply
this. Run the same test.
Mikulas
---
drivers/md/dm-snap.c | 10 +++++++++-
drivers/md/dm-snap.h | 2 ++
2 files changed, 11 insertions(+), 1 deletion(-)
Index: linux-2.6.27-clean/drivers/md/dm-snap.c
===================================================================
--- linux-2.6.27-clean.orig/drivers/md/dm-snap.c 2008-10-22 15:41:24.000000000 +0200
+++ linux-2.6.27-clean/drivers/md/dm-snap.c 2008-10-22 15:51:33.000000000 +0200
@@ -368,6 +368,7 @@ static struct dm_snap_pending_exception
struct dm_snap_pending_exception *pe = mempool_alloc(s->pending_pool,
GFP_NOIO);
+ atomic_inc(&s->n_pending_exceptions);
pe->snap = s;
return pe;
@@ -375,7 +376,10 @@ static struct dm_snap_pending_exception
static void free_pending_exception(struct dm_snap_pending_exception *pe)
{
- mempool_free(pe, pe->snap->pending_pool);
+ struct struct dm_snapshot *s = pe->snap;
+ mempool_free(pe, s->pending_pool);
+ smp_mb__before_atomic_dec();
+ atomic_dec(&s->n_pending_exceptions);
}
static void insert_completed_exception(struct dm_snapshot *s,
@@ -601,6 +605,7 @@ static int snapshot_ctr(struct dm_target
s->valid = 1;
s->active = 0;
s->last_percent = 0;
+ atomic_set(&s->n_pending_exceptions, 0);
init_rwsem(&s->lock);
spin_lock_init(&s->pe_lock);
s->ti = ti;
@@ -727,6 +732,9 @@ static void snapshot_dtr(struct dm_targe
/* After this returns there can be no new kcopyd jobs. */
unregister_snapshot(s);
+ while (atomic_read(&s->n_pending_exceptions))
+ yield();
+
#ifdef CONFIG_DM_DEBUG
for (i = 0; i < DM_TRACKED_CHUNK_HASH_SIZE; i++)
BUG_ON(!hlist_empty(&s->tracked_chunk_hash[i]));
Index: linux-2.6.27-clean/drivers/md/dm-snap.h
===================================================================
--- linux-2.6.27-clean.orig/drivers/md/dm-snap.h 2008-10-22 15:45:08.000000000 +0200
+++ linux-2.6.27-clean/drivers/md/dm-snap.h 2008-10-22 15:46:49.000000000 +0200
@@ -163,6 +163,8 @@ struct dm_snapshot {
mempool_t *pending_pool;
+ atomic_t n_pending_exceptions;
+
struct exception_table pending;
struct exception_table complete;
More information about the dm-devel
mailing list