Commit 734a3fb29c45f76185006575332c34f4242ce94f
Committed by
Greg Kroah-Hartman
1 parent
7a9cdc4c90
dm cache: fix spurious cell_defer when dealing with partial block at end of device
commit f824a2af3dfbbb766c02e19df21f985bceadf0ee upstream. We never bother caching a partial block that is at the back end of the origin device. No cell ever gets locked, but the calling code was assuming it was and trying to release it. Now the code only releases if the cell has been set to a non NULL value. Signed-off-by: Joe Thornber <ejt@redhat.com> Signed-off-by: Mike Snitzer <snitzer@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Showing 1 changed file with 2 additions and 2 deletions Side-by-side Diff
drivers/md/dm-cache-target.c
... | ... | @@ -2554,11 +2554,11 @@ |
2554 | 2554 | static int cache_map(struct dm_target *ti, struct bio *bio) |
2555 | 2555 | { |
2556 | 2556 | int r; |
2557 | - struct dm_bio_prison_cell *cell; | |
2557 | + struct dm_bio_prison_cell *cell = NULL; | |
2558 | 2558 | struct cache *cache = ti->private; |
2559 | 2559 | |
2560 | 2560 | r = __cache_map(cache, bio, &cell); |
2561 | - if (r == DM_MAPIO_REMAPPED) { | |
2561 | + if (r == DM_MAPIO_REMAPPED && cell) { | |
2562 | 2562 | inc_ds(cache, bio, cell); |
2563 | 2563 | cell_defer(cache, cell, false); |
2564 | 2564 | } |