]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
dm cache: dirty flag was mistakenly being cleared when promoting via overwrite
authorJoe Thornber <ejt@redhat.com>
Thu, 27 Nov 2014 12:26:46 +0000 (12:26 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 8 Jan 2015 18:27:46 +0000 (10:27 -0800)
commit 1e32134a5a404e80bfb47fad8a94e9bbfcbdacc5 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: Joe Thornber <ejt@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/md/dm-cache-target.c

index 6f7086355691febd147a8850cea8e5f3fb5ab36d..387b93d81138d4da4a7acead58f72582ca9a7e03 100644 (file)
@@ -951,10 +951,14 @@ static void migration_success_post_commit(struct dm_cache_migration *mg)
                }
 
        } else {
-               clear_dirty(cache, mg->new_oblock, mg->cblock);
-               if (mg->requeue_holder)
+               if (mg->requeue_holder) {
+                       clear_dirty(cache, mg->new_oblock, mg->cblock);
                        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);
                        cell_defer(cache, mg->new_ocell, false);
                }