[hch-xfs:xfs-crc 21/59] fs/xfs/xfs_ioend.c:37 xfs_dio_bounce_end_io() warn: bitwise AND condition is false here

kernel test robot <[email protected]> Sun, 26 Jul 2026 12:09:55 +0800
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:   10c7aa6f2c85085eec34737be592d6ae69583782
commit: 763c79ce5f43500edfe848e62f5cfffc4329e5b9 [21/59] xfs: add support for lazy direct read bounce buffering
:::::: branch date: 2 days ago
:::::: commit date: 2 days ago
config: x86_64-randconfig-161-20260725 (https://download.01.org/0day-ci/archive/20260726/[email protected]/config)
compiler: gcc-14 (Debian 14.2.0-19) 14.2.0
smatch: v0.5.0-9187-g5189e3fb

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]/

New smatch warnings:
fs/xfs/xfs_ioend.c:37 xfs_dio_bounce_end_io() warn: bitwise AND condition is false here
fs/xfs/xfs_ioend.c:46 xfs_bounce_submit_ioend() warn: bitwise AND condition is false here
fs/xfs/xfs_ioend.c:67 xfs_read_bounce_and_resubmit() warn: bitwise AND condition is false here

Old smatch warnings:
fs/xfs/xfs_ioend.c:97 xfs_end_io_read() warn: bitwise AND condition is false here
fs/xfs/xfs_ioend.c:135 xfs_ioend_submit_read() warn: bitwise AND condition is false here

vim +37 fs/xfs/xfs_ioend.c

