tnc.c (26fe575028703948880fce4355a210c76bb0536e) | tnc.c (7c46d0ae29ba880963db283706950de7aa86c0a0) |
---|---|
1/* 2 * This file is part of UBIFS. 3 * 4 * Copyright (C) 2006-2008 Nokia Corporation. 5 * 6 * This program is free software; you can redistribute it and/or modify it 7 * under the terms of the GNU General Public License version 2 as published by 8 * the Free Software Foundation. --- 325 unchanged lines hidden (view full) --- 334 const struct ubifs_dent_node *dent = node; 335 336 ubifs_assert(!zbr->leaf); 337 ubifs_assert(zbr->len != 0); 338 ubifs_assert(is_hash_key(c, &zbr->key)); 339 340 err = ubifs_validate_entry(c, dent); 341 if (err) { | 1/* 2 * This file is part of UBIFS. 3 * 4 * Copyright (C) 2006-2008 Nokia Corporation. 5 * 6 * This program is free software; you can redistribute it and/or modify it 7 * under the terms of the GNU General Public License version 2 as published by 8 * the Free Software Foundation. --- 325 unchanged lines hidden (view full) --- 334 const struct ubifs_dent_node *dent = node; 335 336 ubifs_assert(!zbr->leaf); 337 ubifs_assert(zbr->len != 0); 338 ubifs_assert(is_hash_key(c, &zbr->key)); 339 340 err = ubifs_validate_entry(c, dent); 341 if (err) { |
342 dbg_dump_stack(); | 342 dump_stack(); |
343 dbg_dump_node(c, dent); 344 return err; 345 } 346 347 lnc_node = kmemdup(node, zbr->len, GFP_NOFS); 348 if (!lnc_node) 349 /* We don't have to have the cache, so no error */ 350 return 0; --- 16 unchanged lines hidden (view full) --- 367{ 368 int err; 369 370 ubifs_assert(!zbr->leaf); 371 ubifs_assert(zbr->len != 0); 372 373 err = ubifs_validate_entry(c, node); 374 if (err) { | 343 dbg_dump_node(c, dent); 344 return err; 345 } 346 347 lnc_node = kmemdup(node, zbr->len, GFP_NOFS); 348 if (!lnc_node) 349 /* We don't have to have the cache, so no error */ 350 return 0; --- 16 unchanged lines hidden (view full) --- 367{ 368 int err; 369 370 ubifs_assert(!zbr->leaf); 371 ubifs_assert(zbr->len != 0); 372 373 err = ubifs_validate_entry(c, node); 374 if (err) { |
375 dbg_dump_stack(); | 375 dump_stack(); |
376 dbg_dump_node(c, node); 377 return err; 378 } 379 380 zbr->leaf = node; 381 return 0; 382} 383 --- 1345 unchanged lines hidden (view full) --- 1729 1730 return 0; 1731 1732out_err: 1733 err = -EINVAL; 1734out: 1735 ubifs_err("bad node at LEB %d:%d", zbr->lnum, zbr->offs); 1736 dbg_dump_node(c, buf); | 376 dbg_dump_node(c, node); 377 return err; 378 } 379 380 zbr->leaf = node; 381 return 0; 382} 383 --- 1345 unchanged lines hidden (view full) --- 1729 1730 return 0; 1731 1732out_err: 1733 err = -EINVAL; 1734out: 1735 ubifs_err("bad node at LEB %d:%d", zbr->lnum, zbr->offs); 1736 dbg_dump_node(c, buf); |
1737 dbg_dump_stack(); | 1737 dump_stack(); |
1738 return err; 1739} 1740 1741/** 1742 * ubifs_tnc_bulk_read - read a number of data nodes in one go. 1743 * @c: UBIFS file-system description object 1744 * @bu: bulk-read parameters and results 1745 * --- 24 unchanged lines hidden (view full) --- 1770 1771 /* Check for a race with GC */ 1772 if (maybe_leb_gced(c, lnum, bu->gc_seq)) 1773 return -EAGAIN; 1774 1775 if (err && err != -EBADMSG) { 1776 ubifs_err("failed to read from LEB %d:%d, error %d", 1777 lnum, offs, err); | 1738 return err; 1739} 1740 1741/** 1742 * ubifs_tnc_bulk_read - read a number of data nodes in one go. 1743 * @c: UBIFS file-system description object 1744 * @bu: bulk-read parameters and results 1745 * --- 24 unchanged lines hidden (view full) --- 1770 1771 /* Check for a race with GC */ 1772 if (maybe_leb_gced(c, lnum, bu->gc_seq)) 1773 return -EAGAIN; 1774 1775 if (err && err != -EBADMSG) { 1776 ubifs_err("failed to read from LEB %d:%d, error %d", 1777 lnum, offs, err); |
1778 dbg_dump_stack(); | 1778 dump_stack(); |
1779 dbg_tnck(&bu->key, "key "); 1780 return err; 1781 } 1782 1783 /* Validate the nodes read */ 1784 buf = bu->buf; 1785 for (i = 0; i < bu->cnt; i++) { 1786 err = validate_data_node(c, buf, &bu->zbranch[i]); --- 569 unchanged lines hidden (view full) --- 2356 goto out_unlock; 2357 if (c->replaying) { 2358 /* 2359 * We did not find it in the index so there may be a 2360 * dangling branch still in the index. So we remove it 2361 * by passing 'ubifs_tnc_remove_nm()' the same key but 2362 * an unmatchable name. 2363 */ | 1779 dbg_tnck(&bu->key, "key "); 1780 return err; 1781 } 1782 1783 /* Validate the nodes read */ 1784 buf = bu->buf; 1785 for (i = 0; i < bu->cnt; i++) { 1786 err = validate_data_node(c, buf, &bu->zbranch[i]); --- 569 unchanged lines hidden (view full) --- 2356 goto out_unlock; 2357 if (c->replaying) { 2358 /* 2359 * We did not find it in the index so there may be a 2360 * dangling branch still in the index. So we remove it 2361 * by passing 'ubifs_tnc_remove_nm()' the same key but 2362 * an unmatchable name. 2363 */ |
2364 struct qstr noname = { .name = "" }; | 2364 struct qstr noname = { .len = 0, .name = "" }; |
2365 2366 err = dbg_check_tnc(c, 0); 2367 mutex_unlock(&c->tnc_mutex); 2368 if (err) 2369 return err; 2370 return ubifs_tnc_remove_nm(c, key, &noname); 2371 } 2372 } --- 958 unchanged lines hidden (view full) --- 3331 3332out_dump: 3333 block = key_block(c, key); 3334 ubifs_err("inode %lu has size %lld, but there are data at offset %lld", 3335 (unsigned long)inode->i_ino, size, 3336 ((loff_t)block) << UBIFS_BLOCK_SHIFT); 3337 mutex_unlock(&c->tnc_mutex); 3338 dbg_dump_inode(c, inode); | 2365 2366 err = dbg_check_tnc(c, 0); 2367 mutex_unlock(&c->tnc_mutex); 2368 if (err) 2369 return err; 2370 return ubifs_tnc_remove_nm(c, key, &noname); 2371 } 2372 } --- 958 unchanged lines hidden (view full) --- 3331 3332out_dump: 3333 block = key_block(c, key); 3334 ubifs_err("inode %lu has size %lld, but there are data at offset %lld", 3335 (unsigned long)inode->i_ino, size, 3336 ((loff_t)block) << UBIFS_BLOCK_SHIFT); 3337 mutex_unlock(&c->tnc_mutex); 3338 dbg_dump_inode(c, inode); |
3339 dbg_dump_stack(); | 3339 dump_stack(); |
3340 return -EINVAL; 3341 3342out_unlock: 3343 mutex_unlock(&c->tnc_mutex); 3344 return err; 3345} 3346 3347#endif /* CONFIG_UBIFS_FS_DEBUG */ | 3340 return -EINVAL; 3341 3342out_unlock: 3343 mutex_unlock(&c->tnc_mutex); 3344 return err; 3345} 3346 3347#endif /* CONFIG_UBIFS_FS_DEBUG */ |