tree: https://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs.git netfs-folio-regions head: 215a4ee495a95cc73256ed76f91cb78bcabd6b8e commit: ec49a6ac065699ec5e4f782529b05681d970dde9 [13/28] netfs: Keep lists of pending, active, dirty and flushed regions config: sh-allmodconfig (attached as .config) compiler: sh4-linux-gcc (GCC) 11.2.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 # https://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs.git/commit/?id=ec49a6ac065699ec5e4f782529b05681d970dde9 git remote add dhowells-fs https://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs.git git fetch --no-tags dhowells-fs netfs-folio-regions git checkout ec49a6ac065699ec5e4f782529b05681d970dde9 # save the attached .config to linux build tree COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross ARCH=sh If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot All errors (new ones prefixed by >>): In file included from include/linux/kernel.h:16, from include/linux/list.h:9, from include/linux/wait.h:7, from include/linux/wait_bit.h:8, from include/linux/fs.h:6, from fs/netfs/write_helper.c:9: fs/netfs/write_helper.c: In function 'copy_folio_from_iter_atomic': include/linux/minmax.h:20:35: warning: comparison of distinct pointer types lacks a cast 20 | (!!(sizeof((typeof(x) *)1 == (typeof(y) *)1))) | ^~ include/linux/minmax.h:26:18: note: in expansion of macro '__typecheck' 26 | (__typecheck(x, y) && __no_side_effects(x, y)) | ^~~~~~~~~~~ include/linux/minmax.h:36:31: note: in expansion of macro '__safe_cmp' 36 | __builtin_choose_expr(__safe_cmp(x, y), \ | ^~~~~~~~~~ include/linux/minmax.h:45:25: note: in expansion of macro '__careful_cmp' 45 | #define min(x, y) __careful_cmp(x, y, <) | ^~~~~~~~~~~~~ fs/netfs/write_helper.c:25:40: note: in expansion of macro 'min' 25 | unsigned int psize = min(PAGE_SIZE - offset, size); | ^~~ fs/netfs/write_helper.c: In function 'netfs_perform_write': >> fs/netfs/write_helper.c:758:25: error: implicit declaration of function 'flush_dcache_folio'; did you mean 'flush_dcache_page'? [-Werror=implicit-function-declaration] 758 | flush_dcache_folio(folio); | ^~~~~~~~~~~~~~~~~~ | flush_dcache_page >> fs/netfs/write_helper.c:784:58: error: 'struct netfs_i_context' has no member named 'cache' 784 | fscache_update_cookie(ctx->cache, NULL); | ^~ cc1: some warnings being treated as errors Kconfig warnings: (for reference only) WARNING: unmet direct dependencies detected for SND_ATMEL_SOC_PDC Depends on SOUND && !UML && SND && SND_SOC && SND_ATMEL_SOC && HAS_DMA Selected by - SND_ATMEL_SOC_SSC && SOUND && !UML && SND && SND_SOC && SND_ATMEL_SOC - SND_ATMEL_SOC_SSC_PDC && SOUND && !UML && SND && SND_SOC && SND_ATMEL_SOC && ATMEL_SSC vim +758 fs/netfs/write_helper.c 680 681 /* 682 * Write data into a prereserved region of the pagecache attached to a netfs 683 * inode. 684 */ 685 static ssize_t netfs_perform_write(struct netfs_dirty_region *region, 686 struct kiocb *iocb, struct iov_iter *i) 687 { 688 struct file *file = iocb->ki_filp; 689 struct netfs_i_context *ctx = netfs_i_context(file_inode(file)); 690 struct folio *folio; 691 ssize_t written = 0, ret; 692 loff_t new_pos, i_size; 693 bool always_fill = false; 694 695 do { 696 size_t plen; 697 size_t offset; /* Offset into pagecache page */ 698 size_t bytes; /* Bytes to write to page */ 699 size_t copied; /* Bytes copied from user */ 700 bool relock = false; 701 702 folio = netfs_grab_folio_for_write(file->f_mapping, 703 region->dirty.end, 704 iov_iter_count(i)); 705 if (!folio) 706 return -ENOMEM; 707 708 plen = folio_size(folio); 709 offset = region->dirty.end - folio_file_pos(folio); 710 bytes = min_t(size_t, plen - offset, iov_iter_count(i)); 711 712 if (!folio_test_uptodate(folio)) { 713 folio_unlock(folio); /* Avoid deadlocking fault-in */ 714 relock = true; 715 } 716 717 /* Bring in the user page that we will copy from _first_. 718 * Otherwise there's a nasty deadlock on copying from the 719 * same page as we're writing to, without it being marked 720 * up-to-date. 721 * 722 * Not only is this an optimisation, but it is also required 723 * to check that the address is actually valid, when atomic 724 * usercopies are used, below. 725 */ 726 if (unlikely(iov_iter_fault_in_readable(i, bytes))) { 727 ret = -EFAULT; 728 goto error_folio; 729 } 730 731 if (fatal_signal_pending(current)) { 732 ret = -EINTR; 733 goto error_folio; 734 } 735 736 if (relock) { 737 ret = folio_lock_killable(folio); 738 if (ret < 0) 739 goto error_folio; 740 } 741 742 redo_prefetch: 743 /* Prefetch area to be written into the cache if we're caching 744 * this file. We need to do this before we get a lock on the 745 * folio in case there's more than one writer competing for the 746 * same cache block. 747 */ 748 if (!folio_test_uptodate(folio)) { 749 ret = netfs_prefetch_for_write(file, folio, region->dirty.end, 750 bytes, always_fill); 751 if (ret < 0) { 752 kdebug("prefetch %zx", ret); 753 goto error_folio; 754 } 755 } 756 757 if (mapping_writably_mapped(folio_file_mapping(folio))) > 758 flush_dcache_folio(folio); 759 copied = copy_folio_from_iter_atomic(folio, offset, bytes, i); 760 flush_dcache_folio(folio); 761 762 /* Deal with a (partially) failed copy */ 763 if (!folio_test_uptodate(folio)) { 764 if (copied == 0) { 765 ret = -EFAULT; 766 goto error_folio; 767 } 768 if (copied < bytes) { 769 iov_iter_revert(i, copied); 770 always_fill = true; 771 goto redo_prefetch; 772 } 773 folio_mark_uptodate(folio); 774 } 775 776 /* Update the inode size if we moved the EOF marker */ 777 new_pos = region->dirty.end + copied; 778 i_size = i_size_read(file_inode(file)); 779 if (new_pos > i_size) { 780 if (ctx->ops->update_i_size) { 781 ctx->ops->update_i_size(file, new_pos); 782 } else { 783 i_size_write(file_inode(file), new_pos); > 784 fscache_update_cookie(ctx->cache, NULL); 785 } 786 } 787 788 /* Update the region appropriately */ 789 if (i_size > region->i_size) 790 region->i_size = i_size; 791 smp_store_release(®ion->dirty.end, new_pos); 792 793 trace_netfs_dirty(ctx, region, NULL, netfs_dirty_trace_modified); 794 folio_mark_dirty(folio); 795 folio_unlock(folio); 796 folio_put(folio); 797 folio = NULL; 798 799 cond_resched(); 800 801 written += copied; 802 803 balance_dirty_pages_ratelimited(file->f_mapping); 804 } while (iov_iter_count(i)); 805 806 out: 807 if (likely(written)) { 808 iocb->ki_pos += written; 809 810 /* Flush and wait for a write that requires immediate synchronisation. */ 811 if (region->type == NETFS_REGION_DSYNC) { 812 kdebug("dsync"); 813 spin_lock(&ctx->lock); 814 netfs_flush_region(ctx, region, netfs_dirty_trace_flush_dsync); 815 spin_unlock(&ctx->lock); 816 817 ret = wait_on_region(region, NETFS_REGION_IS_COMPLETE); 818 if (ret < 0) 819 written = ret; 820 } 821 } 822 823 netfs_commit_write(ctx, region); 824 return written ? written : ret; 825 826 error_folio: 827 folio_unlock(folio); 828 folio_put(folio); 829 goto out; 830 } 831 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org