[hch-xfs:xfs-crc 13/51] fs/xfs/xfs_buf.c:498 xfs_buf_find_insert() warn: missing error code 'error'
kernel test robot <[email protected]>
| Newsgroups | dev.linux.lists.oe-kbuild |
|---|---|
| Message-ID | <[email protected]> |
BCC: [email protected] CC: [email protected] TO: Christoph Hellwig <[email protected]> tree: git://git.infradead.org/users/hch/xfs xfs-crc head: ef3d55d014b3a800421b9dae3ac182577bfe2bd7 commit: 11d9e751fc9d77d02e9dc1ba35ece3db9ce361e4 [13/51] xfs: consolidate buffer locking in xfs_buf_get_map :::::: branch date: 14 hours ago :::::: commit date: 16 hours ago config: nios2-randconfig-r071-20260718 (https://download.01.org/0day-ci/archive/20260718/[email protected]/config) compiler: nios2-linux-gcc (GCC) 10.5.0 smatch: v0.5.0-9185-gbcc58b9c If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <[email protected]> | Reported-by: Dan Carpenter <[email protected]> | Closes: https://lore.kernel.org/r/[email protected]/ smatch warnings: fs/xfs/xfs_buf.c:498 xfs_buf_find_insert() warn: missing error code 'error' vim +/error +498 fs/xfs/xfs_buf.c 8925a3dc477100 fs/xfs/xfs_buf.c Dave Chinner 2018-04-18 449 ^1da177e4c3f41 fs/xfs/linux-2.6/xfs_buf.c Linus Torvalds 2005-04-16 450 /* 348000804a0f4d fs/xfs/xfs_buf.c Dave Chinner 2022-07-14 451 * Insert the new_bp into the hash table. This consumes the perag reference 348000804a0f4d fs/xfs/xfs_buf.c Dave Chinner 2022-07-14 452 * taken for the lookup regardless of the result of the insert. ^1da177e4c3f41 fs/xfs/linux-2.6/xfs_buf.c Linus Torvalds 2005-04-16 453 */ b027d4c97b9675 fs/xfs/xfs_buf.c Dave Chinner 2018-04-18 454 static int 348000804a0f4d fs/xfs/xfs_buf.c Dave Chinner 2022-07-14 455 xfs_buf_find_insert( e70b73f84f474c fs/xfs/xfs_buf.c Dave Chinner 2012-04-23 456 struct xfs_buftarg *btp, 348000804a0f4d fs/xfs/xfs_buf.c Dave Chinner 2022-07-14 457 struct xfs_buf_map *cmap, 6dde27077eaf59 fs/xfs/xfs_buf.c Dave Chinner 2012-06-22 458 struct xfs_buf_map *map, 6dde27077eaf59 fs/xfs/xfs_buf.c Dave Chinner 2012-06-22 459 int nmaps, 3848b5f6709221 fs/xfs/xfs_buf.c Darrick J. Wong 2020-01-23 460 xfs_buf_flags_t flags, 3848b5f6709221 fs/xfs/xfs_buf.c Darrick J. Wong 2020-01-23 461 struct xfs_buf **bpp) ^1da177e4c3f41 fs/xfs/linux-2.6/xfs_buf.c Linus Torvalds 2005-04-16 462 { 3815832a2aa4df fs/xfs/xfs_buf.c Dave Chinner 2011-09-30 463 struct xfs_buf *new_bp; e82226138b20d4 fs/xfs/xfs_buf.c Dave Chinner 2020-12-16 464 struct xfs_buf *bp; 9bb38aa080394f fs/xfs/xfs_buf.c Shaokun Zhang 2021-06-18 465 int error; ^1da177e4c3f41 fs/xfs/linux-2.6/xfs_buf.c Linus Torvalds 2005-04-16 466 1ec1207722c8bf fs/xfs/xfs_buf.c Christoph Hellwig 2025-03-17 467 error = xfs_buf_alloc(btp, map, nmaps, flags, &new_bp); 32dff5e5d1b588 fs/xfs/xfs_buf.c Darrick J. Wong 2020-01-23 468 if (error) dd0a6bbb4546a7 fs/xfs/xfs_buf.c Christoph Hellwig 2026-06-13 469 return error; ^1da177e4c3f41 fs/xfs/linux-2.6/xfs_buf.c Linus Torvalds 2005-04-16 470 a9ab28b3d21aec fs/xfs/xfs_buf.c Christoph Hellwig 2025-01-28 471 /* The new buffer keeps the perag reference until it is freed. */ dd0a6bbb4546a7 fs/xfs/xfs_buf.c Christoph Hellwig 2026-06-13 472 if (!xfs_buftarg_is_mem(btp)) { dd0a6bbb4546a7 fs/xfs/xfs_buf.c Christoph Hellwig 2026-06-13 473 new_bp->b_pag = xfs_perag_get(btp->bt_mount, dd0a6bbb4546a7 fs/xfs/xfs_buf.c Christoph Hellwig 2026-06-13 474 xfs_daddr_to_agno(btp->bt_mount, cmap->bm_bn)); dd0a6bbb4546a7 fs/xfs/xfs_buf.c Christoph Hellwig 2026-06-13 475 } a9ab28b3d21aec fs/xfs/xfs_buf.c Christoph Hellwig 2025-01-28 476 c69439a891ccb3 fs/xfs/xfs_buf.c Christoph Hellwig 2026-05-18 477 retry: a9ab28b3d21aec fs/xfs/xfs_buf.c Christoph Hellwig 2025-01-28 478 rcu_read_lock(); 497560b9ef42a4 fs/xfs/xfs_buf.c Christoph Hellwig 2026-03-23 479 bp = rhashtable_lookup_get_insert_fast(&btp->bt_hash, 32dd4f9c506b1b fs/xfs/xfs_buf.c Dave Chinner 2022-07-14 480 &new_bp->b_rhash_head, xfs_buf_hash_params); 32dd4f9c506b1b fs/xfs/xfs_buf.c Dave Chinner 2022-07-14 481 if (IS_ERR(bp)) { a9ab28b3d21aec fs/xfs/xfs_buf.c Christoph Hellwig 2025-01-28 482 rcu_read_unlock(); 32dd4f9c506b1b fs/xfs/xfs_buf.c Dave Chinner 2022-07-14 483 error = PTR_ERR(bp); 32dd4f9c506b1b fs/xfs/xfs_buf.c Dave Chinner 2022-07-14 484 goto out_free_buf; 32dd4f9c506b1b fs/xfs/xfs_buf.c Dave Chinner 2022-07-14 485 } c69439a891ccb3 fs/xfs/xfs_buf.c Christoph Hellwig 2026-05-18 486 if (bp) { c69439a891ccb3 fs/xfs/xfs_buf.c Christoph Hellwig 2026-05-18 487 /* c69439a891ccb3 fs/xfs/xfs_buf.c Christoph Hellwig 2026-05-18 488 * If there is an existing buffer with a dead lockref, retry c69439a891ccb3 fs/xfs/xfs_buf.c Christoph Hellwig 2026-05-18 489 * until the new buffer is added, or a usable buffer is found. c69439a891ccb3 fs/xfs/xfs_buf.c Christoph Hellwig 2026-05-18 490 */ c69439a891ccb3 fs/xfs/xfs_buf.c Christoph Hellwig 2026-05-18 491 if (!lockref_get_not_dead(&bp->b_lockref)) { c69439a891ccb3 fs/xfs/xfs_buf.c Christoph Hellwig 2026-05-18 492 rcu_read_unlock(); c69439a891ccb3 fs/xfs/xfs_buf.c Christoph Hellwig 2026-05-18 493 cpu_relax(); c69439a891ccb3 fs/xfs/xfs_buf.c Christoph Hellwig 2026-05-18 494 goto retry; c69439a891ccb3 fs/xfs/xfs_buf.c Christoph Hellwig 2026-05-18 495 } a9ab28b3d21aec fs/xfs/xfs_buf.c Christoph Hellwig 2025-01-28 496 rcu_read_unlock(); 348000804a0f4d fs/xfs/xfs_buf.c Dave Chinner 2022-07-14 497 *bpp = bp; 170041f71596da fs/xfs/xfs_buf.c Christoph Hellwig 2021-06-07 @498 goto out_free_buf; 348000804a0f4d fs/xfs/xfs_buf.c Dave Chinner 2022-07-14 499 } a9ab28b3d21aec fs/xfs/xfs_buf.c Christoph Hellwig 2025-01-28 500 rcu_read_unlock(); ^1da177e4c3f41 fs/xfs/linux-2.6/xfs_buf.c Linus Torvalds 2005-04-16 501 348000804a0f4d fs/xfs/xfs_buf.c Dave Chinner 2022-07-14 502 *bpp = new_bp; 348000804a0f4d fs/xfs/xfs_buf.c Dave Chinner 2022-07-14 503 return 0; 3815832a2aa4df fs/xfs/xfs_buf.c Dave Chinner 2011-09-30 504 348000804a0f4d fs/xfs/xfs_buf.c Dave Chinner 2022-07-14 505 out_free_buf: dd0a6bbb4546a7 fs/xfs/xfs_buf.c Christoph Hellwig 2026-06-13 506 if (new_bp->b_pag) dd0a6bbb4546a7 fs/xfs/xfs_buf.c Christoph Hellwig 2026-06-13 507 xfs_perag_put(new_bp->b_pag); fe2429b0966a7e fs/xfs/xfs_buf.c Dave Chinner 2012-04-23 508 xfs_buf_free(new_bp); de67dc575434dc fs/xfs/xfs_buf.c Dave Chinner 2022-07-14 509 return error; ^1da177e4c3f41 fs/xfs/linux-2.6/xfs_buf.c Linus Torvalds 2005-04-16 510 } ^1da177e4c3f41 fs/xfs/linux-2.6/xfs_buf.c Linus Torvalds 2005-04-16 511 :::::: The code at line 498 was first introduced by commit :::::: 170041f71596dad3f34dea40ee0ef0c848d3f906 xfs: cleanup error handling in xfs_buf_get_map :::::: TO: Christoph Hellwig <[email protected]> :::::: CC: Dave Chinner <[email protected]> -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki