diff options
author | Artem Bityutskiy <Artem.Bityutskiy@nokia.com> | 2010-08-07 01:44:13 -0400 |
---|---|---|
committer | Artem Bityutskiy <Artem.Bityutskiy@nokia.com> | 2010-08-30 03:19:07 -0400 |
commit | 44ec83b8bd05d323998031f141c310127721acae (patch) | |
tree | 52b336c14de78845189d39c952447c1c208b6fd6 /fs/ubifs/gc.c | |
parent | e3408ad4cbed6ec6990efad4c2ef0856bcd3c712 (diff) |
UBIFS: do not look up truncation nodes
When moving nodes in GC, do not try to look up truncation nodes in TNC,
because they do not exist there. This would be harmless, because the TNC
look-up would fail, if we did not have bug 'ubifs_add_snod()' which reads
garbage into 'snod->key'. But in any case, it is less error prone to
explicitly ignore everything but inode, data, dentry and xentry nodes.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'fs/ubifs/gc.c')
-rw-r--r-- | fs/ubifs/gc.c | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/fs/ubifs/gc.c b/fs/ubifs/gc.c index 98b2c3c8725a..9dbbc5c88940 100644 --- a/fs/ubifs/gc.c +++ b/fs/ubifs/gc.c | |||
@@ -233,9 +233,26 @@ static int sort_nodes(struct ubifs_info *c, struct ubifs_scan_leb *sleb, | |||
233 | list_for_each_entry_safe(snod, tmp, &sleb->nodes, list) { | 233 | list_for_each_entry_safe(snod, tmp, &sleb->nodes, list) { |
234 | int err; | 234 | int err; |
235 | 235 | ||
236 | ubifs_assert(snod->type != UBIFS_IDX_NODE); | 236 | ubifs_assert(snod->type == UBIFS_INO_NODE || |
237 | ubifs_assert(snod->type != UBIFS_REF_NODE); | 237 | snod->type == UBIFS_DATA_NODE || |
238 | ubifs_assert(snod->type != UBIFS_CS_NODE); | 238 | snod->type == UBIFS_DENT_NODE || |
239 | snod->type == UBIFS_XENT_NODE || | ||
240 | snod->type == UBIFS_TRUN_NODE); | ||
241 | |||
242 | if (snod->type != UBIFS_INO_NODE && | ||
243 | snod->type != UBIFS_DATA_NODE && | ||
244 | snod->type != UBIFS_DENT_NODE && | ||
245 | snod->type != UBIFS_XENT_NODE) { | ||
246 | /* Probably truncation node, zap it */ | ||
247 | list_del(&snod->list); | ||
248 | kfree(snod); | ||
249 | continue; | ||
250 | } | ||
251 | |||
252 | ubifs_assert(key_type(c, &snod->key) == UBIFS_DATA_KEY || | ||
253 | key_type(c, &snod->key) == UBIFS_INO_KEY || | ||
254 | key_type(c, &snod->key) == UBIFS_DENT_KEY || | ||
255 | key_type(c, &snod->key) == UBIFS_XENT_KEY); | ||
239 | 256 | ||
240 | err = ubifs_tnc_has_node(c, &snod->key, 0, sleb->lnum, | 257 | err = ubifs_tnc_has_node(c, &snod->key, 0, sleb->lnum, |
241 | snod->offs, 0); | 258 | snod->offs, 0); |