CC: [email protected] CC: "Darrick J. Wong" <[email protected]> TO: "Darrick J. Wong" <[email protected]>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux.git vectorized-scrub head: 3506ef55d770f108fa68aeb95268af368da441af commit: 13b2da6bae09f10f256d9b72b15f799f5431a069 [43/306] xfs: refactor the inode recycling code :::::: branch date: 29 hours ago :::::: commit date: 29 hours ago config: x86_64-randconfig-m001-20210418 (attached as .config) compiler: gcc-9 (Debian 9.3.0-22) 9.3.0 If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <[email protected]> Reported-by: Dan Carpenter <[email protected]> smatch warnings: fs/xfs/xfs_icache.c:520 xfs_iget_cache_hit() warn: inconsistent returns '&ip->i_flags_lock'. vim +520 fs/xfs/xfs_icache.c afca6c5b2595fc Dave Chinner 2018-04-17 419 33479e0542df06 Dave Chinner 2012-10-08 420 /* 33479e0542df06 Dave Chinner 2012-10-08 421 * Check the validity of the inode we just found it the cache 33479e0542df06 Dave Chinner 2012-10-08 422 */ 33479e0542df06 Dave Chinner 2012-10-08 423 static int 33479e0542df06 Dave Chinner 2012-10-08 424 xfs_iget_cache_hit( 33479e0542df06 Dave Chinner 2012-10-08 425 struct xfs_perag *pag, 33479e0542df06 Dave Chinner 2012-10-08 426 struct xfs_inode *ip, 33479e0542df06 Dave Chinner 2012-10-08 427 xfs_ino_t ino, 33479e0542df06 Dave Chinner 2012-10-08 428 int flags, 33479e0542df06 Dave Chinner 2012-10-08 429 int lock_flags) __releases(RCU) 33479e0542df06 Dave Chinner 2012-10-08 430 { 33479e0542df06 Dave Chinner 2012-10-08 431 struct inode *inode = VFS_I(ip); 33479e0542df06 Dave Chinner 2012-10-08 432 struct xfs_mount *mp = ip->i_mount; 33479e0542df06 Dave Chinner 2012-10-08 433 int error; 33479e0542df06 Dave Chinner 2012-10-08 434 33479e0542df06 Dave Chinner 2012-10-08 435 /* 33479e0542df06 Dave Chinner 2012-10-08 436 * check for re-use of an inode within an RCU grace period due to the 33479e0542df06 Dave Chinner 2012-10-08 437 * radix tree nodes not being updated yet. We monitor for this by 33479e0542df06 Dave Chinner 2012-10-08 438 * setting the inode number to zero before freeing the inode structure. 33479e0542df06 Dave Chinner 2012-10-08 439 * If the inode has been reallocated and set up, then the inode number 33479e0542df06 Dave Chinner 2012-10-08 440 * will not match, so check for that, too. 33479e0542df06 Dave Chinner 2012-10-08 441 */ 33479e0542df06 Dave Chinner 2012-10-08 442 spin_lock(&ip->i_flags_lock); 33479e0542df06 Dave Chinner 2012-10-08 443 if (ip->i_ino != ino) { 33479e0542df06 Dave Chinner 2012-10-08 444 trace_xfs_iget_skip(ip); ff6d6af2351cae Bill O'Donnell 2015-10-12 445 XFS_STATS_INC(mp, xs_ig_frecycle); 2451337dd04390 Dave Chinner 2014-06-25 446 error = -EAGAIN; 33479e0542df06 Dave Chinner 2012-10-08 447 goto out_error; 33479e0542df06 Dave Chinner 2012-10-08 448 } 33479e0542df06 Dave Chinner 2012-10-08 449 33479e0542df06 Dave Chinner 2012-10-08 450 33479e0542df06 Dave Chinner 2012-10-08 451 /* 33479e0542df06 Dave Chinner 2012-10-08 452 * If we are racing with another cache hit that is currently 33479e0542df06 Dave Chinner 2012-10-08 453 * instantiating this inode or currently recycling it out of 13b2da6bae09f1 Darrick J. Wong 2021-04-07 454 * reclaimable state, wait for the initialisation to complete 33479e0542df06 Dave Chinner 2012-10-08 455 * before continuing. 33479e0542df06 Dave Chinner 2012-10-08 456 * 33479e0542df06 Dave Chinner 2012-10-08 457 * XXX(hch): eventually we should do something equivalent to 33479e0542df06 Dave Chinner 2012-10-08 458 * wait_on_inode to wait for these flags to be cleared 33479e0542df06 Dave Chinner 2012-10-08 459 * instead of polling for it. 33479e0542df06 Dave Chinner 2012-10-08 460 */ 33479e0542df06 Dave Chinner 2012-10-08 461 if (ip->i_flags & (XFS_INEW|XFS_IRECLAIM)) { 33479e0542df06 Dave Chinner 2012-10-08 462 trace_xfs_iget_skip(ip); ff6d6af2351cae Bill O'Donnell 2015-10-12 463 XFS_STATS_INC(mp, xs_ig_frecycle); 2451337dd04390 Dave Chinner 2014-06-25 464 error = -EAGAIN; 33479e0542df06 Dave Chinner 2012-10-08 465 goto out_error; 33479e0542df06 Dave Chinner 2012-10-08 466 } 33479e0542df06 Dave Chinner 2012-10-08 467 33479e0542df06 Dave Chinner 2012-10-08 468 /* afca6c5b2595fc Dave Chinner 2018-04-17 469 * Check the inode free state is valid. This also detects lookup afca6c5b2595fc Dave Chinner 2018-04-17 470 * racing with unlinks. 33479e0542df06 Dave Chinner 2012-10-08 471 */ afca6c5b2595fc Dave Chinner 2018-04-17 472 error = xfs_iget_check_free_state(ip, flags); afca6c5b2595fc Dave Chinner 2018-04-17 473 if (error) 33479e0542df06 Dave Chinner 2012-10-08 474 goto out_error; 33479e0542df06 Dave Chinner 2012-10-08 475 13b2da6bae09f1 Darrick J. Wong 2021-04-07 476 if (ip->i_flags & XFS_IRECLAIMABLE) { 33479e0542df06 Dave Chinner 2012-10-08 477 /* 13b2da6bae09f1 Darrick J. Wong 2021-04-07 478 * If IRECLAIMABLE is set, we've torn down the VFS inode 13b2da6bae09f1 Darrick J. Wong 2021-04-07 479 * already, and must carefully restore it to usable state. 33479e0542df06 Dave Chinner 2012-10-08 480 */ 33479e0542df06 Dave Chinner 2012-10-08 481 trace_xfs_iget_reclaim(ip); 33479e0542df06 Dave Chinner 2012-10-08 482 378f681c4b588c Darrick J. Wong 2017-06-19 483 if (flags & XFS_IGET_INCORE) { 378f681c4b588c Darrick J. Wong 2017-06-19 484 error = -EAGAIN; 378f681c4b588c Darrick J. Wong 2017-06-19 485 goto out_error; 378f681c4b588c Darrick J. Wong 2017-06-19 486 } 378f681c4b588c Darrick J. Wong 2017-06-19 487 13b2da6bae09f1 Darrick J. Wong 2021-04-07 488 /* Drops i_flags_lock and RCU read lock. */ 13b2da6bae09f1 Darrick J. Wong 2021-04-07 489 error = xfs_iget_recycle(pag, ip); 33479e0542df06 Dave Chinner 2012-10-08 490 if (error) { 33479e0542df06 Dave Chinner 2012-10-08 491 trace_xfs_iget_reclaim_fail(ip); 13b2da6bae09f1 Darrick J. Wong 2021-04-07 492 return error; 33479e0542df06 Dave Chinner 2012-10-08 493 } 33479e0542df06 Dave Chinner 2012-10-08 494 } else { 33479e0542df06 Dave Chinner 2012-10-08 495 /* If the VFS inode is being torn down, pause and try again. */ 33479e0542df06 Dave Chinner 2012-10-08 496 if (!igrab(inode)) { 33479e0542df06 Dave Chinner 2012-10-08 497 trace_xfs_iget_skip(ip); 2451337dd04390 Dave Chinner 2014-06-25 498 error = -EAGAIN; 33479e0542df06 Dave Chinner 2012-10-08 499 goto out_error; 33479e0542df06 Dave Chinner 2012-10-08 500 } 33479e0542df06 Dave Chinner 2012-10-08 501 33479e0542df06 Dave Chinner 2012-10-08 502 /* We've got a live one. */ 33479e0542df06 Dave Chinner 2012-10-08 503 spin_unlock(&ip->i_flags_lock); 33479e0542df06 Dave Chinner 2012-10-08 504 rcu_read_unlock(); 33479e0542df06 Dave Chinner 2012-10-08 505 trace_xfs_iget_hit(ip); 33479e0542df06 Dave Chinner 2012-10-08 506 } 33479e0542df06 Dave Chinner 2012-10-08 507 33479e0542df06 Dave Chinner 2012-10-08 508 if (lock_flags != 0) 33479e0542df06 Dave Chinner 2012-10-08 509 xfs_ilock(ip, lock_flags); 33479e0542df06 Dave Chinner 2012-10-08 510 378f681c4b588c Darrick J. Wong 2017-06-19 511 if (!(flags & XFS_IGET_INCORE)) dae2f8ed7992e8 Ira Weiny 2020-04-30 512 xfs_iflags_clear(ip, XFS_ISTALE); ff6d6af2351cae Bill O'Donnell 2015-10-12 513 XFS_STATS_INC(mp, xs_ig_found); 33479e0542df06 Dave Chinner 2012-10-08 514 33479e0542df06 Dave Chinner 2012-10-08 515 return 0; 33479e0542df06 Dave Chinner 2012-10-08 516 33479e0542df06 Dave Chinner 2012-10-08 517 out_error: 33479e0542df06 Dave Chinner 2012-10-08 518 spin_unlock(&ip->i_flags_lock); 33479e0542df06 Dave Chinner 2012-10-08 519 rcu_read_unlock(); 33479e0542df06 Dave Chinner 2012-10-08 @520 return error; 33479e0542df06 Dave Chinner 2012-10-08 521 } 33479e0542df06 Dave Chinner 2012-10-08 522 :::::: The code at line 520 was first introduced by commit :::::: 33479e0542df066fb0b47df18780e93bfe6e0dc5 xfs: remove xfs_iget.c :::::: TO: Dave Chinner <[email protected]> :::::: CC: Ben Myers <[email protected]> --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/[email protected]
.config.gz
Description: application/gzip
_______________________________________________ kbuild mailing list -- [email protected] To unsubscribe send an email to [email protected]
