diff options
author | Joern Engel <joern@logfs.org> | 2010-04-13 11:46:37 -0400 |
---|---|---|
committer | Joern Engel <joern@logfs.org> | 2010-04-13 11:46:37 -0400 |
commit | 032d8f7268444a0f5d4ee02d9513d682d5b8edfc (patch) | |
tree | 57cd841514abb9ffe7df7d2569513663f551f960 /fs/logfs/gc.c | |
parent | e05c378f4973674a16d5b9636f2310cf88aca5f2 (diff) |
[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>
Diffstat (limited to 'fs/logfs/gc.c')
-rw-r--r-- | fs/logfs/gc.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/fs/logfs/gc.c b/fs/logfs/gc.c index 92949f95a901..e8253e7fb6b2 100644 --- a/fs/logfs/gc.c +++ b/fs/logfs/gc.c | |||
@@ -458,6 +458,14 @@ static void __logfs_gc_pass(struct super_block *sb, int target) | |||
458 | struct logfs_block *block; | 458 | struct logfs_block *block; |
459 | int round, progress, last_progress = 0; | 459 | int round, progress, last_progress = 0; |
460 | 460 | ||
461 | /* | ||
462 | * Doing too many changes to the segfile at once would result | ||
463 | * in a large number of aliases. Write the journal before | ||
464 | * things get out of hand. | ||
465 | */ | ||
466 | if (super->s_shadow_tree.no_shadowed_segments >= MAX_OBJ_ALIASES) | ||
467 | logfs_write_anchor(sb); | ||
468 | |||
461 | if (no_free_segments(sb) >= target && | 469 | if (no_free_segments(sb) >= target && |
462 | super->s_no_object_aliases < MAX_OBJ_ALIASES) | 470 | super->s_no_object_aliases < MAX_OBJ_ALIASES) |
463 | return; | 471 | return; |