763c79ce5f4350 Christoph Hellwig 2026-07-22  28  
763c79ce5f4350 Christoph Hellwig 2026-07-22  29  static void
763c79ce5f4350 Christoph Hellwig 2026-07-22  30  xfs_dio_bounce_end_io(
763c79ce5f4350 Christoph Hellwig 2026-07-22  31  	struct bio		*bio)
763c79ce5f4350 Christoph Hellwig 2026-07-22  32  {
763c79ce5f4350 Christoph Hellwig 2026-07-22  33  	struct iomap_ioend	*ioend = iomap_ioend_from_bio(bio);
763c79ce5f4350 Christoph Hellwig 2026-07-22  34  	int			error = blk_status_to_errno(bio->bi_status);
763c79ce5f4350 Christoph Hellwig 2026-07-22  35  	struct bio		*orig_bio = bio->bi_private;
763c79ce5f4350 Christoph Hellwig 2026-07-22  36  
763c79ce5f4350 Christoph Hellwig 2026-07-22 @37  	if ((ioend->io_flags & IOMAP_IOEND_INTEGRITY) && !bio->bi_status)
763c79ce5f4350 Christoph Hellwig 2026-07-22  38  		error = iomap_ioend_integrity_verify(ioend);
763c79ce5f4350 Christoph Hellwig 2026-07-22  39  	iomap_bounce_read_end_io(ioend, orig_bio, error);
763c79ce5f4350 Christoph Hellwig 2026-07-22  40  }
763c79ce5f4350 Christoph Hellwig 2026-07-22  41  
763c79ce5f4350 Christoph Hellwig 2026-07-22  42  static void
763c79ce5f4350 Christoph Hellwig 2026-07-22  43  xfs_bounce_submit_ioend(
763c79ce5f4350 Christoph Hellwig 2026-07-22  44  	struct iomap_ioend	*ioend)
763c79ce5f4350 Christoph Hellwig 2026-07-22  45  {
763c79ce5f4350 Christoph Hellwig 2026-07-22 @46  	if (ioend->io_flags & IOMAP_IOEND_INTEGRITY)
763c79ce5f4350 Christoph Hellwig 2026-07-22  47  		fs_bio_integrity_alloc(&ioend->io_bio);
763c79ce5f4350 Christoph Hellwig 2026-07-22  48  	ioend->io_bio.bi_end_io = xfs_dio_bounce_end_io;
763c79ce5f4350 Christoph Hellwig 2026-07-22  49  	bio_set_flag(&ioend->io_bio, BIO_COMPLETE_IN_TASK);
763c79ce5f4350 Christoph Hellwig 2026-07-22  50  	submit_bio(&ioend->io_bio);
763c79ce5f4350 Christoph Hellwig 2026-07-22  51  }
763c79ce5f4350 Christoph Hellwig 2026-07-22  52  
763c79ce5f4350 Christoph Hellwig 2026-07-22  53  static void
763c79ce5f4350 Christoph Hellwig 2026-07-22  54  xfs_read_bounce_and_resubmit(
763c79ce5f4350 Christoph Hellwig 2026-07-22  55  	struct iomap_ioend	*ioend)
763c79ce5f4350 Christoph Hellwig 2026-07-22  56  {
763c79ce5f4350 Christoph Hellwig 2026-07-22  57  	struct bio		*bio = &ioend->io_bio;
763c79ce5f4350 Christoph Hellwig 2026-07-22  58  
763c79ce5f4350 Christoph Hellwig 2026-07-22  59  	trace_xfs_bounce_reread(XFS_I(ioend->io_inode), ioend->io_offset,
763c79ce5f4350 Christoph Hellwig 2026-07-22  60  			ioend->io_size);
763c79ce5f4350 Christoph Hellwig 2026-07-22  61  
763c79ce5f4350 Christoph Hellwig 2026-07-22  62  	/*
763c79ce5f4350 Christoph Hellwig 2026-07-22  63  	 * Free the bio integrity data for the original bio, as we'll allocate
763c79ce5f4350 Christoph Hellwig 2026-07-22  64  	 * ons for each sub-I/O, which could deadlock if we keep the original
763c79ce5f4350 Christoph Hellwig 2026-07-22  65  	 * one around.
763c79ce5f4350 Christoph Hellwig 2026-07-22  66  	 */
763c79ce5f4350 Christoph Hellwig 2026-07-22 @67  	if (ioend->io_flags & IOMAP_IOEND_INTEGRITY)
763c79ce5f4350 Christoph Hellwig 2026-07-22  68  		fs_bio_integrity_free(bio);
763c79ce5f4350 Christoph Hellwig 2026-07-22  69  
763c79ce5f4350 Christoph Hellwig 2026-07-22  70  	/*
763c79ce5f4350 Christoph Hellwig 2026-07-22  71  	 * Reset the remaining count, iter and bdev as we submit the bio to the
763c79ce5f4350 Christoph Hellwig 2026-07-22  72  	 * block layer again and we need a clean slate.  Switch to and end_io
763c79ce5f4350 Christoph Hellwig 2026-07-22  73  	 * handler that simply complets the ioend, as all the verification is
763c79ce5f4350 Christoph Hellwig 2026-07-22  74  	 * done by the end_I/O handlers for the clone bio(s).
763c79ce5f4350 Christoph Hellwig 2026-07-22  75  	 */
763c79ce5f4350 Christoph Hellwig 2026-07-22  76  	atomic_set(&bio->__bi_remaining, 1);
763c79ce5f4350 Christoph Hellwig 2026-07-22  77  	bio->bi_iter = (struct bvec_iter) {
763c79ce5f4350 Christoph Hellwig 2026-07-22  78  		.bi_sector	= ioend->io_sector,
763c79ce5f4350 Christoph Hellwig 2026-07-22  79  		.bi_size	= ioend->io_size,
763c79ce5f4350 Christoph Hellwig 2026-07-22  80  		.bi_bvec_done	= ioend->io_bvec_offset,
763c79ce5f4350 Christoph Hellwig 2026-07-22  81  	};
763c79ce5f4350 Christoph Hellwig 2026-07-22  82  	bio->bi_bdev = xfs_inode_buftarg(XFS_I(ioend->io_inode))->bt_bdev;
763c79ce5f4350 Christoph Hellwig 2026-07-22  83  	bio->bi_end_io = xfs_end_bio_bounced;
763c79ce5f4350 Christoph Hellwig 2026-07-22  84  	iomap_bounce_read(ioend, bdev_logical_block_size(bio->bi_bdev),
763c79ce5f4350 Christoph Hellwig 2026-07-22  85  			xfs_bounce_submit_ioend);
763c79ce5f4350 Christoph Hellwig 2026-07-22  86  }
763c79ce5f4350 Christoph Hellwig 2026-07-22  87  

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki