Pārlūkot izejas kodu

[LogFS] Erase new journal segments

If the device contains on old logfs image and the journal is moved to
segment that have never been used by the current logfs and not all
journal segments are erased before the next mount, the old content can
confuse mount code.  To prevent this, always erase the new journal
segments.

Signed-off-by: Joern Engel <joern@logfs.org>
Joern Engel 15 gadi atpakaļ
vecāks
revīzija
6be7fa06eb
1 mainītis faili ar 2 papildinājumiem un 0 dzēšanām
  1. 2 0
      fs/logfs/journal.c

+ 2 - 0
fs/logfs/journal.c

@@ -823,6 +823,8 @@ void do_logfs_journal_wl_pass(struct super_block *sb)
 		logfs_set_segment_reserved(sb, segno);
 		err = btree_insert32(head, segno, (void *)1, GFP_KERNEL);
 		BUG_ON(err); /* mempool should prevent this */
+		err = logfs_erase_segment(sb, segno, 1);
+		BUG_ON(err); /* FIXME: remount-ro would be nicer */
 	}
 	/* Manually move journal_area */
 	freeseg(sb, area->a_segno);