tree: https://git.kernel.org/pub/scm/linux/kernel/git/dgc/linux-xfs.git xfs-async-inode-reclaim head: a6b06a056446a604d909fd24f24c78f08f5be671 commit: 625d9019e66af4550a0ebcbc5dc04e68f41bc068 [28/30] xfs: rework xfs_iflush_cluster() dirty inode iteration config: m68k-randconfig-r005-20200526 (attached as .config) compiler: m68k-linux-gcc (GCC) 9.3.0 reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross git checkout 625d9019e66af4550a0ebcbc5dc04e68f41bc068 # save the attached .config to linux build tree COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=m68k If you fix the issue, kindly add following tag as appropriate Reported-by: kbuild test robot <lkp@xxxxxxxxx> All warnings (new ones prefixed by >>, old ones prefixed by <<): >> fs/xfs/xfs_inode.c:3432:1: warning: no previous prototype for 'xfs_iflush' [-Wmissing-prototypes] 3432 | xfs_iflush( | ^~~~~~~~~~ vim +/xfs_iflush +3432 fs/xfs/xfs_inode.c f6bba2017afb3bd Dave Chinner 2013-08-12 3430 625d9019e66af45 Dave Chinner 2020-05-22 3431 int 30ebf34422da620 Dave Chinner 2020-05-22 @3432 xfs_iflush( 93848a999cf9b9e Christoph Hellwig 2013-04-03 3433 struct xfs_inode *ip, 93848a999cf9b9e Christoph Hellwig 2013-04-03 3434 struct xfs_buf *bp) ^1da177e4c3f415 Linus Torvalds 2005-04-16 3435 { 93848a999cf9b9e Christoph Hellwig 2013-04-03 3436 struct xfs_inode_log_item *iip = ip->i_itemp; 93848a999cf9b9e Christoph Hellwig 2013-04-03 3437 struct xfs_dinode *dip; 93848a999cf9b9e Christoph Hellwig 2013-04-03 3438 struct xfs_mount *mp = ip->i_mount; f20192991d79129 Brian Foster 2020-05-06 3439 int error; ^1da177e4c3f415 Linus Torvalds 2005-04-16 3440 579aa9caf552c63 Christoph Hellwig 2008-04-22 3441 ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL|XFS_ILOCK_SHARED)); 474fce067521a40 Christoph Hellwig 2011-12-18 3442 ASSERT(xfs_isiflocked(ip)); f7e67b20ecbbcb9 Christoph Hellwig 2020-05-18 3443 ASSERT(ip->i_df.if_format != XFS_DINODE_FMT_BTREE || daf83964a3681cf Christoph Hellwig 2020-05-18 3444 ip->i_df.if_nextents > XFS_IFORK_MAXEXT(ip, XFS_DATA_FORK)); 93848a999cf9b9e Christoph Hellwig 2013-04-03 3445 ASSERT(iip != NULL && iip->ili_fields != 0); 1c72d829fa7a17b Dave Chinner 2020-05-22 3446 ASSERT(iip->ili_item.li_buf == bp); ^1da177e4c3f415 Linus Torvalds 2005-04-16 3447 88ee2df7f259113 Christoph Hellwig 2015-06-22 3448 dip = xfs_buf_offset(bp, ip->i_imap.im_boffset); ^1da177e4c3f415 Linus Torvalds 2005-04-16 3449 f20192991d79129 Brian Foster 2020-05-06 3450 /* f20192991d79129 Brian Foster 2020-05-06 3451 * We don't flush the inode if any of the following checks fail, but we f20192991d79129 Brian Foster 2020-05-06 3452 * do still update the log item and attach to the backing buffer as if f20192991d79129 Brian Foster 2020-05-06 3453 * the flush happened. This is a formality to facilitate predictable f20192991d79129 Brian Foster 2020-05-06 3454 * error handling as the caller will shutdown and fail the buffer. f20192991d79129 Brian Foster 2020-05-06 3455 */ f20192991d79129 Brian Foster 2020-05-06 3456 error = -EFSCORRUPTED; 69ef921b55cc378 Christoph Hellwig 2011-07-08 3457 if (XFS_TEST_ERROR(dip->di_magic != cpu_to_be16(XFS_DINODE_MAGIC), 9e24cfd044853e0 Darrick J. Wong 2017-06-20 3458 mp, XFS_ERRTAG_IFLUSH_1)) { 6a19d9393a5402e Dave Chinner 2011-03-07 3459 xfs_alert_tag(mp, XFS_PTAG_IFLUSH, c96900435fa9fdf Darrick J. Wong 2018-01-09 3460 "%s: Bad inode %Lu magic number 0x%x, ptr "PTR_FMT, 6a19d9393a5402e Dave Chinner 2011-03-07 3461 __func__, ip->i_ino, be16_to_cpu(dip->di_magic), dip); f20192991d79129 Brian Foster 2020-05-06 3462 goto flush_out; ^1da177e4c3f415 Linus Torvalds 2005-04-16 3463 } c19b3b05ae440de Dave Chinner 2016-02-09 3464 if (S_ISREG(VFS_I(ip)->i_mode)) { ^1da177e4c3f415 Linus Torvalds 2005-04-16 3465 if (XFS_TEST_ERROR( f7e67b20ecbbcb9 Christoph Hellwig 2020-05-18 3466 ip->i_df.if_format != XFS_DINODE_FMT_EXTENTS && f7e67b20ecbbcb9 Christoph Hellwig 2020-05-18 3467 ip->i_df.if_format != XFS_DINODE_FMT_BTREE, 9e24cfd044853e0 Darrick J. Wong 2017-06-20 3468 mp, XFS_ERRTAG_IFLUSH_3)) { 6a19d9393a5402e Dave Chinner 2011-03-07 3469 xfs_alert_tag(mp, XFS_PTAG_IFLUSH, c96900435fa9fdf Darrick J. Wong 2018-01-09 3470 "%s: Bad regular inode %Lu, ptr "PTR_FMT, 6a19d9393a5402e Dave Chinner 2011-03-07 3471 __func__, ip->i_ino, ip); f20192991d79129 Brian Foster 2020-05-06 3472 goto flush_out; ^1da177e4c3f415 Linus Torvalds 2005-04-16 3473 } c19b3b05ae440de Dave Chinner 2016-02-09 3474 } else if (S_ISDIR(VFS_I(ip)->i_mode)) { ^1da177e4c3f415 Linus Torvalds 2005-04-16 3475 if (XFS_TEST_ERROR( f7e67b20ecbbcb9 Christoph Hellwig 2020-05-18 3476 ip->i_df.if_format != XFS_DINODE_FMT_EXTENTS && f7e67b20ecbbcb9 Christoph Hellwig 2020-05-18 3477 ip->i_df.if_format != XFS_DINODE_FMT_BTREE && f7e67b20ecbbcb9 Christoph Hellwig 2020-05-18 3478 ip->i_df.if_format != XFS_DINODE_FMT_LOCAL, 9e24cfd044853e0 Darrick J. Wong 2017-06-20 3479 mp, XFS_ERRTAG_IFLUSH_4)) { 6a19d9393a5402e Dave Chinner 2011-03-07 3480 xfs_alert_tag(mp, XFS_PTAG_IFLUSH, c96900435fa9fdf Darrick J. Wong 2018-01-09 3481 "%s: Bad directory inode %Lu, ptr "PTR_FMT, 6a19d9393a5402e Dave Chinner 2011-03-07 3482 __func__, ip->i_ino, ip); f20192991d79129 Brian Foster 2020-05-06 3483 goto flush_out; ^1da177e4c3f415 Linus Torvalds 2005-04-16 3484 } ^1da177e4c3f415 Linus Torvalds 2005-04-16 3485 } daf83964a3681cf Christoph Hellwig 2020-05-18 3486 if (XFS_TEST_ERROR(ip->i_df.if_nextents + xfs_ifork_nextents(ip->i_afp) > 9e24cfd044853e0 Darrick J. Wong 2017-06-20 3487 ip->i_d.di_nblocks, mp, XFS_ERRTAG_IFLUSH_5)) { 6a19d9393a5402e Dave Chinner 2011-03-07 3488 xfs_alert_tag(mp, XFS_PTAG_IFLUSH, 6a19d9393a5402e Dave Chinner 2011-03-07 3489 "%s: detected corrupt incore inode %Lu, " c96900435fa9fdf Darrick J. Wong 2018-01-09 3490 "total extents = %d, nblocks = %Ld, ptr "PTR_FMT, 6a19d9393a5402e Dave Chinner 2011-03-07 3491 __func__, ip->i_ino, daf83964a3681cf Christoph Hellwig 2020-05-18 3492 ip->i_df.if_nextents + xfs_ifork_nextents(ip->i_afp), 6a19d9393a5402e Dave Chinner 2011-03-07 3493 ip->i_d.di_nblocks, ip); f20192991d79129 Brian Foster 2020-05-06 3494 goto flush_out; ^1da177e4c3f415 Linus Torvalds 2005-04-16 3495 } ^1da177e4c3f415 Linus Torvalds 2005-04-16 3496 if (XFS_TEST_ERROR(ip->i_d.di_forkoff > mp->m_sb.sb_inodesize, 9e24cfd044853e0 Darrick J. Wong 2017-06-20 3497 mp, XFS_ERRTAG_IFLUSH_6)) { 6a19d9393a5402e Dave Chinner 2011-03-07 3498 xfs_alert_tag(mp, XFS_PTAG_IFLUSH, c96900435fa9fdf Darrick J. Wong 2018-01-09 3499 "%s: bad inode %Lu, forkoff 0x%x, ptr "PTR_FMT, 6a19d9393a5402e Dave Chinner 2011-03-07 3500 __func__, ip->i_ino, ip->i_d.di_forkoff, ip); f20192991d79129 Brian Foster 2020-05-06 3501 goto flush_out; ^1da177e4c3f415 Linus Torvalds 2005-04-16 3502 } e60896d8f2b8141 Dave Chinner 2013-07-24 3503 ^1da177e4c3f415 Linus Torvalds 2005-04-16 3504 /* 263997a6842b27a Dave Chinner 2014-05-20 3505 * Inode item log recovery for v2 inodes are dependent on the e60896d8f2b8141 Dave Chinner 2013-07-24 3506 * di_flushiter count for correct sequencing. We bump the flush e60896d8f2b8141 Dave Chinner 2013-07-24 3507 * iteration count so we can detect flushes which postdate a log record e60896d8f2b8141 Dave Chinner 2013-07-24 3508 * during recovery. This is redundant as we now log every change and e60896d8f2b8141 Dave Chinner 2013-07-24 3509 * hence this can't happen but we need to still do it to ensure e60896d8f2b8141 Dave Chinner 2013-07-24 3510 * backwards compatibility with old kernels that predate logging all e60896d8f2b8141 Dave Chinner 2013-07-24 3511 * inode changes. ^1da177e4c3f415 Linus Torvalds 2005-04-16 3512 */ 6471e9c5e7a109a Christoph Hellwig 2020-03-18 3513 if (!xfs_sb_version_has_v3inode(&mp->m_sb)) ^1da177e4c3f415 Linus Torvalds 2005-04-16 3514 ip->i_d.di_flushiter++; ^1da177e4c3f415 Linus Torvalds 2005-04-16 3515 0f45a1b20cd8f9c Christoph Hellwig 2020-05-14 3516 /* 0f45a1b20cd8f9c Christoph Hellwig 2020-05-14 3517 * If there are inline format data / attr forks attached to this inode, 0f45a1b20cd8f9c Christoph Hellwig 2020-05-14 3518 * make sure they are not corrupt. 0f45a1b20cd8f9c Christoph Hellwig 2020-05-14 3519 */ f7e67b20ecbbcb9 Christoph Hellwig 2020-05-18 3520 if (ip->i_df.if_format == XFS_DINODE_FMT_LOCAL && 0f45a1b20cd8f9c Christoph Hellwig 2020-05-14 3521 xfs_ifork_verify_local_data(ip)) 0f45a1b20cd8f9c Christoph Hellwig 2020-05-14 3522 goto flush_out; f7e67b20ecbbcb9 Christoph Hellwig 2020-05-18 3523 if (ip->i_afp && ip->i_afp->if_format == XFS_DINODE_FMT_LOCAL && 0f45a1b20cd8f9c Christoph Hellwig 2020-05-14 3524 xfs_ifork_verify_local_attr(ip)) f20192991d79129 Brian Foster 2020-05-06 3525 goto flush_out; 005c5db8fd7b2c9 Darrick J. Wong 2017-03-28 3526 ^1da177e4c3f415 Linus Torvalds 2005-04-16 3527 /* 3987848c7c2be11 Dave Chinner 2016-02-09 3528 * Copy the dirty parts of the inode into the on-disk inode. We always 3987848c7c2be11 Dave Chinner 2016-02-09 3529 * copy out the core of the inode, because if the inode is dirty at all 3987848c7c2be11 Dave Chinner 2016-02-09 3530 * the core must be. ^1da177e4c3f415 Linus Torvalds 2005-04-16 3531 */ 93f958f9c41f0bf Dave Chinner 2016-02-09 3532 xfs_inode_to_disk(ip, dip, iip->ili_item.li_lsn); ^1da177e4c3f415 Linus Torvalds 2005-04-16 3533 ^1da177e4c3f415 Linus Torvalds 2005-04-16 3534 /* Wrap, we never let the log put out DI_MAX_FLUSH */ ^1da177e4c3f415 Linus Torvalds 2005-04-16 3535 if (ip->i_d.di_flushiter == DI_MAX_FLUSH) ^1da177e4c3f415 Linus Torvalds 2005-04-16 3536 ip->i_d.di_flushiter = 0; ^1da177e4c3f415 Linus Torvalds 2005-04-16 3537 005c5db8fd7b2c9 Darrick J. Wong 2017-03-28 3538 xfs_iflush_fork(ip, dip, iip, XFS_DATA_FORK); 005c5db8fd7b2c9 Darrick J. Wong 2017-03-28 3539 if (XFS_IFORK_Q(ip)) 005c5db8fd7b2c9 Darrick J. Wong 2017-03-28 3540 xfs_iflush_fork(ip, dip, iip, XFS_ATTR_FORK); ^1da177e4c3f415 Linus Torvalds 2005-04-16 3541 xfs_inobp_check(mp, bp); ^1da177e4c3f415 Linus Torvalds 2005-04-16 3542 ^1da177e4c3f415 Linus Torvalds 2005-04-16 3543 /* f5d8d5c4bf29c9f Christoph Hellwig 2012-02-29 3544 * We've recorded everything logged in the inode, so we'd like to clear f5d8d5c4bf29c9f Christoph Hellwig 2012-02-29 3545 * the ili_fields bits so we don't log and flush things unnecessarily. f5d8d5c4bf29c9f Christoph Hellwig 2012-02-29 3546 * However, we can't stop logging all this information until the data f5d8d5c4bf29c9f Christoph Hellwig 2012-02-29 3547 * we've copied into the disk buffer is written to disk. If we did we f5d8d5c4bf29c9f Christoph Hellwig 2012-02-29 3548 * might overwrite the copy of the inode in the log with all the data f5d8d5c4bf29c9f Christoph Hellwig 2012-02-29 3549 * after re-logging only part of it, and in the face of a crash we f5d8d5c4bf29c9f Christoph Hellwig 2012-02-29 3550 * wouldn't have all the data we need to recover. ^1da177e4c3f415 Linus Torvalds 2005-04-16 3551 * f5d8d5c4bf29c9f Christoph Hellwig 2012-02-29 3552 * What we do is move the bits to the ili_last_fields field. When f5d8d5c4bf29c9f Christoph Hellwig 2012-02-29 3553 * logging the inode, these bits are moved back to the ili_fields field. f5d8d5c4bf29c9f Christoph Hellwig 2012-02-29 3554 * In the xfs_iflush_done() routine we clear ili_last_fields, since we f5d8d5c4bf29c9f Christoph Hellwig 2012-02-29 3555 * know that the information those bits represent is permanently on f5d8d5c4bf29c9f Christoph Hellwig 2012-02-29 3556 * disk. As long as the flush completes before the inode is logged f5d8d5c4bf29c9f Christoph Hellwig 2012-02-29 3557 * again, then both ili_fields and ili_last_fields will be cleared. f5d8d5c4bf29c9f Christoph Hellwig 2012-02-29 3558 */ f20192991d79129 Brian Foster 2020-05-06 3559 error = 0; f20192991d79129 Brian Foster 2020-05-06 3560 flush_out: 1ecc0f6d602c683 Dave Chinner 2020-05-21 3561 spin_lock(&iip->ili_lock); f5d8d5c4bf29c9f Christoph Hellwig 2012-02-29 3562 iip->ili_last_fields = iip->ili_fields; f5d8d5c4bf29c9f Christoph Hellwig 2012-02-29 3563 iip->ili_fields = 0; fc0561cefc04e78 Dave Chinner 2015-11-03 3564 iip->ili_fsync_fields = 0; 1ecc0f6d602c683 Dave Chinner 2020-05-21 3565 spin_unlock(&iip->ili_lock); ^1da177e4c3f415 Linus Torvalds 2005-04-16 3566 1ecc0f6d602c683 Dave Chinner 2020-05-21 3567 /* 1ecc0f6d602c683 Dave Chinner 2020-05-21 3568 * Store the current LSN of the inode so that we can tell whether the 1ecc0f6d602c683 Dave Chinner 2020-05-21 3569 * item has moved in the AIL from xfs_iflush_done(). 1ecc0f6d602c683 Dave Chinner 2020-05-21 3570 */ 4a70ad0597ce50d Dave Chinner 2020-05-22 3571 ASSERT(iip->ili_item.li_lsn); 7b2e2a31f5c23b5 David Chinner 2008-10-30 3572 xfs_trans_ail_copy_lsn(mp->m_ail, &iip->ili_flush_lsn, 7b2e2a31f5c23b5 David Chinner 2008-10-30 3573 &iip->ili_item.li_lsn); ^1da177e4c3f415 Linus Torvalds 2005-04-16 3574 93848a999cf9b9e Christoph Hellwig 2013-04-03 3575 /* generate the checksum. */ 93848a999cf9b9e Christoph Hellwig 2013-04-03 3576 xfs_dinode_calc_crc(mp, dip); f20192991d79129 Brian Foster 2020-05-06 3577 return error; ^1da177e4c3f415 Linus Torvalds 2005-04-16 3578 } 44a8736bd20a08e Darrick J. Wong 2018-07-25 3579 :::::: The code at line 3432 was first introduced by commit :::::: 30ebf34422da6206608b0c6fba84b424f174b8c5 xfs: rename xfs_iflush_int() :::::: TO: Dave Chinner <dchinner@xxxxxxxxxx> :::::: CC: Dave Chinner <david@xxxxxxxxxxxxx> --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx
Attachment:
.config.gz
Description: application/gzip