Skip to content

Commit 3eb6f26

Browse files
committed
dm cache: set needs_check flag after aborting metadata
Bugzilla: https://bugzilla.redhat.com/2162536 Upstream Status: kernel/git/torvalds/linux.git commit 6b99738 Author: Mike Snitzer <snitzer@kernel.org> Date: Wed Nov 30 14:02:47 2022 -0500 dm cache: set needs_check flag after aborting metadata Otherwise the commit that will be aborted will be associated with the metadata objects that will be torn down. Must write needs_check flag to metadata with a reset block manager. Found through code-inspection (and compared against dm-thin.c). Cc: stable@vger.kernel.org Fixes: 028ae9f ("dm cache: add fail io mode and needs_check flag") Signed-off-by: Mike Snitzer <snitzer@kernel.org> Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
1 parent 0bc85bd commit 3eb6f26

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

drivers/md/dm-cache-target.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -907,16 +907,16 @@ static void abort_transaction(struct cache *cache)
907907
if (get_cache_mode(cache) >= CM_READ_ONLY)
908908
return;
909909

910-
if (dm_cache_metadata_set_needs_check(cache->cmd)) {
911-
DMERR("%s: failed to set 'needs_check' flag in metadata", dev_name);
912-
set_cache_mode(cache, CM_FAIL);
913-
}
914-
915910
DMERR_LIMIT("%s: aborting current metadata transaction", dev_name);
916911
if (dm_cache_metadata_abort(cache->cmd)) {
917912
DMERR("%s: failed to abort metadata transaction", dev_name);
918913
set_cache_mode(cache, CM_FAIL);
919914
}
915+
916+
if (dm_cache_metadata_set_needs_check(cache->cmd)) {
917+
DMERR("%s: failed to set 'needs_check' flag in metadata", dev_name);
918+
set_cache_mode(cache, CM_FAIL);
919+
}
920920
}
921921

922922
static void metadata_operation_failed(struct cache *cache, const char *op, int r)

0 commit comments

Comments
 (0)