Re: [Cluster-devel] [PATCH 7/7] mm: return an ERR_PTR from __filemap_get_folio

2023-01-21 Thread kernel test robot
Hi Christoph,

I love your patch! Perhaps something to improve:

[auto build test WARNING on next-20230120]
[cannot apply to akpm-mm/mm-everything tytso-ext4/dev kdave/for-next 
xfs-linux/for-next konis-nilfs2/upstream linus/master v6.2-rc4 v6.2-rc3 
v6.2-rc2 v6.2-rc4]
[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/Christoph-Hellwig/mm-make-mapping_get_entry-available-outside-of-filemap-c/20230121-155847
patch link:https://lore.kernel.org/r/20230121065755.1140136-8-hch%40lst.de
patch subject: [PATCH 7/7] mm: return an ERR_PTR from __filemap_get_folio
config: riscv-randconfig-r013-20230119 
(https://download.01.org/0day-ci/archive/20230121/202301211944.5t9l1rga-...@intel.com/config)
compiler: clang version 16.0.0 (https://github.com/llvm/llvm-project 
4196ca3278f78c6e19246e54ab0ecb364e37d66a)
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
# install riscv cross compiling tool for clang build
# apt-get install binutils-riscv-linux-gnu
# 
https://github.com/intel-lab-lkp/linux/commit/3c8a98fd03b82ace84668b3f8bb48d48e9f34af2
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review 
Christoph-Hellwig/mm-make-mapping_get_entry-available-outside-of-filemap-c/20230121-155847
git checkout 3c8a98fd03b82ace84668b3f8bb48d48e9f34af2
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 
O=build_dir ARCH=riscv olddefconfig
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 
O=build_dir ARCH=riscv SHELL=/bin/bash fs/iomap/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot 

All warnings (new ones prefixed by >>):

>> fs/iomap/buffered-io.c:669:28: warning: variable 'folio' is uninitialized 
>> when used here [-Wuninitialized]
   if (pos + len > folio_pos(folio) + folio_size(folio))
 ^
   fs/iomap/buffered-io.c:636:21: note: initialize the variable 'folio' to 
silence this warning
   struct folio *folio;
  ^
   = NULL
   fs/iomap/buffered-io.c:598:22: warning: unused function '__iomap_get_folio' 
[-Wunused-function]
   static struct folio *__iomap_get_folio(struct iomap_iter *iter, loff_t pos,
^
   2 warnings generated.


vim +/folio +669 fs/iomap/buffered-io.c

69f4a26c1e0c7c Gao Xiang   2021-08-03  630  
d7b64041164ca1 Dave Chinner2022-11-29  631  static int 
iomap_write_begin(struct iomap_iter *iter, loff_t pos,
bc6123a84a71b5 Matthew Wilcox (Oracle  2021-05-02  632) size_t 
len, struct folio **foliop)
afc51aaa22f26c Darrick J. Wong 2019-07-15  633  {
471859f57d4253 Andreas Gruenbacher 2023-01-15  634  const struct 
iomap_folio_ops *folio_ops = iter->iomap.folio_ops;
fad0a1ab34f777 Christoph Hellwig   2021-08-10  635  const struct 
iomap *srcmap = iomap_iter_srcmap(iter);
d1bd0b4ebfe052 Matthew Wilcox (Oracle  2021-11-03  636) struct folio 
*folio;
afc51aaa22f26c Darrick J. Wong 2019-07-15  637  int status = 0;
afc51aaa22f26c Darrick J. Wong 2019-07-15  638  
1b5c1e36dc0e0f Christoph Hellwig   2021-08-10  639  BUG_ON(pos + 
len > iter->iomap.offset + iter->iomap.length);
1b5c1e36dc0e0f Christoph Hellwig   2021-08-10  640  if (srcmap != 
&iter->iomap)
c039b997927263 Goldwyn Rodrigues   2019-10-18  641  
BUG_ON(pos + len > srcmap->offset + srcmap->length);
afc51aaa22f26c Darrick J. Wong 2019-07-15  642  
afc51aaa22f26c Darrick J. Wong 2019-07-15  643  if 
(fatal_signal_pending(current))
afc51aaa22f26c Darrick J. Wong 2019-07-15  644  return 
-EINTR;
afc51aaa22f26c Darrick J. Wong 2019-07-15  645  
d454ab82bc7f4a Matthew Wilcox (Oracle  2021-12-09  646) if 
(!mapping_large_folio_support(iter->inode->i_mapping))
d454ab82bc7f4a Matthew Wilcox (Oracle  2021-12-09  647) len = 
min_t(size_t, len, PAGE_SIZE - offset_in_page(pos));
d454ab82bc7f4a Matthew Wilcox (Oracle  2021-12-09  648) 
d7b64041164ca1 Dave Chinner2022-11-29  649  /*
d7b64041164ca1 Dave Chinner2022-11-29  650   * Now we have 
a locked folio, before we do anything with it we need to
d7b64041164ca1 Dave Chinner2022-11-29  651   * check that 
th

Re: [Cluster-devel] [PATCH 7/7] mm: return an ERR_PTR from __filemap_get_folio

2023-01-21 Thread Christoph Hellwig
On Sat, Jan 21, 2023 at 07:52:54PM +0800, kernel test robot wrote:
> Hi Christoph,
> 
> I love your patch! Perhaps something to improve:

And I don't love all this hugging when something doesn't work.  It feels
passive aggressive.

That being said, in this case the error is becaue the series is against
linux-next, so applying it to mainline won't work.



Re: [Cluster-devel] [PATCH] Revert "gfs2: stop using generic_writepages in gfs2_ail1_start_one"

2023-01-21 Thread Christoph Hellwig
> + struct address_space *mapping = data;
> + int ret = mapping->a_ops->writepage(page, wbc);
> + mapping_set_error(mapping, ret);
> + return ret;

I guess beggars can't be choosers, but is there a chance to directly
call the relevant gfs2 writepage methods here instead of the
->writepage call?

Otherwise this looks good:

Acked-by: Christoph Hellwig 



Re: [Cluster-devel] return an ERR_PTR from __filemap_get_folio v2

2023-01-21 Thread Andrew Morton
On Sat, 21 Jan 2023 07:57:48 +0100 Christoph Hellwig  wrote:

> Hi all,
> 
> __filemap_get_folio and its wrappers can return NULL for three different
> conditions, which in some cases requires the caller to reverse engineer
> the decision making.  This is fixed by returning an ERR_PTR instead of
> NULL and thus transporting the reason for the failure.  But to make
> that work we first need to ensure that no xa_value special case is
> returned and thus return the FGP_ENTRY flag.  It turns out that flag
> is barely used and can usually be deal with in a better way.
> 
> Note that the shmem patches in here are non-trivial and need some
> careful review and testing.

I'll hide for a while, awaiting that review.  Plus...

> Changes since v1:
>  - drop the patches to check for errors in btrfs and gfs2
>  - document the new calling conventions for the wrappers around
>__filemap_get_folio
>  - rebased against the iomap changes in latest linux-next

This patchset doesn't apply to fs/btrfs/ because linux-next contains
this 6+ month-old commit:

commit 964688b32d9ada55a7fce2e650d85ef24188f73f
Author: Matthew Wilcox (Oracle) 
AuthorDate: Tue May 17 18:03:27 2022 -0400
Commit: Matthew Wilcox (Oracle) 
CommitDate: Wed Jun 29 08:51:07 2022 -0400

btrfs: Use a folio in wait_dev_supers()


Matthew, what's the story here?



Re: [Cluster-devel] return an ERR_PTR from __filemap_get_folio v2

2023-01-21 Thread Christoph Hellwig
On Sat, Jan 21, 2023 at 05:06:41PM -0800, Andrew Morton wrote:
> This patchset doesn't apply to fs/btrfs/ because linux-next contains
> this 6+ month-old commit:

Hmm.  It was literally written against linux-next as of last morning,
which does not have that commit.