diff options
author | Joe Thornber <ejt@redhat.com> | 2014-11-27 12:26:46 +0000 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-01-08 10:00:48 -0800 |
commit | 4623687667875ce12fbce95b8f6ec89494e2fb52 (patch) | |
tree | 8c6e4f2b3ca9bcbe5cc2129fedd9267184fdce9b /drivers/md | |
parent | 624f917e5a7123e794486df12ed779f50b0e2706 (diff) | |
download | lwn-4623687667875ce12fbce95b8f6ec89494e2fb52.tar.gz lwn-4623687667875ce12fbce95b8f6ec89494e2fb52.zip |
dm cache: dirty flag was mistakenly being cleared when promoting via overwrite
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>
Diffstat (limited to 'drivers/md')
-rw-r--r-- | drivers/md/dm-cache-target.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/drivers/md/dm-cache-target.c b/drivers/md/dm-cache-target.c index 3e573a7bbf10..ff284b7a17bd 100644 --- a/drivers/md/dm-cache-target.c +++ b/drivers/md/dm-cache-target.c @@ -946,10 +946,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); } |