From: Alasdair G Kergon Avoid references to 'pe->primary_pe' after freeing 'pe'. Signed-off-by: Alasdair G Kergon Signed-off-by: Andrew Morton --- drivers/md/dm-snap.c | 9 ++++++--- 1 files changed, 6 insertions(+), 3 deletions(-) diff -puN drivers/md/dm-snap.c~device-mapper-snapshot-replace-sibling-list-fix drivers/md/dm-snap.c --- devel/drivers/md/dm-snap.c~device-mapper-snapshot-replace-sibling-list-fix 2006-03-12 16:46:20.000000000 -0800 +++ devel-akpm/drivers/md/dm-snap.c 2006-03-12 16:53:08.000000000 -0800 @@ -619,6 +619,7 @@ static struct bio *__flush_bios(struct p static void pending_complete(struct pending_exception *pe, int success) { struct exception *e; + struct pending_exception *primary_pe; struct dm_snapshot *s = pe->snap; struct bio *flush = NULL; @@ -667,18 +668,20 @@ static void pending_complete(struct pend } out: + primary_pe = pe->primary_pe; + /* * Free the pe if it's not linked to an origin write or if * it's not itself a primary pe. */ - if (!pe->primary_pe || pe->primary_pe != pe) + if (!primary_pe || primary_pe != pe) free_pending_exception(pe); /* * Free the primary pe if nothing references it. */ - if (pe->primary_pe && !atomic_read(&pe->primary_pe->sibling_count)) - free_pending_exception(pe->primary_pe); + if (primary_pe && !atomic_read(&primary_pe->sibling_count)) + free_pending_exception(primary_pe); if (flush) flush_bios(flush); _