[LogFS] Prevent memory corruption on large deletes
Removing sufficiently large files would create aliases for a large number of segments. This in turn results in a large number of journal entries and an overflow of s_je_array. Cheap fix is to add a BUG_ON, turning memory corruption into something annoying, but less dangerous. Real fix is to count the number of affected segments and prevent the problem completely. Signed-off-by: Joern Engel <joern@logfs.org>
This commit is contained in:
@@ -493,6 +493,8 @@ static void account_shadows(struct super_block *sb)
|
||||
|
||||
btree_grim_visitor64(&tree->new, (unsigned long)sb, account_shadow);
|
||||
btree_grim_visitor64(&tree->old, (unsigned long)sb, account_shadow);
|
||||
btree_grim_visitor32(&tree->segment_map, 0, NULL);
|
||||
tree->no_shadowed_segments = 0;
|
||||
|
||||
if (li->li_block) {
|
||||
/*
|
||||
@@ -660,6 +662,7 @@ static int logfs_write_je_buf(struct super_block *sb, void *buf, u16 type,
|
||||
if (ofs < 0)
|
||||
return ofs;
|
||||
logfs_buf_write(area, ofs, super->s_compressed_je, len);
|
||||
BUG_ON(super->s_no_je >= MAX_JOURNAL_ENTRIES);
|
||||
super->s_je_array[super->s_no_je++] = cpu_to_be64(ofs);
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user