aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSomasundaram Krishnasamy <somasundaram.krishnasamy@oracle.com>2017-04-07 15:14:55 -0400
committerMike Snitzer <snitzer@redhat.com>2017-04-24 15:02:14 -0400
commit117aceb030307dcd431fdcff87ce988d3016c34a (patch)
tree6ee850484a06b5d14f63617a2a6126cd3f4cac11
parent948f581a53b704b984aa20df009f0a2b4cf7f907 (diff)
dm era: save spacemap metadata root after the pre-commit
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. Cc: stable@vger.kernel.org Signed-off-by: Somasundaram Krishnasamy <somasundaram.krishnasamy@oracle.com> Signed-off-by: Mike Snitzer <snitzer@redhat.com>
-rw-r--r--drivers/md/dm-era-target.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/md/dm-era-target.c b/drivers/md/dm-era-target.c
index 9fab33b113c4..68d4084377ad 100644
--- a/drivers/md/dm-era-target.c
+++ b/drivers/md/dm-era-target.c
@@ -961,15 +961,15 @@ static int metadata_commit(struct era_metadata *md)
961 } 961 }
962 } 962 }
963 963
964 r = save_sm_root(md); 964 r = dm_tm_pre_commit(md->tm);
965 if (r) { 965 if (r) {
966 DMERR("%s: save_sm_root failed", __func__); 966 DMERR("%s: pre commit failed", __func__);
967 return r; 967 return r;
968 } 968 }
969 969
970 r = dm_tm_pre_commit(md->tm); 970 r = save_sm_root(md);
971 if (r) { 971 if (r) {
972 DMERR("%s: pre commit failed", __func__); 972 DMERR("%s: save_sm_root failed", __func__);
973 return r; 973 return r;
974 } 974 }
975 975