* [djwong-xfs:repair-metadata-atomically 206/229] fs/xfs/xfs_bmap_item.c:503 xfs_bui_item_recover() error: uninitialized symbol 'type'.
@ 2020-05-26 14:39 ` Dan Carpenter
0 siblings, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2020-05-26 14:39 UTC (permalink / raw)
To: kbuild
[-- Attachment #1: Type: text/plain, Size: 9481 bytes --]
tree: https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux.git repair-metadata-atomically
head: d334005df02786c9f288f2c7060603e9680946b5
commit: ff363fee12a5518f3bcd0f904b46d737e811cf0b [206/229] xfs: clean up xfs_bui_item_recover
config: i386-allyesconfig (attached as .config)
compiler: gcc-7 (Ubuntu 7.5.0-6ubuntu2) 7.5.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
smatch warnings:
fs/xfs/xfs_bmap_item.c:503 xfs_bui_item_recover() error: uninitialized symbol 'type'.
# https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux.git/commit/?id=ff363fee12a5518f3bcd0f904b46d737e811cf0b
git remote add djwong-xfs https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux.git
git remote update djwong-xfs
git checkout ff363fee12a5518f3bcd0f904b46d737e811cf0b
vim +/type +503 fs/xfs/xfs_bmap_item.c
ba266f4f4c84ea Darrick J. Wong 2020-05-15 423 STATIC int
c557f2b9dcf4ed Darrick J. Wong 2020-05-15 424 xfs_bui_item_recover(
c557f2b9dcf4ed Darrick J. Wong 2020-05-15 425 struct xfs_log_item *lip,
aaddb7e46e876a Darrick J. Wong 2020-05-15 426 struct xfs_defer_capture **dfcp)
77d61fe45e7205 Darrick J. Wong 2016-10-03 427 {
c557f2b9dcf4ed Darrick J. Wong 2020-05-15 428 struct xfs_bmbt_irec irec;
c557f2b9dcf4ed Darrick J. Wong 2020-05-15 429 struct xfs_bui_log_item *buip = BUI_ITEM(lip);
c557f2b9dcf4ed Darrick J. Wong 2020-05-15 430 struct xfs_trans *tp;
c557f2b9dcf4ed Darrick J. Wong 2020-05-15 431 struct xfs_inode *ip = NULL;
aaddb7e46e876a Darrick J. Wong 2020-05-15 432 struct xfs_mount *mp = lip->li_mountp;
77d61fe45e7205 Darrick J. Wong 2016-10-03 433 struct xfs_map_extent *bmap;
c557f2b9dcf4ed Darrick J. Wong 2020-05-15 434 struct xfs_bud_log_item *budp;
77d61fe45e7205 Darrick J. Wong 2016-10-03 435 xfs_fsblock_t startblock_fsb;
77d61fe45e7205 Darrick J. Wong 2016-10-03 436 xfs_fsblock_t inode_fsb;
e1a4e37cc7b665 Darrick J. Wong 2017-06-14 437 xfs_filblks_t count;
c557f2b9dcf4ed Darrick J. Wong 2020-05-15 438 xfs_exntst_t state;
9f3afb57d5f1e7 Darrick J. Wong 2016-10-03 439 enum xfs_bmap_intent_type type;
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
c557f2b9dcf4ed Darrick J. Wong 2020-05-15 440 unsigned int bui_type;
9f3afb57d5f1e7 Darrick J. Wong 2016-10-03 441 int whichfork;
c557f2b9dcf4ed Darrick J. Wong 2020-05-15 442 int error = 0;
77d61fe45e7205 Darrick J. Wong 2016-10-03 443
77d61fe45e7205 Darrick J. Wong 2016-10-03 444 /* Only one mapping operation per BUI... */
ff363fee12a551 Darrick J. Wong 2020-05-21 445 if (buip->bui_format.bui_nextents != XFS_BUI_MAX_FAST_EXTENTS)
ff363fee12a551 Darrick J. Wong 2020-05-21 446 goto garbage;
77d61fe45e7205 Darrick J. Wong 2016-10-03 447
77d61fe45e7205 Darrick J. Wong 2016-10-03 448 /*
77d61fe45e7205 Darrick J. Wong 2016-10-03 449 * First check the validity of the extent described by the
77d61fe45e7205 Darrick J. Wong 2016-10-03 450 * BUI. If anything is bad, then toss the BUI.
77d61fe45e7205 Darrick J. Wong 2016-10-03 451 */
77d61fe45e7205 Darrick J. Wong 2016-10-03 452 bmap = &buip->bui_format.bui_extents[0];
77d61fe45e7205 Darrick J. Wong 2016-10-03 453 startblock_fsb = XFS_BB_TO_FSB(mp,
77d61fe45e7205 Darrick J. Wong 2016-10-03 454 XFS_FSB_TO_DADDR(mp, bmap->me_startblock));
77d61fe45e7205 Darrick J. Wong 2016-10-03 455 inode_fsb = XFS_BB_TO_FSB(mp, XFS_FSB_TO_DADDR(mp,
77d61fe45e7205 Darrick J. Wong 2016-10-03 456 XFS_INO_TO_FSB(mp, bmap->me_owner)));
ff363fee12a551 Darrick J. Wong 2020-05-21 457 state = (bmap->me_flags & XFS_BMAP_EXTENT_UNWRITTEN) ?
ff363fee12a551 Darrick J. Wong 2020-05-21 458 XFS_EXT_UNWRITTEN : XFS_EXT_NORM;
ff363fee12a551 Darrick J. Wong 2020-05-21 459 whichfork = (bmap->me_flags & XFS_BMAP_EXTENT_ATTR_FORK) ?
ff363fee12a551 Darrick J. Wong 2020-05-21 460 XFS_ATTR_FORK : XFS_DATA_FORK;
ff363fee12a551 Darrick J. Wong 2020-05-21 461 bui_type = bmap->me_flags & XFS_BMAP_EXTENT_TYPE_MASK;
ff363fee12a551 Darrick J. Wong 2020-05-21 462 switch (bui_type) {
77d61fe45e7205 Darrick J. Wong 2016-10-03 463 case XFS_BMAP_MAP:
77d61fe45e7205 Darrick J. Wong 2016-10-03 464 case XFS_BMAP_UNMAP:
77d61fe45e7205 Darrick J. Wong 2016-10-03 465 break;
77d61fe45e7205 Darrick J. Wong 2016-10-03 466 default:
ff363fee12a551 Darrick J. Wong 2020-05-21 467 goto garbage;
77d61fe45e7205 Darrick J. Wong 2016-10-03 468 }
ff363fee12a551 Darrick J. Wong 2020-05-21 469 if (startblock_fsb == 0 ||
77d61fe45e7205 Darrick J. Wong 2016-10-03 470 bmap->me_len == 0 ||
77d61fe45e7205 Darrick J. Wong 2016-10-03 471 inode_fsb == 0 ||
77d61fe45e7205 Darrick J. Wong 2016-10-03 472 startblock_fsb >= mp->m_sb.sb_dblocks ||
77d61fe45e7205 Darrick J. Wong 2016-10-03 473 bmap->me_len >= mp->m_sb.sb_agblocks ||
77d61fe45e7205 Darrick J. Wong 2016-10-03 474 inode_fsb >= mp->m_sb.sb_dblocks ||
ff363fee12a551 Darrick J. Wong 2020-05-21 475 (bmap->me_flags & ~XFS_BMAP_EXTENT_FLAGS))
ff363fee12a551 Darrick J. Wong 2020-05-21 476 goto garbage;
9f3afb57d5f1e7 Darrick J. Wong 2016-10-03 477
9f3afb57d5f1e7 Darrick J. Wong 2016-10-03 478 /* Grab the inode. */
ff363fee12a551 Darrick J. Wong 2020-05-21 479 error = xfs_iget(mp, NULL, bmap->me_owner, 0, 0, &ip);
9f3afb57d5f1e7 Darrick J. Wong 2016-10-03 480 if (error)
ff363fee12a551 Darrick J. Wong 2020-05-21 481 return error;
17c12bcd3030e4 Darrick J. Wong 2016-10-03 482 if (VFS_I(ip)->i_nlink == 0)
17c12bcd3030e4 Darrick J. Wong 2016-10-03 483 xfs_iflags_set(ip, XFS_IRECOVERY);
9f3afb57d5f1e7 Darrick J. Wong 2016-10-03 484
ff363fee12a551 Darrick J. Wong 2020-05-21 485 /* Allocate transaction and do the work. */
ff363fee12a551 Darrick J. Wong 2020-05-21 486 error = xfs_trans_alloc(mp, &M_RES(mp)->tr_itruncate,
ff363fee12a551 Darrick J. Wong 2020-05-21 487 XFS_EXTENTADD_SPACE_RES(mp, XFS_DATA_FORK), 0, 0, &tp);
ff363fee12a551 Darrick J. Wong 2020-05-21 488 if (error)
ff363fee12a551 Darrick J. Wong 2020-05-21 489 goto err_rele;
ff363fee12a551 Darrick J. Wong 2020-05-21 490
ff363fee12a551 Darrick J. Wong 2020-05-21 491 budp = xfs_trans_get_bud(tp, buip);
ff363fee12a551 Darrick J. Wong 2020-05-21 492 xfs_ilock(ip, XFS_ILOCK_EXCL);
9f3afb57d5f1e7 Darrick J. Wong 2016-10-03 493 xfs_trans_ijoin(tp, ip, 0);
9f3afb57d5f1e7 Darrick J. Wong 2016-10-03 494
e1a4e37cc7b665 Darrick J. Wong 2017-06-14 495 count = bmap->me_len;
ff363fee12a551 Darrick J. Wong 2020-05-21 496 error = xfs_trans_log_finish_bmap_update(tp, budp, bui_type, ip,
ff363fee12a551 Darrick J. Wong 2020-05-21 497 whichfork, bmap->me_startoff, bmap->me_startblock,
ff363fee12a551 Darrick J. Wong 2020-05-21 498 &count, state);
9f3afb57d5f1e7 Darrick J. Wong 2016-10-03 499 if (error)
ff363fee12a551 Darrick J. Wong 2020-05-21 500 goto err_cancel;
9f3afb57d5f1e7 Darrick J. Wong 2016-10-03 501
e1a4e37cc7b665 Darrick J. Wong 2017-06-14 502 if (count > 0) {
e1a4e37cc7b665 Darrick J. Wong 2017-06-14 @503 ASSERT(type == XFS_BMAP_UNMAP);
^^^^^^^^^^^^^^^^^^^^^^
Dead code.
e1a4e37cc7b665 Darrick J. Wong 2017-06-14 504 irec.br_startblock = bmap->me_startblock;
e1a4e37cc7b665 Darrick J. Wong 2017-06-14 505 irec.br_blockcount = count;
e1a4e37cc7b665 Darrick J. Wong 2017-06-14 506 irec.br_startoff = bmap->me_startoff;
e1a4e37cc7b665 Darrick J. Wong 2017-06-14 507 irec.br_state = state;
3e08f42ae7828b Darrick J. Wong 2019-08-26 508 xfs_bmap_unmap_extent(tp, ip, &irec);
e1a4e37cc7b665 Darrick J. Wong 2017-06-14 509 }
e1a4e37cc7b665 Darrick J. Wong 2017-06-14 510
ff363fee12a551 Darrick J. Wong 2020-05-21 511 /* Commit transaction, which frees tp. */
aaddb7e46e876a Darrick J. Wong 2020-05-15 512 error = xlog_recover_trans_commit(tp, dfcp);
ff363fee12a551 Darrick J. Wong 2020-05-21 513 if (error)
ff363fee12a551 Darrick J. Wong 2020-05-21 514 goto err_unlock;
ff363fee12a551 Darrick J. Wong 2020-05-21 515 return 0;
9f3afb57d5f1e7 Darrick J. Wong 2016-10-03 516
ff363fee12a551 Darrick J. Wong 2020-05-21 517 err_cancel:
9f3afb57d5f1e7 Darrick J. Wong 2016-10-03 518 xfs_trans_cancel(tp);
ff363fee12a551 Darrick J. Wong 2020-05-21 519 err_unlock:
9f3afb57d5f1e7 Darrick J. Wong 2016-10-03 520 xfs_iunlock(ip, XFS_ILOCK_EXCL);
ff363fee12a551 Darrick J. Wong 2020-05-21 521 err_rele:
44a8736bd20a08 Darrick J. Wong 2018-07-25 522 xfs_irele(ip);
77d61fe45e7205 Darrick J. Wong 2016-10-03 523 return error;
ff363fee12a551 Darrick J. Wong 2020-05-21 524 garbage:
ff363fee12a551 Darrick J. Wong 2020-05-21 525 xfs_bui_release(buip);
ff363fee12a551 Darrick J. Wong 2020-05-21 526 return -EFSCORRUPTED;
77d61fe45e7205 Darrick J. Wong 2016-10-03 527 }
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 72514 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* [djwong-xfs:repair-metadata-atomically 206/229] fs/xfs/xfs_bmap_item.c:503 xfs_bui_item_recover() error: uninitialized symbol 'type'.
@ 2020-05-26 14:39 ` Dan Carpenter
0 siblings, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2020-05-26 14:39 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 9481 bytes --]
tree: https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux.git repair-metadata-atomically
head: d334005df02786c9f288f2c7060603e9680946b5
commit: ff363fee12a5518f3bcd0f904b46d737e811cf0b [206/229] xfs: clean up xfs_bui_item_recover
config: i386-allyesconfig (attached as .config)
compiler: gcc-7 (Ubuntu 7.5.0-6ubuntu2) 7.5.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
smatch warnings:
fs/xfs/xfs_bmap_item.c:503 xfs_bui_item_recover() error: uninitialized symbol 'type'.
# https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux.git/commit/?id=ff363fee12a5518f3bcd0f904b46d737e811cf0b
git remote add djwong-xfs https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux.git
git remote update djwong-xfs
git checkout ff363fee12a5518f3bcd0f904b46d737e811cf0b
vim +/type +503 fs/xfs/xfs_bmap_item.c
ba266f4f4c84ea Darrick J. Wong 2020-05-15 423 STATIC int
c557f2b9dcf4ed Darrick J. Wong 2020-05-15 424 xfs_bui_item_recover(
c557f2b9dcf4ed Darrick J. Wong 2020-05-15 425 struct xfs_log_item *lip,
aaddb7e46e876a Darrick J. Wong 2020-05-15 426 struct xfs_defer_capture **dfcp)
77d61fe45e7205 Darrick J. Wong 2016-10-03 427 {
c557f2b9dcf4ed Darrick J. Wong 2020-05-15 428 struct xfs_bmbt_irec irec;
c557f2b9dcf4ed Darrick J. Wong 2020-05-15 429 struct xfs_bui_log_item *buip = BUI_ITEM(lip);
c557f2b9dcf4ed Darrick J. Wong 2020-05-15 430 struct xfs_trans *tp;
c557f2b9dcf4ed Darrick J. Wong 2020-05-15 431 struct xfs_inode *ip = NULL;
aaddb7e46e876a Darrick J. Wong 2020-05-15 432 struct xfs_mount *mp = lip->li_mountp;
77d61fe45e7205 Darrick J. Wong 2016-10-03 433 struct xfs_map_extent *bmap;
c557f2b9dcf4ed Darrick J. Wong 2020-05-15 434 struct xfs_bud_log_item *budp;
77d61fe45e7205 Darrick J. Wong 2016-10-03 435 xfs_fsblock_t startblock_fsb;
77d61fe45e7205 Darrick J. Wong 2016-10-03 436 xfs_fsblock_t inode_fsb;
e1a4e37cc7b665 Darrick J. Wong 2017-06-14 437 xfs_filblks_t count;
c557f2b9dcf4ed Darrick J. Wong 2020-05-15 438 xfs_exntst_t state;
9f3afb57d5f1e7 Darrick J. Wong 2016-10-03 439 enum xfs_bmap_intent_type type;
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
c557f2b9dcf4ed Darrick J. Wong 2020-05-15 440 unsigned int bui_type;
9f3afb57d5f1e7 Darrick J. Wong 2016-10-03 441 int whichfork;
c557f2b9dcf4ed Darrick J. Wong 2020-05-15 442 int error = 0;
77d61fe45e7205 Darrick J. Wong 2016-10-03 443
77d61fe45e7205 Darrick J. Wong 2016-10-03 444 /* Only one mapping operation per BUI... */
ff363fee12a551 Darrick J. Wong 2020-05-21 445 if (buip->bui_format.bui_nextents != XFS_BUI_MAX_FAST_EXTENTS)
ff363fee12a551 Darrick J. Wong 2020-05-21 446 goto garbage;
77d61fe45e7205 Darrick J. Wong 2016-10-03 447
77d61fe45e7205 Darrick J. Wong 2016-10-03 448 /*
77d61fe45e7205 Darrick J. Wong 2016-10-03 449 * First check the validity of the extent described by the
77d61fe45e7205 Darrick J. Wong 2016-10-03 450 * BUI. If anything is bad, then toss the BUI.
77d61fe45e7205 Darrick J. Wong 2016-10-03 451 */
77d61fe45e7205 Darrick J. Wong 2016-10-03 452 bmap = &buip->bui_format.bui_extents[0];
77d61fe45e7205 Darrick J. Wong 2016-10-03 453 startblock_fsb = XFS_BB_TO_FSB(mp,
77d61fe45e7205 Darrick J. Wong 2016-10-03 454 XFS_FSB_TO_DADDR(mp, bmap->me_startblock));
77d61fe45e7205 Darrick J. Wong 2016-10-03 455 inode_fsb = XFS_BB_TO_FSB(mp, XFS_FSB_TO_DADDR(mp,
77d61fe45e7205 Darrick J. Wong 2016-10-03 456 XFS_INO_TO_FSB(mp, bmap->me_owner)));
ff363fee12a551 Darrick J. Wong 2020-05-21 457 state = (bmap->me_flags & XFS_BMAP_EXTENT_UNWRITTEN) ?
ff363fee12a551 Darrick J. Wong 2020-05-21 458 XFS_EXT_UNWRITTEN : XFS_EXT_NORM;
ff363fee12a551 Darrick J. Wong 2020-05-21 459 whichfork = (bmap->me_flags & XFS_BMAP_EXTENT_ATTR_FORK) ?
ff363fee12a551 Darrick J. Wong 2020-05-21 460 XFS_ATTR_FORK : XFS_DATA_FORK;
ff363fee12a551 Darrick J. Wong 2020-05-21 461 bui_type = bmap->me_flags & XFS_BMAP_EXTENT_TYPE_MASK;
ff363fee12a551 Darrick J. Wong 2020-05-21 462 switch (bui_type) {
77d61fe45e7205 Darrick J. Wong 2016-10-03 463 case XFS_BMAP_MAP:
77d61fe45e7205 Darrick J. Wong 2016-10-03 464 case XFS_BMAP_UNMAP:
77d61fe45e7205 Darrick J. Wong 2016-10-03 465 break;
77d61fe45e7205 Darrick J. Wong 2016-10-03 466 default:
ff363fee12a551 Darrick J. Wong 2020-05-21 467 goto garbage;
77d61fe45e7205 Darrick J. Wong 2016-10-03 468 }
ff363fee12a551 Darrick J. Wong 2020-05-21 469 if (startblock_fsb == 0 ||
77d61fe45e7205 Darrick J. Wong 2016-10-03 470 bmap->me_len == 0 ||
77d61fe45e7205 Darrick J. Wong 2016-10-03 471 inode_fsb == 0 ||
77d61fe45e7205 Darrick J. Wong 2016-10-03 472 startblock_fsb >= mp->m_sb.sb_dblocks ||
77d61fe45e7205 Darrick J. Wong 2016-10-03 473 bmap->me_len >= mp->m_sb.sb_agblocks ||
77d61fe45e7205 Darrick J. Wong 2016-10-03 474 inode_fsb >= mp->m_sb.sb_dblocks ||
ff363fee12a551 Darrick J. Wong 2020-05-21 475 (bmap->me_flags & ~XFS_BMAP_EXTENT_FLAGS))
ff363fee12a551 Darrick J. Wong 2020-05-21 476 goto garbage;
9f3afb57d5f1e7 Darrick J. Wong 2016-10-03 477
9f3afb57d5f1e7 Darrick J. Wong 2016-10-03 478 /* Grab the inode. */
ff363fee12a551 Darrick J. Wong 2020-05-21 479 error = xfs_iget(mp, NULL, bmap->me_owner, 0, 0, &ip);
9f3afb57d5f1e7 Darrick J. Wong 2016-10-03 480 if (error)
ff363fee12a551 Darrick J. Wong 2020-05-21 481 return error;
17c12bcd3030e4 Darrick J. Wong 2016-10-03 482 if (VFS_I(ip)->i_nlink == 0)
17c12bcd3030e4 Darrick J. Wong 2016-10-03 483 xfs_iflags_set(ip, XFS_IRECOVERY);
9f3afb57d5f1e7 Darrick J. Wong 2016-10-03 484
ff363fee12a551 Darrick J. Wong 2020-05-21 485 /* Allocate transaction and do the work. */
ff363fee12a551 Darrick J. Wong 2020-05-21 486 error = xfs_trans_alloc(mp, &M_RES(mp)->tr_itruncate,
ff363fee12a551 Darrick J. Wong 2020-05-21 487 XFS_EXTENTADD_SPACE_RES(mp, XFS_DATA_FORK), 0, 0, &tp);
ff363fee12a551 Darrick J. Wong 2020-05-21 488 if (error)
ff363fee12a551 Darrick J. Wong 2020-05-21 489 goto err_rele;
ff363fee12a551 Darrick J. Wong 2020-05-21 490
ff363fee12a551 Darrick J. Wong 2020-05-21 491 budp = xfs_trans_get_bud(tp, buip);
ff363fee12a551 Darrick J. Wong 2020-05-21 492 xfs_ilock(ip, XFS_ILOCK_EXCL);
9f3afb57d5f1e7 Darrick J. Wong 2016-10-03 493 xfs_trans_ijoin(tp, ip, 0);
9f3afb57d5f1e7 Darrick J. Wong 2016-10-03 494
e1a4e37cc7b665 Darrick J. Wong 2017-06-14 495 count = bmap->me_len;
ff363fee12a551 Darrick J. Wong 2020-05-21 496 error = xfs_trans_log_finish_bmap_update(tp, budp, bui_type, ip,
ff363fee12a551 Darrick J. Wong 2020-05-21 497 whichfork, bmap->me_startoff, bmap->me_startblock,
ff363fee12a551 Darrick J. Wong 2020-05-21 498 &count, state);
9f3afb57d5f1e7 Darrick J. Wong 2016-10-03 499 if (error)
ff363fee12a551 Darrick J. Wong 2020-05-21 500 goto err_cancel;
9f3afb57d5f1e7 Darrick J. Wong 2016-10-03 501
e1a4e37cc7b665 Darrick J. Wong 2017-06-14 502 if (count > 0) {
e1a4e37cc7b665 Darrick J. Wong 2017-06-14 @503 ASSERT(type == XFS_BMAP_UNMAP);
^^^^^^^^^^^^^^^^^^^^^^
Dead code.
e1a4e37cc7b665 Darrick J. Wong 2017-06-14 504 irec.br_startblock = bmap->me_startblock;
e1a4e37cc7b665 Darrick J. Wong 2017-06-14 505 irec.br_blockcount = count;
e1a4e37cc7b665 Darrick J. Wong 2017-06-14 506 irec.br_startoff = bmap->me_startoff;
e1a4e37cc7b665 Darrick J. Wong 2017-06-14 507 irec.br_state = state;
3e08f42ae7828b Darrick J. Wong 2019-08-26 508 xfs_bmap_unmap_extent(tp, ip, &irec);
e1a4e37cc7b665 Darrick J. Wong 2017-06-14 509 }
e1a4e37cc7b665 Darrick J. Wong 2017-06-14 510
ff363fee12a551 Darrick J. Wong 2020-05-21 511 /* Commit transaction, which frees tp. */
aaddb7e46e876a Darrick J. Wong 2020-05-15 512 error = xlog_recover_trans_commit(tp, dfcp);
ff363fee12a551 Darrick J. Wong 2020-05-21 513 if (error)
ff363fee12a551 Darrick J. Wong 2020-05-21 514 goto err_unlock;
ff363fee12a551 Darrick J. Wong 2020-05-21 515 return 0;
9f3afb57d5f1e7 Darrick J. Wong 2016-10-03 516
ff363fee12a551 Darrick J. Wong 2020-05-21 517 err_cancel:
9f3afb57d5f1e7 Darrick J. Wong 2016-10-03 518 xfs_trans_cancel(tp);
ff363fee12a551 Darrick J. Wong 2020-05-21 519 err_unlock:
9f3afb57d5f1e7 Darrick J. Wong 2016-10-03 520 xfs_iunlock(ip, XFS_ILOCK_EXCL);
ff363fee12a551 Darrick J. Wong 2020-05-21 521 err_rele:
44a8736bd20a08 Darrick J. Wong 2018-07-25 522 xfs_irele(ip);
77d61fe45e7205 Darrick J. Wong 2016-10-03 523 return error;
ff363fee12a551 Darrick J. Wong 2020-05-21 524 garbage:
ff363fee12a551 Darrick J. Wong 2020-05-21 525 xfs_bui_release(buip);
ff363fee12a551 Darrick J. Wong 2020-05-21 526 return -EFSCORRUPTED;
77d61fe45e7205 Darrick J. Wong 2016-10-03 527 }
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 72514 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* [djwong-xfs:repair-metadata-atomically 206/229] fs/xfs/xfs_bmap_item.c:503 xfs_bui_item_recover() error: uninitialized symbol 'type'.
@ 2020-05-24 23:58 kbuild test robot
0 siblings, 0 replies; 3+ messages in thread
From: kbuild test robot @ 2020-05-24 23:58 UTC (permalink / raw)
To: kbuild
[-- Attachment #1: Type: text/plain, Size: 10207 bytes --]
CC: kbuild-all(a)lists.01.org
CC: "Darrick J. Wong" <darrick.wong@oracle.com>
TO: "Darrick J. Wong" <darrick.wong@oracle.com>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux.git repair-metadata-atomically
head: d334005df02786c9f288f2c7060603e9680946b5
commit: ff363fee12a5518f3bcd0f904b46d737e811cf0b [206/229] xfs: clean up xfs_bui_item_recover
:::::: branch date: 32 hours ago
:::::: commit date: 32 hours ago
config: i386-allyesconfig (attached as .config)
compiler: gcc-7 (Ubuntu 7.5.0-6ubuntu2) 7.5.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
smatch warnings:
fs/xfs/xfs_bmap_item.c:503 xfs_bui_item_recover() error: uninitialized symbol 'type'.
# https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux.git/commit/?id=ff363fee12a5518f3bcd0f904b46d737e811cf0b
git remote add djwong-xfs https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux.git
git remote update djwong-xfs
git checkout ff363fee12a5518f3bcd0f904b46d737e811cf0b
vim +/type +503 fs/xfs/xfs_bmap_item.c
caeaea98583230 Christoph Hellwig 2019-06-28 418
77d61fe45e7205 Darrick J. Wong 2016-10-03 419 /*
77d61fe45e7205 Darrick J. Wong 2016-10-03 420 * Process a bmap update intent item that was recovered from the log.
77d61fe45e7205 Darrick J. Wong 2016-10-03 421 * We need to update some inode's bmbt.
77d61fe45e7205 Darrick J. Wong 2016-10-03 422 */
ba266f4f4c84ea Darrick J. Wong 2020-05-15 423 STATIC int
c557f2b9dcf4ed Darrick J. Wong 2020-05-15 424 xfs_bui_item_recover(
c557f2b9dcf4ed Darrick J. Wong 2020-05-15 425 struct xfs_log_item *lip,
aaddb7e46e876a Darrick J. Wong 2020-05-15 426 struct xfs_defer_capture **dfcp)
77d61fe45e7205 Darrick J. Wong 2016-10-03 427 {
c557f2b9dcf4ed Darrick J. Wong 2020-05-15 428 struct xfs_bmbt_irec irec;
c557f2b9dcf4ed Darrick J. Wong 2020-05-15 429 struct xfs_bui_log_item *buip = BUI_ITEM(lip);
c557f2b9dcf4ed Darrick J. Wong 2020-05-15 430 struct xfs_trans *tp;
c557f2b9dcf4ed Darrick J. Wong 2020-05-15 431 struct xfs_inode *ip = NULL;
aaddb7e46e876a Darrick J. Wong 2020-05-15 432 struct xfs_mount *mp = lip->li_mountp;
77d61fe45e7205 Darrick J. Wong 2016-10-03 433 struct xfs_map_extent *bmap;
c557f2b9dcf4ed Darrick J. Wong 2020-05-15 434 struct xfs_bud_log_item *budp;
77d61fe45e7205 Darrick J. Wong 2016-10-03 435 xfs_fsblock_t startblock_fsb;
77d61fe45e7205 Darrick J. Wong 2016-10-03 436 xfs_fsblock_t inode_fsb;
e1a4e37cc7b665 Darrick J. Wong 2017-06-14 437 xfs_filblks_t count;
c557f2b9dcf4ed Darrick J. Wong 2020-05-15 438 xfs_exntst_t state;
9f3afb57d5f1e7 Darrick J. Wong 2016-10-03 439 enum xfs_bmap_intent_type type;
c557f2b9dcf4ed Darrick J. Wong 2020-05-15 440 unsigned int bui_type;
9f3afb57d5f1e7 Darrick J. Wong 2016-10-03 441 int whichfork;
c557f2b9dcf4ed Darrick J. Wong 2020-05-15 442 int error = 0;
77d61fe45e7205 Darrick J. Wong 2016-10-03 443
77d61fe45e7205 Darrick J. Wong 2016-10-03 444 /* Only one mapping operation per BUI... */
ff363fee12a551 Darrick J. Wong 2020-05-21 445 if (buip->bui_format.bui_nextents != XFS_BUI_MAX_FAST_EXTENTS)
ff363fee12a551 Darrick J. Wong 2020-05-21 446 goto garbage;
77d61fe45e7205 Darrick J. Wong 2016-10-03 447
77d61fe45e7205 Darrick J. Wong 2016-10-03 448 /*
77d61fe45e7205 Darrick J. Wong 2016-10-03 449 * First check the validity of the extent described by the
77d61fe45e7205 Darrick J. Wong 2016-10-03 450 * BUI. If anything is bad, then toss the BUI.
77d61fe45e7205 Darrick J. Wong 2016-10-03 451 */
77d61fe45e7205 Darrick J. Wong 2016-10-03 452 bmap = &buip->bui_format.bui_extents[0];
77d61fe45e7205 Darrick J. Wong 2016-10-03 453 startblock_fsb = XFS_BB_TO_FSB(mp,
77d61fe45e7205 Darrick J. Wong 2016-10-03 454 XFS_FSB_TO_DADDR(mp, bmap->me_startblock));
77d61fe45e7205 Darrick J. Wong 2016-10-03 455 inode_fsb = XFS_BB_TO_FSB(mp, XFS_FSB_TO_DADDR(mp,
77d61fe45e7205 Darrick J. Wong 2016-10-03 456 XFS_INO_TO_FSB(mp, bmap->me_owner)));
ff363fee12a551 Darrick J. Wong 2020-05-21 457 state = (bmap->me_flags & XFS_BMAP_EXTENT_UNWRITTEN) ?
ff363fee12a551 Darrick J. Wong 2020-05-21 458 XFS_EXT_UNWRITTEN : XFS_EXT_NORM;
ff363fee12a551 Darrick J. Wong 2020-05-21 459 whichfork = (bmap->me_flags & XFS_BMAP_EXTENT_ATTR_FORK) ?
ff363fee12a551 Darrick J. Wong 2020-05-21 460 XFS_ATTR_FORK : XFS_DATA_FORK;
ff363fee12a551 Darrick J. Wong 2020-05-21 461 bui_type = bmap->me_flags & XFS_BMAP_EXTENT_TYPE_MASK;
ff363fee12a551 Darrick J. Wong 2020-05-21 462 switch (bui_type) {
77d61fe45e7205 Darrick J. Wong 2016-10-03 463 case XFS_BMAP_MAP:
77d61fe45e7205 Darrick J. Wong 2016-10-03 464 case XFS_BMAP_UNMAP:
77d61fe45e7205 Darrick J. Wong 2016-10-03 465 break;
77d61fe45e7205 Darrick J. Wong 2016-10-03 466 default:
ff363fee12a551 Darrick J. Wong 2020-05-21 467 goto garbage;
77d61fe45e7205 Darrick J. Wong 2016-10-03 468 }
ff363fee12a551 Darrick J. Wong 2020-05-21 469 if (startblock_fsb == 0 ||
77d61fe45e7205 Darrick J. Wong 2016-10-03 470 bmap->me_len == 0 ||
77d61fe45e7205 Darrick J. Wong 2016-10-03 471 inode_fsb == 0 ||
77d61fe45e7205 Darrick J. Wong 2016-10-03 472 startblock_fsb >= mp->m_sb.sb_dblocks ||
77d61fe45e7205 Darrick J. Wong 2016-10-03 473 bmap->me_len >= mp->m_sb.sb_agblocks ||
77d61fe45e7205 Darrick J. Wong 2016-10-03 474 inode_fsb >= mp->m_sb.sb_dblocks ||
ff363fee12a551 Darrick J. Wong 2020-05-21 475 (bmap->me_flags & ~XFS_BMAP_EXTENT_FLAGS))
ff363fee12a551 Darrick J. Wong 2020-05-21 476 goto garbage;
9f3afb57d5f1e7 Darrick J. Wong 2016-10-03 477
9f3afb57d5f1e7 Darrick J. Wong 2016-10-03 478 /* Grab the inode. */
ff363fee12a551 Darrick J. Wong 2020-05-21 479 error = xfs_iget(mp, NULL, bmap->me_owner, 0, 0, &ip);
9f3afb57d5f1e7 Darrick J. Wong 2016-10-03 480 if (error)
ff363fee12a551 Darrick J. Wong 2020-05-21 481 return error;
17c12bcd3030e4 Darrick J. Wong 2016-10-03 482 if (VFS_I(ip)->i_nlink == 0)
17c12bcd3030e4 Darrick J. Wong 2016-10-03 483 xfs_iflags_set(ip, XFS_IRECOVERY);
9f3afb57d5f1e7 Darrick J. Wong 2016-10-03 484
ff363fee12a551 Darrick J. Wong 2020-05-21 485 /* Allocate transaction and do the work. */
ff363fee12a551 Darrick J. Wong 2020-05-21 486 error = xfs_trans_alloc(mp, &M_RES(mp)->tr_itruncate,
ff363fee12a551 Darrick J. Wong 2020-05-21 487 XFS_EXTENTADD_SPACE_RES(mp, XFS_DATA_FORK), 0, 0, &tp);
ff363fee12a551 Darrick J. Wong 2020-05-21 488 if (error)
ff363fee12a551 Darrick J. Wong 2020-05-21 489 goto err_rele;
ff363fee12a551 Darrick J. Wong 2020-05-21 490
ff363fee12a551 Darrick J. Wong 2020-05-21 491 budp = xfs_trans_get_bud(tp, buip);
ff363fee12a551 Darrick J. Wong 2020-05-21 492 xfs_ilock(ip, XFS_ILOCK_EXCL);
9f3afb57d5f1e7 Darrick J. Wong 2016-10-03 493 xfs_trans_ijoin(tp, ip, 0);
9f3afb57d5f1e7 Darrick J. Wong 2016-10-03 494
e1a4e37cc7b665 Darrick J. Wong 2017-06-14 495 count = bmap->me_len;
ff363fee12a551 Darrick J. Wong 2020-05-21 496 error = xfs_trans_log_finish_bmap_update(tp, budp, bui_type, ip,
ff363fee12a551 Darrick J. Wong 2020-05-21 497 whichfork, bmap->me_startoff, bmap->me_startblock,
ff363fee12a551 Darrick J. Wong 2020-05-21 498 &count, state);
9f3afb57d5f1e7 Darrick J. Wong 2016-10-03 499 if (error)
ff363fee12a551 Darrick J. Wong 2020-05-21 500 goto err_cancel;
9f3afb57d5f1e7 Darrick J. Wong 2016-10-03 501
e1a4e37cc7b665 Darrick J. Wong 2017-06-14 502 if (count > 0) {
e1a4e37cc7b665 Darrick J. Wong 2017-06-14 @503 ASSERT(type == XFS_BMAP_UNMAP);
e1a4e37cc7b665 Darrick J. Wong 2017-06-14 504 irec.br_startblock = bmap->me_startblock;
e1a4e37cc7b665 Darrick J. Wong 2017-06-14 505 irec.br_blockcount = count;
e1a4e37cc7b665 Darrick J. Wong 2017-06-14 506 irec.br_startoff = bmap->me_startoff;
e1a4e37cc7b665 Darrick J. Wong 2017-06-14 507 irec.br_state = state;
3e08f42ae7828b Darrick J. Wong 2019-08-26 508 xfs_bmap_unmap_extent(tp, ip, &irec);
e1a4e37cc7b665 Darrick J. Wong 2017-06-14 509 }
e1a4e37cc7b665 Darrick J. Wong 2017-06-14 510
ff363fee12a551 Darrick J. Wong 2020-05-21 511 /* Commit transaction, which frees tp. */
aaddb7e46e876a Darrick J. Wong 2020-05-15 512 error = xlog_recover_trans_commit(tp, dfcp);
ff363fee12a551 Darrick J. Wong 2020-05-21 513 if (error)
ff363fee12a551 Darrick J. Wong 2020-05-21 514 goto err_unlock;
ff363fee12a551 Darrick J. Wong 2020-05-21 515 return 0;
9f3afb57d5f1e7 Darrick J. Wong 2016-10-03 516
ff363fee12a551 Darrick J. Wong 2020-05-21 517 err_cancel:
9f3afb57d5f1e7 Darrick J. Wong 2016-10-03 518 xfs_trans_cancel(tp);
ff363fee12a551 Darrick J. Wong 2020-05-21 519 err_unlock:
9f3afb57d5f1e7 Darrick J. Wong 2016-10-03 520 xfs_iunlock(ip, XFS_ILOCK_EXCL);
ff363fee12a551 Darrick J. Wong 2020-05-21 521 err_rele:
44a8736bd20a08 Darrick J. Wong 2018-07-25 522 xfs_irele(ip);
77d61fe45e7205 Darrick J. Wong 2016-10-03 523 return error;
ff363fee12a551 Darrick J. Wong 2020-05-21 524 garbage:
ff363fee12a551 Darrick J. Wong 2020-05-21 525 xfs_bui_release(buip);
ff363fee12a551 Darrick J. Wong 2020-05-21 526 return -EFSCORRUPTED;
77d61fe45e7205 Darrick J. Wong 2016-10-03 527 }
917a3e3980a922 Darrick J. Wong 2020-05-15 528
:::::: The code at line 503 was first introduced by commit
:::::: e1a4e37cc7b665b6804fba812aca2f4d7402c249 xfs: try to avoid blowing out the transaction reservation when bunmaping a shared extent
:::::: TO: Darrick J. Wong <darrick.wong@oracle.com>
:::::: CC: Darrick J. Wong <darrick.wong@oracle.com>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 72514 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-05-26 14:39 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-26 14:39 [djwong-xfs:repair-metadata-atomically 206/229] fs/xfs/xfs_bmap_item.c:503 xfs_bui_item_recover() error: uninitialized symbol 'type' Dan Carpenter
2020-05-26 14:39 ` Dan Carpenter
-- strict thread matches above, loose matches on Subject: below --
2020-05-24 23:58 kbuild test robot
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.