Re: [PATCH v5 03/11] fuse: refactor fuse_fill_write_pages()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Apr 27, 2025 at 10:32 PM Dan Carpenter <dan.carpenter@xxxxxxxxxx> wrote:
>
> Hi Joanne,
>
> kernel test robot noticed the following build warnings:
>
> https://git-scm.com/docs/git-format-patch#_base_tree_information]
>
> url:    https://github.com/intel-lab-lkp/linux/commits/Joanne-Koong/fuse-support-copying-large-folios/20250426-081219
> base:   https://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/fuse.git for-next
> patch link:    https://lore.kernel.org/r/20250426000828.3216220-4-joannelkoong%40gmail.com
> patch subject: [PATCH v5 03/11] fuse: refactor fuse_fill_write_pages()
> config: i386-randconfig-141-20250426 (https://download.01.org/0day-ci/archive/20250427/202504270319.GmkEM1Xg-lkp@xxxxxxxxx/config)
> compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
>
> 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>
> | Reported-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
> | Closes: https://lore.kernel.org/r/202504270319.GmkEM1Xg-lkp@xxxxxxxxx/
>
> smatch warnings:
> fs/fuse/file.c:1207 fuse_fill_write_pages() error: uninitialized symbol 'err'.
>
> vim +/err +1207 fs/fuse/file.c
>
> 4f06dd92b5d0a6 Vivek Goyal        2020-10-21  1127  static ssize_t fuse_fill_write_pages(struct fuse_io_args *ia,
> ea9b9907b82a09 Nicholas Piggin    2008-04-30  1128                                   struct address_space *mapping,
> 338f2e3f3341a9 Miklos Szeredi     2019-09-10  1129                                   struct iov_iter *ii, loff_t pos,
> 338f2e3f3341a9 Miklos Szeredi     2019-09-10  1130                                   unsigned int max_pages)
> ea9b9907b82a09 Nicholas Piggin    2008-04-30  1131  {
> 4f06dd92b5d0a6 Vivek Goyal        2020-10-21  1132      struct fuse_args_pages *ap = &ia->ap;
> ea9b9907b82a09 Nicholas Piggin    2008-04-30  1133      struct fuse_conn *fc = get_fuse_conn(mapping->host);
> 09cbfeaf1a5a67 Kirill A. Shutemov 2016-04-01  1134      unsigned offset = pos & (PAGE_SIZE - 1);
> ea9b9907b82a09 Nicholas Piggin    2008-04-30  1135      size_t count = 0;
> dfda790dfda452 Joanne Koong       2025-04-25  1136      unsigned int num;
> ea9b9907b82a09 Nicholas Piggin    2008-04-30  1137      int err;
> ea9b9907b82a09 Nicholas Piggin    2008-04-30  1138
> dfda790dfda452 Joanne Koong       2025-04-25  1139      num = min(iov_iter_count(ii), fc->max_write);
>
> Can iov_iter_count() return zero here?
>
> dfda790dfda452 Joanne Koong       2025-04-25  1140      num = min(num, max_pages << PAGE_SHIFT);
> dfda790dfda452 Joanne Koong       2025-04-25  1141
> 338f2e3f3341a9 Miklos Szeredi     2019-09-10  1142      ap->args.in_pages = true;
> 68bfb7eb7f7de3 Joanne Koong       2024-10-24  1143      ap->descs[0].offset = offset;
> ea9b9907b82a09 Nicholas Piggin    2008-04-30  1144
> dfda790dfda452 Joanne Koong       2025-04-25  1145      while (num) {
> ea9b9907b82a09 Nicholas Piggin    2008-04-30  1146              size_t tmp;
> 9bafbe7ae01321 Josef Bacik        2024-09-30  1147              struct folio *folio;
> 09cbfeaf1a5a67 Kirill A. Shutemov 2016-04-01  1148              pgoff_t index = pos >> PAGE_SHIFT;
> dfda790dfda452 Joanne Koong       2025-04-25  1149              unsigned bytes = min(PAGE_SIZE - offset, num);
> ea9b9907b82a09 Nicholas Piggin    2008-04-30  1150
> ea9b9907b82a09 Nicholas Piggin    2008-04-30  1151   again:
> 9bafbe7ae01321 Josef Bacik        2024-09-30  1152              folio = __filemap_get_folio(mapping, index, FGP_WRITEBEGIN,
> 9bafbe7ae01321 Josef Bacik        2024-09-30  1153                                          mapping_gfp_mask(mapping));
> 9bafbe7ae01321 Josef Bacik        2024-09-30  1154              if (IS_ERR(folio)) {
> 9bafbe7ae01321 Josef Bacik        2024-09-30  1155                      err = PTR_ERR(folio);
> ea9b9907b82a09 Nicholas Piggin    2008-04-30  1156                      break;
> 9bafbe7ae01321 Josef Bacik        2024-09-30  1157              }
> ea9b9907b82a09 Nicholas Piggin    2008-04-30  1158
> 931e80e4b3263d anfei zhou         2010-02-02  1159              if (mapping_writably_mapped(mapping))
> 9bafbe7ae01321 Josef Bacik        2024-09-30  1160                      flush_dcache_folio(folio);
> 931e80e4b3263d anfei zhou         2010-02-02  1161
> 9bafbe7ae01321 Josef Bacik        2024-09-30  1162              tmp = copy_folio_from_iter_atomic(folio, offset, bytes, ii);
> 9bafbe7ae01321 Josef Bacik        2024-09-30  1163              flush_dcache_folio(folio);
> ea9b9907b82a09 Nicholas Piggin    2008-04-30  1164
> ea9b9907b82a09 Nicholas Piggin    2008-04-30  1165              if (!tmp) {
> 9bafbe7ae01321 Josef Bacik        2024-09-30  1166                      folio_unlock(folio);
> 9bafbe7ae01321 Josef Bacik        2024-09-30  1167                      folio_put(folio);
> faa794dd2e17e7 Dave Hansen        2025-01-29  1168
> faa794dd2e17e7 Dave Hansen        2025-01-29  1169                      /*
> faa794dd2e17e7 Dave Hansen        2025-01-29  1170                       * Ensure forward progress by faulting in
> faa794dd2e17e7 Dave Hansen        2025-01-29  1171                       * while not holding the folio lock:
> faa794dd2e17e7 Dave Hansen        2025-01-29  1172                       */
> faa794dd2e17e7 Dave Hansen        2025-01-29  1173                      if (fault_in_iov_iter_readable(ii, bytes)) {
> faa794dd2e17e7 Dave Hansen        2025-01-29  1174                              err = -EFAULT;
> faa794dd2e17e7 Dave Hansen        2025-01-29  1175                              break;
> faa794dd2e17e7 Dave Hansen        2025-01-29  1176                      }
> faa794dd2e17e7 Dave Hansen        2025-01-29  1177
> ea9b9907b82a09 Nicholas Piggin    2008-04-30  1178                      goto again;
> ea9b9907b82a09 Nicholas Piggin    2008-04-30  1179              }
> ea9b9907b82a09 Nicholas Piggin    2008-04-30  1180
> ea9b9907b82a09 Nicholas Piggin    2008-04-30  1181              err = 0;
> f2ef459bab7326 Joanne Koong       2024-10-24  1182              ap->folios[ap->num_folios] = folio;
> 68bfb7eb7f7de3 Joanne Koong       2024-10-24  1183              ap->descs[ap->num_folios].length = tmp;
> f2ef459bab7326 Joanne Koong       2024-10-24  1184              ap->num_folios++;
> ea9b9907b82a09 Nicholas Piggin    2008-04-30  1185
> ea9b9907b82a09 Nicholas Piggin    2008-04-30  1186              count += tmp;
> ea9b9907b82a09 Nicholas Piggin    2008-04-30  1187              pos += tmp;
> dfda790dfda452 Joanne Koong       2025-04-25  1188              num -= tmp;
> ea9b9907b82a09 Nicholas Piggin    2008-04-30  1189              offset += tmp;
> 09cbfeaf1a5a67 Kirill A. Shutemov 2016-04-01  1190              if (offset == PAGE_SIZE)
> ea9b9907b82a09 Nicholas Piggin    2008-04-30  1191                      offset = 0;
> ea9b9907b82a09 Nicholas Piggin    2008-04-30  1192
> 4f06dd92b5d0a6 Vivek Goyal        2020-10-21  1193              /* If we copied full page, mark it uptodate */
> 4f06dd92b5d0a6 Vivek Goyal        2020-10-21  1194              if (tmp == PAGE_SIZE)
> 9bafbe7ae01321 Josef Bacik        2024-09-30  1195                      folio_mark_uptodate(folio);
> 4f06dd92b5d0a6 Vivek Goyal        2020-10-21  1196
> 9bafbe7ae01321 Josef Bacik        2024-09-30  1197              if (folio_test_uptodate(folio)) {
> 9bafbe7ae01321 Josef Bacik        2024-09-30  1198                      folio_unlock(folio);
> 4f06dd92b5d0a6 Vivek Goyal        2020-10-21  1199              } else {
> f2ef459bab7326 Joanne Koong       2024-10-24  1200                      ia->write.folio_locked = true;
> 4f06dd92b5d0a6 Vivek Goyal        2020-10-21  1201                      break;
> 4f06dd92b5d0a6 Vivek Goyal        2020-10-21  1202              }
> dfda790dfda452 Joanne Koong       2025-04-25  1203              if (!fc->big_writes || offset != 0)
> 78bb6cb9a890d3 Miklos Szeredi     2008-05-12  1204                      break;
> dfda790dfda452 Joanne Koong       2025-04-25  1205      }
> ea9b9907b82a09 Nicholas Piggin    2008-04-30  1206
> ea9b9907b82a09 Nicholas Piggin    2008-04-30 @1207      return count > 0 ? count : err;
> ea9b9907b82a09 Nicholas Piggin    2008-04-30  1208  }
>

I'll initialize err to 0 in v6. I'll wait for more reviews/comments on
the patchset before sending that out.

Thanks,
Joanne

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





[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux