Skip to content

Commit 341adf5

Browse files
Somasundaram Krishnasamygregkh
authored andcommitted
dm era: save spacemap metadata root after the pre-commit
commit 117aceb030307dcd431fdcff87ce988d3016c34a upstream. When committing era metadata to disk, it doesn't always save the latest spacemap metadata root in superblock. Due to this, metadata is getting corrupted sometimes when reopening the device. The correct order of update should be, pre-commit (shadows spacemap root), save the spacemap root (newly shadowed block) to in-core superblock and then the final commit. Signed-off-by: Somasundaram Krishnasamy <somasundaram.krishnasamy@oracle.com> Signed-off-by: Mike Snitzer <snitzer@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent dcd4004 commit 341adf5

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

drivers/md/dm-era-target.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -961,15 +961,15 @@ static int metadata_commit(struct era_metadata *md)
961961
}
962962
}
963963

964-
r = save_sm_root(md);
964+
r = dm_tm_pre_commit(md->tm);
965965
if (r) {
966-
DMERR("%s: save_sm_root failed", __func__);
966+
DMERR("%s: pre commit failed", __func__);
967967
return r;
968968
}
969969

970-
r = dm_tm_pre_commit(md->tm);
970+
r = save_sm_root(md);
971971
if (r) {
972-
DMERR("%s: pre commit failed", __func__);
972+
DMERR("%s: save_sm_root failed", __func__);
973973
return r;
974974
}
975975

0 commit comments

Comments
 (0)