Skip to content

Commit

Permalink
dm era: save spacemap metadata root after the pre-commit
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Somasundaram Krishnasamy authored and Mike Snitzer committed Apr 24, 2017
1 parent 948f581 commit 117aceb
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions drivers/md/dm-era-target.c
Original file line number Diff line number Diff line change
Expand Up @@ -961,15 +961,15 @@ static int metadata_commit(struct era_metadata *md)
}
}

r = save_sm_root(md);
r = dm_tm_pre_commit(md->tm);
if (r) {
DMERR("%s: save_sm_root failed", __func__);
DMERR("%s: pre commit failed", __func__);
return r;
}

r = dm_tm_pre_commit(md->tm);
r = save_sm_root(md);
if (r) {
DMERR("%s: pre commit failed", __func__);
DMERR("%s: save_sm_root failed", __func__);
return r;
}

Expand Down

0 comments on commit 117aceb

Please sign in to comment.