1. 10 9月, 2020 1 次提交
  2. 04 9月, 2020 1 次提交
  3. 05 8月, 2020 1 次提交
  4. 17 7月, 2020 1 次提交
  5. 15 7月, 2020 1 次提交
  6. 14 7月, 2020 7 次提交
    • V
      fuse: don't ignore errors from fuse_writepages_fill() · 7779b047
      Vasily Averin 提交于
      fuse_writepages() ignores some errors taken from fuse_writepages_fill() I
      believe it is a bug: if .writepages is called with WB_SYNC_ALL it should
      either guarantee that all data was successfully saved or return error.
      
      Fixes: 26d614df ("fuse: Implement writepages callback")
      Signed-off-by: NVasily Averin <vvs@virtuozzo.com>
      Signed-off-by: NMiklos Szeredi <mszeredi@redhat.com>
      7779b047
    • M
      fuse: clean up condition for writepage sending · 6ddf3af9
      Miklos Szeredi 提交于
      fuse_writepages_fill uses following construction:
      
      if (wpa && ap->num_pages &&
          (A || B || C)) {
              action;
      } else if (wpa && D) {
              if (E) {
                      the same action;
              }
      }
      
       - ap->num_pages check is always true and can be removed
      
       - "if" and "else if" calls the same action and can be merged.
      
      Move checking A, B, C, D, E conditions to a helper, add comments.
      Original-patch-by: NVasily Averin <vvs@virtuozzo.com>
      Signed-off-by: NMiklos Szeredi <mszeredi@redhat.com>
      6ddf3af9
    • M
      fuse: reject options on reconfigure via fsconfig(2) · b330966f
      Miklos Szeredi 提交于
      Previous patch changed handling of remount/reconfigure to ignore all
      options, including those that are unknown to the fuse kernel fs.  This was
      done for backward compatibility, but this likely only affects the old
      mount(2) API.
      
      The new fsconfig(2) based reconfiguration could possibly be improved.  This
      would make the new API less of a drop in replacement for the old, OTOH this
      is a good chance to get rid of some weirdnesses in the old API.
      
      Several other behaviors might make sense:
      
       1) unknown options are rejected, known options are ignored
      
       2) unknown options are rejected, known options are rejected if the value
       is changed, allowed otherwise
      
       3) all options are rejected
      
      Prior to the backward compatibility fix to ignore all options all known
      options were accepted (1), even if they change the value of a mount
      parameter; fuse_reconfigure() does not look at the config values set by
      fuse_parse_param().
      
      To fix that we'd need to verify that the value provided is the same as set
      in the initial configuration (2).  The major drawback is that this is much
      more complex than just rejecting all attempts at changing options (3);
      i.e. all options signify initial configuration values and don't make sense
      on reconfigure.
      
      This patch opts for (3) with the rationale that no mount options are
      reconfigurable in fuse.
      Signed-off-by: NMiklos Szeredi <mszeredi@redhat.com>
      b330966f
    • M
      fuse: ignore 'data' argument of mount(..., MS_REMOUNT) · e8b20a47
      Miklos Szeredi 提交于
      The command
      
        mount -o remount -o unknownoption /mnt/fuse
      
      succeeds on kernel versions prior to v5.4 and fails on kernel version at or
      after.  This is because fuse_parse_param() rejects any unrecognised options
      in case of FS_CONTEXT_FOR_RECONFIGURE, just as for FS_CONTEXT_FOR_MOUNT.
      
      This causes a regression in case the fuse filesystem is in fstab, since
      remount sends all options found there to the kernel; even ones that are
      meant for the initial mount and are consumed by the userspace fuse server.
      
      Fix this by ignoring mount options, just as fuse_remount_fs() did prior to
      the conversion to the new API.
      Reported-by: NStefan Priebe <s.priebe@profihost.ag>
      Fixes: c30da2e9 ("fuse: convert to use the new mount API")
      Cc: <stable@vger.kernel.org> # v5.4
      Signed-off-by: NMiklos Szeredi <mszeredi@redhat.com>
      e8b20a47
    • M
      fuse: use ->reconfigure() instead of ->remount_fs() · 0189a2d3
      Miklos Szeredi 提交于
      s_op->remount_fs() is only called from legacy_reconfigure(), which is not
      used after being converted to the new API.
      
      Convert to using ->reconfigure().  This restores the previous behavior of
      syncing the filesystem and rejecting MS_MANDLOCK on remount.
      
      Fixes: c30da2e9 ("fuse: convert to use the new mount API")
      Cc: <stable@vger.kernel.org> # v5.4
      Signed-off-by: NMiklos Szeredi <mszeredi@redhat.com>
      0189a2d3
    • M
      fuse: fix warning in tree_insert() and clean up writepage insertion · c146024e
      Miklos Szeredi 提交于
      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: 6b2fb799 ("fuse: optimize writepages search")
      Reported-by: Nkernel test robot <rong.a.chen@intel.com>
      Original-path-by: NVasily Averin <vvs@virtuozzo.com>
      Signed-off-by: NMiklos Szeredi <mszeredi@redhat.com>
      c146024e
    • M
      fuse: move rb_erase() before tree_insert() · 69a6487a
      Miklos Szeredi 提交于
      In fuse_writepage_end() the old writepages entry needs to be removed from
      the rbtree before inserting the new one, otherwise tree_insert() would
      fail.  This is a very rare codepath and no reproducer exists.
      Signed-off-by: NMiklos Szeredi <mszeredi@redhat.com>
      69a6487a
  7. 04 6月, 2020 1 次提交
  8. 03 6月, 2020 1 次提交
  9. 21 5月, 2020 1 次提交
  10. 20 5月, 2020 2 次提交
    • M
      fuse: copy_file_range should truncate cache · 9b46418c
      Miklos Szeredi 提交于
      After the copy operation completes the cache is not up-to-date.  Truncate
      all pages in the interval that has successfully been copied.
      
      Truncating completely copied dirty pages is okay, since the data has been
      overwritten anyway.  Truncating partially copied dirty pages is not okay;
      add a comment for now.
      
      Fixes: 88bc7d50 ("fuse: add support for copy_file_range()")
      Signed-off-by: NMiklos Szeredi <mszeredi@redhat.com>
      9b46418c
    • M
      fuse: fix copy_file_range cache issues · 2c4656df
      Miklos Szeredi 提交于
      a) Dirty cache needs to be written back not just in the writeback_cache
      case, since the dirty pages may come from memory maps.
      
      b) The fuse_writeback_range() helper takes an inclusive interval, so the
      end position needs to be pos+len-1 instead of pos+len.
      
      Fixes: 88bc7d50 ("fuse: add support for copy_file_range()")
      Signed-off-by: NMiklos Szeredi <mszeredi@redhat.com>
      2c4656df
  11. 19 5月, 2020 9 次提交
  12. 21 4月, 2020 1 次提交
  13. 20 4月, 2020 3 次提交
  14. 13 2月, 2020 1 次提交
  15. 08 2月, 2020 3 次提交
  16. 06 2月, 2020 4 次提交
    • Z
      fuse: use true,false for bool variable · cabdb4fa
      zhengbin 提交于
      Fixes coccicheck warning:
      
      fs/fuse/readdir.c:335:1-19: WARNING: Assignment of 0/1 to bool variable
      fs/fuse/file.c:1398:2-19: WARNING: Assignment of 0/1 to bool variable
      fs/fuse/file.c:1400:2-20: WARNING: Assignment of 0/1 to bool variable
      fs/fuse/cuse.c:454:1-20: WARNING: Assignment of 0/1 to bool variable
      fs/fuse/cuse.c:455:1-19: WARNING: Assignment of 0/1 to bool variable
      fs/fuse/inode.c:497:2-17: WARNING: Assignment of 0/1 to bool variable
      fs/fuse/inode.c:504:2-23: WARNING: Assignment of 0/1 to bool variable
      fs/fuse/inode.c:511:2-22: WARNING: Assignment of 0/1 to bool variable
      fs/fuse/inode.c:518:2-23: WARNING: Assignment of 0/1 to bool variable
      fs/fuse/inode.c:522:2-26: WARNING: Assignment of 0/1 to bool variable
      fs/fuse/inode.c:526:2-18: WARNING: Assignment of 0/1 to bool variable
      fs/fuse/inode.c:1000:1-20: WARNING: Assignment of 0/1 to bool variable
      Reported-by: NHulk Robot <hulkci@huawei.com>
      Signed-off-by: Nzhengbin <zhengbin13@huawei.com>
      Signed-off-by: NMiklos Szeredi <mszeredi@redhat.com>
      cabdb4fa
    • V
      fuse: Support RENAME_WHITEOUT flag · 519525fa
      Vivek Goyal 提交于
      Allow fuse to pass RENAME_WHITEOUT to fuse server.  Overlayfs on top of
      virtiofs uses RENAME_WHITEOUT.
      
      Without this patch renaming a directory in overlayfs (dir is on lower)
      fails with -EINVAL. With this patch it works.
      Signed-off-by: NVivek Goyal <vgoyal@redhat.com>
      Signed-off-by: NMiklos Szeredi <mszeredi@redhat.com>
      519525fa
    • M
      fuse: don't overflow LLONG_MAX with end offset · 2f139829
      Miklos Szeredi 提交于
      Handle the special case of fuse_readpages() wanting to read the last page
      of a hugest file possible and overflowing the end offset in the process.
      
      This is basically to unbreak xfstests:generic/525 and prevent filesystems
      from doing bad things with an overflowing offset.
      Reported-by: NXiao Yang <ice_yangxiao@163.com>
      Signed-off-by: NMiklos Szeredi <mszeredi@redhat.com>
      2f139829
    • M
      fix up iter on short count in fuse_direct_io() · f658adee
      Miklos Szeredi 提交于
      fuse_direct_io() can end up advancing the iterator by more than the amount
      of data read or written.  This case is handled by the generic code if going
      through ->direct_IO(), but not in the FOPEN_DIRECT_IO case.
      
      Fix by reverting the extra bytes from the iterator in case of error or a
      short count.
      
      To test: install lxcfs, then the following testcase
        int fd = open("/var/lib/lxcfs/proc/uptime", O_RDONLY);
        sendfile(1, fd, NULL, 16777216);
        sendfile(1, fd, NULL, 16777216);
      will spew WARN_ON() in iov_iter_pipe().
      Reported-by: NPeter Geis <pgwipeout@gmail.com>
      Reported-by: NAl Viro <viro@zeniv.linux.org.uk>
      Fixes: 3c3db095 ("fuse: use iov_iter based generic splice helpers")
      Cc: <stable@vger.kernel.org> # v5.1
      Signed-off-by: NMiklos Szeredi <mszeredi@redhat.com>
      f658adee
  17. 16 1月, 2020 1 次提交
    • M
      fuse: fix fuse_send_readpages() in the syncronous read case · 7df1e988
      Miklos Szeredi 提交于
      Buffered read in fuse normally goes via:
      
       -> generic_file_buffered_read()
         -> fuse_readpages()
           -> fuse_send_readpages()
             ->fuse_simple_request() [called since v5.4]
      
      In the case of a read request, fuse_simple_request() will return a
      non-negative bytecount on success or a negative error value.  A positive
      bytecount was taken to be an error and the PG_error flag set on the page.
      This resulted in generic_file_buffered_read() falling back to ->readpage(),
      which would repeat the read request and succeed.  Because of the repeated
      read succeeding the bug was not detected with regression tests or other use
      cases.
      
      The FTP module in GVFS however fails the second read due to the
      non-seekable nature of FTP downloads.
      
      Fix by checking and ignoring positive return value from
      fuse_simple_request().
      Reported-by: NOndrej Holy <oholy@redhat.com>
      Link: https://gitlab.gnome.org/GNOME/gvfs/issues/441
      Fixes: 134831e3 ("fuse: convert readpages to simple api")
      Cc: <stable@vger.kernel.org> # v5.4
      Signed-off-by: NMiklos Szeredi <mszeredi@redhat.com>
      7df1e988
  18. 07 12月, 2019 1 次提交