aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/md')
-rw-r--r--drivers/md/dm-snap.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/drivers/md/dm-snap.c b/drivers/md/dm-snap.c
index 6e5528aecc98..4ed9b7aaadbc 100644
--- a/drivers/md/dm-snap.c
+++ b/drivers/md/dm-snap.c
@@ -824,8 +824,10 @@ static struct bio *put_pending_exception(struct dm_snap_pending_exception *pe)
824 * the bios for the original write to the origin. 824 * the bios for the original write to the origin.
825 */ 825 */
826 if (primary_pe && 826 if (primary_pe &&
827 atomic_dec_and_test(&primary_pe->ref_count)) 827 atomic_dec_and_test(&primary_pe->ref_count)) {
828 origin_bios = bio_list_get(&primary_pe->origin_bios); 828 origin_bios = bio_list_get(&primary_pe->origin_bios);
829 free_pending_exception(primary_pe);
830 }
829 831
830 /* 832 /*
831 * Free the pe if it's not linked to an origin write or if 833 * Free the pe if it's not linked to an origin write or if
@@ -834,12 +836,6 @@ static struct bio *put_pending_exception(struct dm_snap_pending_exception *pe)
834 if (!primary_pe || primary_pe != pe) 836 if (!primary_pe || primary_pe != pe)
835 free_pending_exception(pe); 837 free_pending_exception(pe);
836 838
837 /*
838 * Free the primary pe if nothing references it.
839 */
840 if (primary_pe && !atomic_read(&primary_pe->ref_count))
841 free_pending_exception(primary_pe);
842
843 return origin_bios; 839 return origin_bios;
844} 840}
845 841