Skip to contentSkip to conversation

dm-integrity: Always set version on superblock update

PATCH New Milan Broz 1 participant 1 message May 22, 2019 Device mapper

lore
Share & tools
lore

Milan Broz

author
#0 lore raw

PATCH 1/1 dm-integrity: Always set version on superblock update

New integtiry bitmap mode uses the dirty flag. This flag should not be set in older superblock versions.

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

This patch moves version check to one common place and does check version on every superblock write.

---
 drivers/md/dm-integrity.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/md/dm-integrity.c +3 -1
index 44e76cda087a..a2ab6a32b174 100644
@@ -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.count = SB_SECTORS;
 
+	if (op == REQ_OP_WRITE)
+		sb_set_version(ic);
+
 	return dm_io(&io_req, 1, &io_loc, NULL);
 }
 
@@ -2317,7 +2320,6 @@ static void recalc_write_super(struct dm_integrity_c *ic)
 	if (dm_integrity_failed(ic))
 		return;
 
-	sb_set_version(ic);
 	r = sync_rw_sb(ic, REQ_OP_WRITE, 0);
 	if (unlikely(r))
 		dm_integrity_io_error(ic, "writing superblock", r);
Signature · 1 line
2.20.1