tree: https://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs.git netfs-folio-regions head: 215a4ee495a95cc73256ed76f91cb78bcabd6b8e commit: 763245c0c72ba51e185586cdaa4646b49ba7f14c [23/28] netfs: Pass initial write into netfs_flush_dirty() config: hexagon-randconfig-r041-20210818 (attached as .config) compiler: clang version 12.0.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=763245c0c72ba51e185586cdaa4646b49ba7f14c 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 763245c0c72ba51e185586cdaa4646b49ba7f14c # save the attached .config to linux build tree mkdir build_dir COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross O=build_dir ARCH=hexagon SHELL=/bin/bash fs/netfs/ If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot All errors (new ones prefixed by >>): fs/netfs/write_back.c:108:22: warning: variable 'region' is uninitialized when used here [-Wuninitialized] if (within(&range, ®ion->dirty)) { ^~~~~~ fs/netfs/write_back.c:98:35: note: initialize the variable 'region' to silence this warning struct netfs_dirty_region *region, *r; ^ = NULL fs/netfs/write_back.c:438:7: warning: variable 'ret' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized] if (!folio_trylock(folio)) ^~~~~~~~~~~~~~~~~~~~~ fs/netfs/write_back.c:442:9: note: uninitialized use occurs here return ret; ^~~ fs/netfs/write_back.c:438:3: note: remove the 'if' if its condition is always true if (!folio_trylock(folio)) ^~~~~~~~~~~~~~~~~~~~~~~~~~ fs/netfs/write_back.c:425:9: note: initialize the variable 'ret' to silence this warning int ret; ^ = 0 fs/netfs/write_back.c:492:22: warning: variable 'region' is uninitialized when used here [-Wuninitialized] if (within(&range, ®ion->dirty)) ^~~~~~ fs/netfs/write_back.c:481:35: note: initialize the variable 'region' to silence this warning struct netfs_dirty_region *region, *r; ^ = NULL >> fs/netfs/write_back.c:1071:1: error: expected statement } ^ 3 warnings and 1 error generated. vim +1071 fs/netfs/write_back.c 763245c0c72ba5 David Howells 2021-08-02 976 763245c0c72ba5 David Howells 2021-08-02 977 /* 763245c0c72ba5 David Howells 2021-08-02 978 * Flush from the front group in the flush FIFO. 763245c0c72ba5 David Howells 2021-08-02 979 */ 763245c0c72ba5 David Howells 2021-08-02 980 static int netfs_flush_group(struct address_space *mapping, bool may_wait) 763245c0c72ba5 David Howells 2021-08-02 981 { 763245c0c72ba5 David Howells 2021-08-02 982 struct netfs_write_request *wreq = NULL; 763245c0c72ba5 David Howells 2021-08-02 983 struct netfs_dirty_region *spares[2] = {}, *head, *r, *wait_for; 763245c0c72ba5 David Howells 2021-08-02 984 struct netfs_flush_group *group; 763245c0c72ba5 David Howells 2021-08-02 985 struct netfs_i_context *ctx = netfs_i_context(mapping->host); 763245c0c72ba5 David Howells 2021-08-02 986 struct netfs_range range; 763245c0c72ba5 David Howells 2021-08-02 987 unsigned int min_bsize = 1U << ctx->min_bshift; 763245c0c72ba5 David Howells 2021-08-02 988 loff_t wait_to; 763245c0c72ba5 David Howells 2021-08-02 989 int ret; 763245c0c72ba5 David Howells 2021-08-02 990 763245c0c72ba5 David Howells 2021-08-02 991 kenter(""); 763245c0c72ba5 David Howells 2021-08-02 992 763245c0c72ba5 David Howells 2021-08-02 993 ret = netfs_sanity_check_ictx(mapping); 763245c0c72ba5 David Howells 2021-08-02 994 if (ret < 0) 763245c0c72ba5 David Howells 2021-08-02 995 return ret; 763245c0c72ba5 David Howells 2021-08-02 996 763245c0c72ba5 David Howells 2021-08-02 997 retry: 763245c0c72ba5 David Howells 2021-08-02 998 if (!wreq) { 763245c0c72ba5 David Howells 2021-08-02 999 ret = -ENOMEM; 763245c0c72ba5 David Howells 2021-08-02 1000 wreq = netfs_alloc_write_request(mapping, false); 763245c0c72ba5 David Howells 2021-08-02 1001 if (!wreq) 763245c0c72ba5 David Howells 2021-08-02 1002 goto out_unlocked; 763245c0c72ba5 David Howells 2021-08-02 1003 } 1e4f2a70cbedd7 David Howells 2021-07-29 1004 763245c0c72ba5 David Howells 2021-08-02 1005 spin_lock(&ctx->lock); 763245c0c72ba5 David Howells 2021-08-02 1006 763245c0c72ba5 David Howells 2021-08-02 1007 group = list_first_entry(&ctx->flush_groups, struct netfs_flush_group, group_link); 763245c0c72ba5 David Howells 2021-08-02 1008 if (list_empty(&group->region_list)) 763245c0c72ba5 David Howells 2021-08-02 1009 goto group_empty; 763245c0c72ba5 David Howells 2021-08-02 1010 763245c0c72ba5 David Howells 2021-08-02 1011 /* We take the first region on the list as a starting point */ 763245c0c72ba5 David Howells 2021-08-02 1012 head = list_first_entry(&group->region_list, struct netfs_dirty_region, flush_link); 763245c0c72ba5 David Howells 2021-08-02 1013 range.start = round_down(head->dirty.start, min_bsize); 763245c0c72ba5 David Howells 2021-08-02 1014 range.end = (unsigned long long)LLONG_MAX + 1; 763245c0c72ba5 David Howells 2021-08-02 1015 kdebug("query D=%x", r->debug_id); 763245c0c72ba5 David Howells 2021-08-02 1016 763245c0c72ba5 David Howells 2021-08-02 1017 ret = netfs_flush_dirty(ctx, head, spares, &range, wreq, &wait_for, &wait_to); 763245c0c72ba5 David Howells 2021-08-02 1018 switch (ret) { 763245c0c72ba5 David Howells 2021-08-02 1019 case -ENOBUFS: 763245c0c72ba5 David Howells 2021-08-02 1020 spin_unlock(&ctx->lock); 763245c0c72ba5 David Howells 2021-08-02 1021 goto need_spares; 763245c0c72ba5 David Howells 2021-08-02 1022 case -EAGAIN: 763245c0c72ba5 David Howells 2021-08-02 1023 if (wait_for) 763245c0c72ba5 David Howells 2021-08-02 1024 goto wait_for_active_region; 763245c0c72ba5 David Howells 2021-08-02 1025 spin_unlock(&ctx->lock); 763245c0c72ba5 David Howells 2021-08-02 1026 goto retry; 763245c0c72ba5 David Howells 2021-08-02 1027 default: 763245c0c72ba5 David Howells 2021-08-02 1028 spin_unlock(&ctx->lock); 763245c0c72ba5 David Howells 2021-08-02 1029 goto out_unlocked; 763245c0c72ba5 David Howells 2021-08-02 1030 case 0: 763245c0c72ba5 David Howells 2021-08-02 1031 spin_unlock(&ctx->lock); 763245c0c72ba5 David Howells 2021-08-02 1032 break; 763245c0c72ba5 David Howells 2021-08-02 1033 } 763245c0c72ba5 David Howells 2021-08-02 1034 763245c0c72ba5 David Howells 2021-08-02 1035 /* TODO: Flush more pieces */ 763245c0c72ba5 David Howells 2021-08-02 1036 763245c0c72ba5 David Howells 2021-08-02 1037 out_unlocked: 763245c0c72ba5 David Howells 2021-08-02 1038 netfs_free_dirty_region(ctx, spares[0]); 763245c0c72ba5 David Howells 2021-08-02 1039 netfs_free_dirty_region(ctx, spares[1]); 763245c0c72ba5 David Howells 2021-08-02 1040 netfs_put_write_request(wreq, false, netfs_wreq_trace_put_discard); 763245c0c72ba5 David Howells 2021-08-02 1041 return ret; 763245c0c72ba5 David Howells 2021-08-02 1042 763245c0c72ba5 David Howells 2021-08-02 1043 wait_for_active_region: 763245c0c72ba5 David Howells 2021-08-02 1044 if (!may_wait) 763245c0c72ba5 David Howells 2021-08-02 1045 return -EBUSY; 763245c0c72ba5 David Howells 2021-08-02 1046 763245c0c72ba5 David Howells 2021-08-02 1047 if (!spares[0] || !spares[1]) 763245c0c72ba5 David Howells 2021-08-02 1048 return -ENOBUFS; 763245c0c72ba5 David Howells 2021-08-02 1049 763245c0c72ba5 David Howells 2021-08-02 1050 netfs_get_dirty_region(ctx, r, netfs_region_trace_get_wait_active); 763245c0c72ba5 David Howells 2021-08-02 1051 spin_unlock(&ctx->lock); 763245c0c72ba5 David Howells 2021-08-02 1052 763245c0c72ba5 David Howells 2021-08-02 1053 wait_var_event(&r->state, (READ_ONCE(r->state) != NETFS_REGION_IS_ACTIVE || 763245c0c72ba5 David Howells 2021-08-02 1054 READ_ONCE(r->dirty.end) != wait_to)); 763245c0c72ba5 David Howells 2021-08-02 1055 netfs_put_dirty_region(ctx, r, netfs_region_trace_put_wait_active); 1e4f2a70cbedd7 David Howells 2021-07-29 1056 need_spares: 1e4f2a70cbedd7 David Howells 2021-07-29 1057 ret = -ENOMEM; 763245c0c72ba5 David Howells 2021-08-02 1058 if (!spares[0]) { 1e4f2a70cbedd7 David Howells 2021-07-29 1059 spares[0] = netfs_alloc_dirty_region(); 1e4f2a70cbedd7 David Howells 2021-07-29 1060 if (!spares[0]) 1e4f2a70cbedd7 David Howells 2021-07-29 1061 goto out_unlocked; 763245c0c72ba5 David Howells 2021-08-02 1062 } 763245c0c72ba5 David Howells 2021-08-02 1063 if (!spares[1]) { 1e4f2a70cbedd7 David Howells 2021-07-29 1064 spares[1] = netfs_alloc_dirty_region(); 1e4f2a70cbedd7 David Howells 2021-07-29 1065 if (!spares[1]) 1e4f2a70cbedd7 David Howells 2021-07-29 1066 goto out_unlocked; 763245c0c72ba5 David Howells 2021-08-02 1067 } 1e4f2a70cbedd7 David Howells 2021-07-29 1068 goto retry; 763245c0c72ba5 David Howells 2021-08-02 1069 763245c0c72ba5 David Howells 2021-08-02 1070 group_empty: 1e4f2a70cbedd7 David Howells 2021-07-29 @1071 } 1e4f2a70cbedd7 David Howells 2021-07-29 1072 :::::: The code at line 1071 was first introduced by commit :::::: 1e4f2a70cbedd75d80440425727faa78e2dccb93 netfs: Cut out region to be written from dirty regions :::::: TO: David Howells :::::: CC: David Howells --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org