The patch titled dm snapshot: fix freeing pending exception has been added to the -mm tree. Its filename is dm-snapshot-fix-freeing-pending-exception.patch See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find out what to do about this ------------------------------------------------------ Subject: dm snapshot: fix freeing pending exception From: Alasdair G Kergon <agk@xxxxxxxxxx> If a snapshot became invalid while there are outstanding pending_exceptions, when pending_complete() processes each one it forgets to remove the corresponding exception from its exception table before freeing it. Fix this by moving the 'out:' label up one statement so that remove_exception() is always called. Then __invalidate_exception() no longer needs to call it and its 'pe' argument become superfluous. Signed-off-by: Alasdair G Kergon <agk@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxx> --- drivers/md/dm-snap.c | 16 ++++++---------- 1 files changed, 6 insertions(+), 10 deletions(-) diff -puN drivers/md/dm-snap.c~dm-snapshot-fix-freeing-pending-exception drivers/md/dm-snap.c --- a/drivers/md/dm-snap.c~dm-snapshot-fix-freeing-pending-exception +++ a/drivers/md/dm-snap.c @@ -631,8 +631,7 @@ static void error_bios(struct bio *bio) } } -static void __invalidate_snapshot(struct dm_snapshot *s, - struct pending_exception *pe, int err) +static void __invalidate_snapshot(struct dm_snapshot *s, int err) { if (!s->valid) return; @@ -642,9 +641,6 @@ static void __invalidate_snapshot(struct else if (err == -ENOMEM) DMERR("Invalidating snapshot: Unable to allocate exception."); - if (pe) - remove_exception(&pe->e); - if (s->store.drop_snapshot) s->store.drop_snapshot(&s->store); @@ -701,7 +697,7 @@ static void pending_complete(struct pend if (!success) { /* Read/write error - snapshot is unusable */ down_write(&s->lock); - __invalidate_snapshot(s, pe, -EIO); + __invalidate_snapshot(s, -EIO); error = 1; goto out; } @@ -709,7 +705,7 @@ static void pending_complete(struct pend e = alloc_exception(); if (!e) { down_write(&s->lock); - __invalidate_snapshot(s, pe, -ENOMEM); + __invalidate_snapshot(s, -ENOMEM); error = 1; goto out; } @@ -727,9 +723,9 @@ static void pending_complete(struct pend * in-flight exception from the list. */ insert_exception(&s->complete, e); - remove_exception(&pe->e); out: + remove_exception(&pe->e); snapshot_bios = bio_list_get(&pe->snapshot_bios); origin_bios = put_pending_exception(pe); @@ -909,7 +905,7 @@ static int snapshot_map(struct dm_target if (bio_rw(bio) == WRITE) { pe = __find_pending_exception(s, bio); if (!pe) { - __invalidate_snapshot(s, pe, -ENOMEM); + __invalidate_snapshot(s, -ENOMEM); r = -EIO; goto out_unlock; } @@ -1035,7 +1031,7 @@ static int __origin_write(struct list_he pe = __find_pending_exception(snap, bio); if (!pe) { - __invalidate_snapshot(snap, pe, -ENOMEM); + __invalidate_snapshot(snap, -ENOMEM); goto next_snapshot; } _ Patches currently in -mm which might be from agk@xxxxxxxxxx are dm-support-ioctls-on-mapped-devices.patch dm-linear-support-ioctls.patch dm-mpath-support-ioctls.patch dm-export-blkdev_driver_ioctl.patch dm-support-ioctls-on-mapped-devices-fix-with-fake-file.patch dm-fix-alloc_dev-error-path.patch dm-snapshot-fix-invalidation-enomem.patch dm-snapshot-allow-zero-chunk_size.patch dm-snapshot-fix-metadata-error-handling.patch dm-snapshot-make-read-and-write-exception-functions-void.patch dm-snapshot-fix-metadata-writing-when-suspending.patch dm-snapshot-tidy-snapshot_map.patch dm-snapshot-tidy-pending_complete.patch dm-snapshot-add-workqueue.patch dm-snapshot-tidy-pe-ref-counting.patch dm-snapshot-fix-freeing-pending-exception.patch dm-mirror-remove-trailing-space-from-table.patch dm-mpath-tidy-ctr.patch dm-mpath-use-kzalloc.patch dm-add-uevent-change-event-on-resume.patch dm-add-debug-macro.patch dm-table-add-target-preresume.patch dm-crypt-add-key-msg.patch dm-crypt-restructure-for-workqueue-change.patch dm-crypt-restructure-write-processing.patch dm-crypt-move-io-to-workqueue.patch dm-crypt-use-private-biosets.patch dm-use-private-biosets.patch dm-extract-device-limit-setting.patch dm-table-add-target-flush.patch md-dm-reduce-stack-usage-with-stacked-block-devices.patch - To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html