linux/fs/fuse
Miklos Szeredi c146024ec4 fuse: fix warning in tree_insert() and clean up writepage insertion
fuse_writepages_fill() calls tree_insert() with ap->num_pages = 0 which
triggers the following warning:

 WARNING: CPU: 1 PID: 17211 at fs/fuse/file.c:1728 tree_insert+0xab/0xc0 [fuse]
 RIP: 0010:tree_insert+0xab/0xc0 [fuse]
 Call Trace:
  fuse_writepages_fill+0x5da/0x6a0 [fuse]
  write_cache_pages+0x171/0x470
  fuse_writepages+0x8a/0x100 [fuse]
  do_writepages+0x43/0xe0

Fix up the warning and clean up the code around rb-tree insertion:

 - Rename tree_insert() to fuse_insert_writeback() and make it return the
   conflicting entry in case of failure

 - Re-add tree_insert() as a wrapper around fuse_insert_writeback()

 - Rename fuse_writepage_in_flight() to fuse_writepage_add() and reverse
   the meaning of the return value to mean

    + "true" in case the writepage entry was successfully added

    + "false" in case it was in-fligt queued on an existing writepage
       entry's auxiliary list or the existing writepage entry's temporary
       page updated

   Switch from fuse_find_writeback() + tree_insert() to
   fuse_insert_writeback()

 - Move setting orig_pages to before inserting/updating the entry; this may
   result in the orig_pages value being discarded later in case of an
   in-flight request

 - In case of a new writepage entry use fuse_writepage_add()
   unconditionally, only set data->wpa if the entry was added.

Fixes: 6b2fb79963 ("fuse: optimize writepages search")
Reported-by: kernel test robot <rong.a.chen@intel.com>
Original-path-by: Vasily Averin <vvs@virtuozzo.com>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
2020-07-14 14:45:41 +02:00
..
acl.c fuse: Support fuse filesystems outside of init_user_ns 2018-03-20 17:11:44 +01:00
control.c convenience helper: get_tree_single() 2019-07-04 22:01:58 -04:00
cuse.c fuse: use true,false for bool variable 2020-02-06 16:39:28 +01:00
dev.c fuse update for 5.8 2020-06-09 15:48:24 -07:00
dir.c fuse: always allow query of st_dev 2020-05-19 14:50:37 +02:00
file.c fuse: fix warning in tree_insert() and clean up writepage insertion 2020-07-14 14:45:41 +02:00
fuse_i.h fuse: optimize writepages search 2020-05-19 14:50:38 +02:00
inode.c fuse: update attr_version counter on fuse_notify_inval_inode() 2020-05-19 14:50:38 +02:00
Kconfig docs: fix broken references to text files 2020-04-20 15:35:59 -06:00
Makefile virtio-fs: Change module name to virtiofs.ko 2019-10-14 10:20:33 +02:00
readdir.c fuse: use true,false for bool variable 2020-02-06 16:39:28 +01:00
virtio_fs.c virtiofs: do not use fuse_fill_super_common() for device installation 2020-05-19 14:50:37 +02:00
xattr.c fuse: rearrange and resize fuse_args fields 2019-09-10 16:29:48 +02:00