dm era: save spacemap metadata root after the pre-commit
authorSomasundaram Krishnasamy <somasundaram.krishnasamy@oracle.com>
Fri, 7 Apr 2017 19:14:55 +0000 (12:14 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 20 May 2017 12:27:00 +0000 (14:27 +0200)
commit341adf516842236bc60bbd3f8c79f0e1f2ed97c0
treeb0e575b239fc13b76fc95ca50f000d0fd6ac10c6
parentdcd4004ae5212746b9fb7e5d8493589f224a5324
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>
drivers/md/dm-era-target.c