Commit 5f1c56b3 authored by Milan Broz's avatar Milan Broz Committed by Mike Snitzer

dm integrity: always set version on superblock update

The new integrity bitmap mode uses the dirty flag.  The dirty flag
should not be set in older superblock versions.

The current code sets it unconditionally, even if the superblock
was already formatted without bitmap in older system.

Fix this by moving the version check to one common place and check
version on every superblock write.
Signed-off-by: default avatarMilan Broz <gmazyland@gmail.com>
Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
parent 54fa16ee
...@@ -476,6 +476,9 @@ static int sync_rw_sb(struct dm_integrity_c *ic, int op, int op_flags) ...@@ -476,6 +476,9 @@ static int sync_rw_sb(struct dm_integrity_c *ic, int op, int op_flags)
io_loc.sector = ic->start; io_loc.sector = ic->start;
io_loc.count = SB_SECTORS; io_loc.count = SB_SECTORS;
if (op == REQ_OP_WRITE)
sb_set_version(ic);
return dm_io(&io_req, 1, &io_loc, NULL); return dm_io(&io_req, 1, &io_loc, NULL);
} }
...@@ -2317,7 +2320,6 @@ static void recalc_write_super(struct dm_integrity_c *ic) ...@@ -2317,7 +2320,6 @@ static void recalc_write_super(struct dm_integrity_c *ic)
if (dm_integrity_failed(ic)) if (dm_integrity_failed(ic))
return; return;
sb_set_version(ic);
r = sync_rw_sb(ic, REQ_OP_WRITE, 0); r = sync_rw_sb(ic, REQ_OP_WRITE, 0);
if (unlikely(r)) if (unlikely(r))
dm_integrity_io_error(ic, "writing superblock", r); dm_integrity_io_error(ic, "writing superblock", r);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment