Explorar o código

dm cache: only use overwrite optimisation for promotion when in writeback mode

Overwrite causes the cache block and origin blocks to diverge, which
is only allowed in writeback mode.

Signed-off-by: Joe Thornber <ejt@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Cc: stable@vger.kernel.org
Joe Thornber %!s(int64=11) %!d(string=hai) anos
pai
achega
f29a3147e2
Modificáronse 1 ficheiros con 2 adicións e 1 borrados
  1. 2 1
      drivers/md/dm-cache-target.c

+ 2 - 1
drivers/md/dm-cache-target.c

@@ -1142,7 +1142,8 @@ static void issue_copy_or_discard(struct dm_cache_migration *mg)
 
 
 		avoid = is_discarded_oblock(cache, mg->new_oblock);
 		avoid = is_discarded_oblock(cache, mg->new_oblock);
 
 
-		if (!avoid && bio_writes_complete_block(cache, bio)) {
+		if (writeback_mode(&cache->features) &&
+		    !avoid && bio_writes_complete_block(cache, bio)) {
 			issue_overwrite(mg, bio);
 			issue_overwrite(mg, bio);
 			return;
 			return;
 		}
 		}