Hi Matthew, kernel test robot noticed the following build warnings: [auto build test WARNING on mszeredi-fuse/for-next] [also build test WARNING on linus/master v6.16-rc4 next-20250703] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Matthew-Wilcox-Oracle/fuse-Use-filemap_invalidate_pages/20250704-032629 base: https://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/fuse.git for-next patch link: https://lore.kernel.org/r/20250703192459.3381327-2-willy%40infradead.org patch subject: [PATCH 1/1] fuse: Use filemap_invalidate_pages() config: microblaze-randconfig-r073-20250704 (https://download.01.org/0day-ci/archive/20250704/202507041729.OkMQMi8u-lkp@xxxxxxxxx/config) compiler: microblaze-linux-gcc (GCC) 8.5.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250704/202507041729.OkMQMi8u-lkp@xxxxxxxxx/reproduce) 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 <lkp@xxxxxxxxx> | Closes: https://lore.kernel.org/oe-kbuild-all/202507041729.OkMQMi8u-lkp@xxxxxxxxx/ All warnings (new ones prefixed by >>): fs/fuse/file.c: In function 'fuse_direct_io': >> fs/fuse/file.c:1557:10: warning: unused variable 'idx_to' [-Wunused-variable] pgoff_t idx_to = (pos + count - 1) >> PAGE_SHIFT; ^~~~~~ >> fs/fuse/file.c:1556:10: warning: unused variable 'idx_from' [-Wunused-variable] pgoff_t idx_from = pos >> PAGE_SHIFT; ^~~~~~~~ vim +/idx_to +1557 fs/fuse/file.c 413ef8cb302511 Miklos Szeredi 2005-09-09 1542 d22a943f44c79c Al Viro 2014-03-16 1543 ssize_t fuse_direct_io(struct fuse_io_priv *io, struct iov_iter *iter, d22a943f44c79c Al Viro 2014-03-16 1544 loff_t *ppos, int flags) 413ef8cb302511 Miklos Szeredi 2005-09-09 1545 { ea8cd33390fafc Pavel Emelyanov 2013-10-10 1546 int write = flags & FUSE_DIO_WRITE; ea8cd33390fafc Pavel Emelyanov 2013-10-10 1547 int cuse = flags & FUSE_DIO_CUSE; e1c0eecba1a415 Miklos Szeredi 2017-09-12 1548 struct file *file = io->iocb->ki_filp; 80e4f25262f9f1 Hao Xu 2023-08-01 1549 struct address_space *mapping = file->f_mapping; 80e4f25262f9f1 Hao Xu 2023-08-01 1550 struct inode *inode = mapping->host; 2106cb18930312 Miklos Szeredi 2009-04-28 1551 struct fuse_file *ff = file->private_data; fcee216beb9c15 Max Reitz 2020-05-06 1552 struct fuse_conn *fc = ff->fm->fc; 413ef8cb302511 Miklos Szeredi 2005-09-09 1553 size_t nmax = write ? fc->max_write : fc->max_read; 413ef8cb302511 Miklos Szeredi 2005-09-09 1554 loff_t pos = *ppos; d22a943f44c79c Al Viro 2014-03-16 1555 size_t count = iov_iter_count(iter); 09cbfeaf1a5a67 Kirill A. Shutemov 2016-04-01 @1556 pgoff_t idx_from = pos >> PAGE_SHIFT; 09cbfeaf1a5a67 Kirill A. Shutemov 2016-04-01 @1557 pgoff_t idx_to = (pos + count - 1) >> PAGE_SHIFT; 413ef8cb302511 Miklos Szeredi 2005-09-09 1558 ssize_t res = 0; 742f992708dff0 Ashish Samant 2016-03-14 1559 int err = 0; 45ac96ed7c3691 Miklos Szeredi 2019-09-10 1560 struct fuse_io_args *ia; 45ac96ed7c3691 Miklos Szeredi 2019-09-10 1561 unsigned int max_pages; 80e4f25262f9f1 Hao Xu 2023-08-01 1562 bool fopen_direct_io = ff->open_flags & FOPEN_DIRECT_IO; 248d86e87d12da Miklos Szeredi 2006-01-06 1563 45ac96ed7c3691 Miklos Szeredi 2019-09-10 1564 max_pages = iov_iter_npages(iter, fc->max_pages); 68bfb7eb7f7de3 Joanne Koong 2024-10-24 1565 ia = fuse_io_alloc(io, max_pages); 45ac96ed7c3691 Miklos Szeredi 2019-09-10 1566 if (!ia) 45ac96ed7c3691 Miklos Szeredi 2019-09-10 1567 return -ENOMEM; 413ef8cb302511 Miklos Szeredi 2005-09-09 1568 c55e0a55b16520 Tyler Fanelli 2023-09-19 1569 if (fopen_direct_io && fc->direct_io_allow_mmap) { 147c1229fcb032 Matthew Wilcox (Oracle 2025-07-03 1570) res = filemap_invalidate_pages(mapping, pos, (pos + count - 1), 147c1229fcb032 Matthew Wilcox (Oracle 2025-07-03 1571) false); b5a2a3a0b77668 Hao Xu 2023-08-01 1572 if (res) { 68bfb7eb7f7de3 Joanne Koong 2024-10-24 1573 fuse_io_free(ia); b5a2a3a0b77668 Hao Xu 2023-08-01 1574 return res; b5a2a3a0b77668 Hao Xu 2023-08-01 1575 } b5a2a3a0b77668 Hao Xu 2023-08-01 1576 } 0c58a97f919c24 Joanne Koong 2025-04-14 1577 if (!cuse && filemap_range_has_writeback(mapping, pos, (pos + count - 1))) { ea8cd33390fafc Pavel Emelyanov 2013-10-10 1578 if (!write) 5955102c9984fa Al Viro 2016-01-22 1579 inode_lock(inode); ea8cd33390fafc Pavel Emelyanov 2013-10-10 1580 fuse_sync_writes(inode); ea8cd33390fafc Pavel Emelyanov 2013-10-10 1581 if (!write) 5955102c9984fa Al Viro 2016-01-22 1582 inode_unlock(inode); ea8cd33390fafc Pavel Emelyanov 2013-10-10 1583 } ea8cd33390fafc Pavel Emelyanov 2013-10-10 1584 fcb14cb1bdacec Al Viro 2022-05-22 1585 io->should_dirty = !write && user_backed_iter(iter); 413ef8cb302511 Miklos Szeredi 2005-09-09 1586 while (count) { 45ac96ed7c3691 Miklos Szeredi 2019-09-10 1587 ssize_t nres; 2106cb18930312 Miklos Szeredi 2009-04-28 1588 fl_owner_t owner = current->files; f4975c67dd9ad8 Miklos Szeredi 2009-04-02 1589 size_t nbytes = min(count, nmax); 45ac96ed7c3691 Miklos Szeredi 2019-09-10 1590 45ac96ed7c3691 Miklos Szeredi 2019-09-10 1591 err = fuse_get_user_pages(&ia->ap, iter, &nbytes, write, 41748675c0bf25 Hou Tao 2024-08-31 1592 max_pages, fc->use_pages_for_kvec_io); 742f992708dff0 Ashish Samant 2016-03-14 1593 if (err && !nbytes) 413ef8cb302511 Miklos Szeredi 2005-09-09 1594 break; f4975c67dd9ad8 Miklos Szeredi 2009-04-02 1595 4a2abf99f9c287 Miklos Szeredi 2019-05-27 1596 if (write) { 45ac96ed7c3691 Miklos Szeredi 2019-09-10 1597 if (!capable(CAP_FSETID)) 10c52c84e3f487 Miklos Szeredi 2020-11-11 1598 ia->write.in.write_flags |= FUSE_WRITE_KILL_SUIDGID; 4a2abf99f9c287 Miklos Szeredi 2019-05-27 1599 45ac96ed7c3691 Miklos Szeredi 2019-09-10 1600 nres = fuse_send_write(ia, pos, nbytes, owner); 4a2abf99f9c287 Miklos Szeredi 2019-05-27 1601 } else { 45ac96ed7c3691 Miklos Szeredi 2019-09-10 1602 nres = fuse_send_read(ia, pos, nbytes, owner); 4a2abf99f9c287 Miklos Szeredi 2019-05-27 1603 } 2106cb18930312 Miklos Szeredi 2009-04-28 1604 45ac96ed7c3691 Miklos Szeredi 2019-09-10 1605 if (!io->async || nres < 0) { 41748675c0bf25 Hou Tao 2024-08-31 1606 fuse_release_user_pages(&ia->ap, nres, io->should_dirty); 68bfb7eb7f7de3 Joanne Koong 2024-10-24 1607 fuse_io_free(ia); 45ac96ed7c3691 Miklos Szeredi 2019-09-10 1608 } 45ac96ed7c3691 Miklos Szeredi 2019-09-10 1609 ia = NULL; 45ac96ed7c3691 Miklos Szeredi 2019-09-10 1610 if (nres < 0) { f658adeea45e43 Miklos Szeredi 2020-02-06 1611 iov_iter_revert(iter, nbytes); 45ac96ed7c3691 Miklos Szeredi 2019-09-10 1612 err = nres; 413ef8cb302511 Miklos Szeredi 2005-09-09 1613 break; 413ef8cb302511 Miklos Szeredi 2005-09-09 1614 } 45ac96ed7c3691 Miklos Szeredi 2019-09-10 1615 WARN_ON(nres > nbytes); 45ac96ed7c3691 Miklos Szeredi 2019-09-10 1616 413ef8cb302511 Miklos Szeredi 2005-09-09 1617 count -= nres; 413ef8cb302511 Miklos Szeredi 2005-09-09 1618 res += nres; 413ef8cb302511 Miklos Szeredi 2005-09-09 1619 pos += nres; f658adeea45e43 Miklos Szeredi 2020-02-06 1620 if (nres != nbytes) { f658adeea45e43 Miklos Szeredi 2020-02-06 1621 iov_iter_revert(iter, nbytes - nres); 413ef8cb302511 Miklos Szeredi 2005-09-09 1622 break; f658adeea45e43 Miklos Szeredi 2020-02-06 1623 } 56cf34ff079569 Miklos Szeredi 2006-04-11 1624 if (count) { 45ac96ed7c3691 Miklos Szeredi 2019-09-10 1625 max_pages = iov_iter_npages(iter, fc->max_pages); 68bfb7eb7f7de3 Joanne Koong 2024-10-24 1626 ia = fuse_io_alloc(io, max_pages); 45ac96ed7c3691 Miklos Szeredi 2019-09-10 1627 if (!ia) 56cf34ff079569 Miklos Szeredi 2006-04-11 1628 break; 56cf34ff079569 Miklos Szeredi 2006-04-11 1629 } 413ef8cb302511 Miklos Szeredi 2005-09-09 1630 } 45ac96ed7c3691 Miklos Szeredi 2019-09-10 1631 if (ia) 68bfb7eb7f7de3 Joanne Koong 2024-10-24 1632 fuse_io_free(ia); d09cb9d7f6e4cb Miklos Szeredi 2009-04-28 1633 if (res > 0) 413ef8cb302511 Miklos Szeredi 2005-09-09 1634 *ppos = pos; 413ef8cb302511 Miklos Szeredi 2005-09-09 1635 742f992708dff0 Ashish Samant 2016-03-14 1636 return res > 0 ? res : err; 413ef8cb302511 Miklos Szeredi 2005-09-09 1637 } 08cbf542bf24fb Tejun Heo 2009-04-14 1638 EXPORT_SYMBOL_GPL(fuse_direct_io); 413ef8cb302511 Miklos Szeredi 2005-09-09 1639 -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki