Commit e7731529 authored by Joe Thornber's avatar Joe Thornber Committed by Luis Henriques

dm cache: dirty flag was mistakenly being cleared when promoting via overwrite

commit 1e32134a upstream.

If the incoming bio is a WRITE and completely covers a block then we
don't bother to do any copying for a promotion operation.  Once this is
done the cache block and origin block will be different, so we need to
set it to 'dirty'.
Signed-off-by: default avatarJoe Thornber <ejt@redhat.com>
Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
Signed-off-by: default avatarLuis Henriques <luis.henriques@canonical.com>
parent 23c115eb
...@@ -929,10 +929,14 @@ static void migration_success_post_commit(struct dm_cache_migration *mg) ...@@ -929,10 +929,14 @@ static void migration_success_post_commit(struct dm_cache_migration *mg)
} }
} else { } else {
if (mg->requeue_holder) {
clear_dirty(cache, mg->new_oblock, mg->cblock); clear_dirty(cache, mg->new_oblock, mg->cblock);
if (mg->requeue_holder)
cell_defer(cache, mg->new_ocell, true); cell_defer(cache, mg->new_ocell, true);
else { } else {
/*
* The block was promoted via an overwrite, so it's dirty.
*/
set_dirty(cache, mg->new_oblock, mg->cblock);
bio_endio(mg->new_ocell->holder, 0); bio_endio(mg->new_ocell->holder, 0);
cell_defer(cache, mg->new_ocell, false); cell_defer(cache, mg->new_ocell, false);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment