1. 10 9月, 2019 2 次提交
  2. 02 9月, 2019 1 次提交
  3. 10 6月, 2019 3 次提交
  4. 28 5月, 2019 2 次提交
    • M
      fuse: extract helper for range writeback · 26eb3bae
      Miklos Szeredi 提交于
      The fuse_writeback_range() helper flushes dirty data to the userspace
      filesystem.
      
      When the function returns, the WRITE requests for the data in the given
      range have all been completed.  This is not equivalent to fsync() on the
      given range, since the userspace filesystem may not yet have the data on
      stable storage.
      Signed-off-by: NMiklos Szeredi <mszeredi@redhat.com>
      26eb3bae
    • M
      fuse: fix copy_file_range() in the writeback case · a2bc9236
      Miklos Szeredi 提交于
      Prior to sending COPY_FILE_RANGE to userspace filesystem, we must flush all
      dirty pages in both the source and destination files.
      
      This patch adds the missing flush of the source file.
      
      Tested on libfuse-3.5.0 with:
      
        libfuse/example/passthrough_ll /mnt/fuse/ -o writeback
        libfuse/test/test_syscalls /mnt/fuse/tmp/test
      
      Fixes: 88bc7d50 ("fuse: add support for copy_file_range()")
      Cc: <stable@vger.kernel.org> # v4.20
      Signed-off-by: NMiklos Szeredi <mszeredi@redhat.com>
      a2bc9236
  5. 27 5月, 2019 2 次提交
  6. 24 4月, 2019 5 次提交
    • I
      fuse: Add ioctl flag for x32 compat ioctl · 6407f44a
      Ian Abbott 提交于
      Currently, a CUSE server running on a 64-bit kernel can tell when an ioctl
      request comes from a process running a 32-bit ABI, but cannot tell whether
      the requesting process is using legacy IA32 emulation or x32 ABI.  In
      particular, the server does not know the size of the client process's
      `time_t` type.
      
      For 64-bit kernels, the `FUSE_IOCTL_COMPAT` and `FUSE_IOCTL_32BIT` flags
      are currently set in the ioctl input request (`struct fuse_ioctl_in` member
      `flags`) for a 32-bit requesting process.  This patch defines a new flag
      `FUSE_IOCTL_COMPAT_X32` and sets it if the 32-bit requesting process is
      using the x32 ABI.  This allows the server process to distinguish between
      requests coming from client processes using IA32 emulation or the x32 ABI
      and so infer the size of the client process's `time_t` type and any other
      IA32/x32 differences.
      Signed-off-by: NIan Abbott <abbotti@mev.co.uk>
      Signed-off-by: NMiklos Szeredi <mszeredi@redhat.com>
      6407f44a
    • A
      fuse: document fuse_fsync_in.fsync_flags · 154603fe
      Alan Somers 提交于
      The FUSE_FSYNC_DATASYNC flag was introduced by commit b6aeaded
      ("[PATCH] FUSE - file operations") as a magic number.  No new values have
      been added to fsync_flags since.
      Signed-off-by: NAlan Somers <asomers@FreeBSD.org>
      Signed-off-by: NMiklos Szeredi <mszeredi@redhat.com>
      154603fe
    • K
      fuse: Add FOPEN_STREAM to use stream_open() · bbd84f33
      Kirill Smelkov 提交于
      Starting from commit 9c225f26 ("vfs: atomic f_pos accesses as per
      POSIX") files opened even via nonseekable_open gate read and write via lock
      and do not allow them to be run simultaneously. This can create read vs
      write deadlock if a filesystem is trying to implement a socket-like file
      which is intended to be simultaneously used for both read and write from
      filesystem client.  See commit 10dce8af ("fs: stream_open - opener for
      stream-like files so that read and write can run simultaneously without
      deadlock") for details and e.g. commit 581d21a2 ("xenbus: fix deadlock
      on writes to /proc/xen/xenbus") for a similar deadlock example on
      /proc/xen/xenbus.
      
      To avoid such deadlock it was tempting to adjust fuse_finish_open to use
      stream_open instead of nonseekable_open on just FOPEN_NONSEEKABLE flags,
      but grepping through Debian codesearch shows users of FOPEN_NONSEEKABLE,
      and in particular GVFS which actually uses offset in its read and write
      handlers
      
      	https://codesearch.debian.net/search?q=-%3Enonseekable+%3D
      	https://gitlab.gnome.org/GNOME/gvfs/blob/1.40.0-6-gcbc54396/client/gvfsfusedaemon.c#L1080
      	https://gitlab.gnome.org/GNOME/gvfs/blob/1.40.0-6-gcbc54396/client/gvfsfusedaemon.c#L1247-1346
      	https://gitlab.gnome.org/GNOME/gvfs/blob/1.40.0-6-gcbc54396/client/gvfsfusedaemon.c#L1399-1481
      
      so if we would do such a change it will break a real user.
      
      Add another flag (FOPEN_STREAM) for filesystem servers to indicate that the
      opened handler is having stream-like semantics; does not use file position
      and thus the kernel is free to issue simultaneous read and write request on
      opened file handle.
      
      This patch together with stream_open() should be added to stable kernels
      starting from v3.14+. This will allow to patch OSSPD and other FUSE
      filesystems that provide stream-like files to return FOPEN_STREAM |
      FOPEN_NONSEEKABLE in open handler and this way avoid the deadlock on all
      kernel versions. This should work because fuse_finish_open ignores unknown
      open flags returned from a filesystem and so passing FOPEN_STREAM to a
      kernel that is not aware of this flag cannot hurt. In turn the kernel that
      is not aware of FOPEN_STREAM will be < v3.14 where just FOPEN_NONSEEKABLE
      is sufficient to implement streams without read vs write deadlock.
      
      Cc: stable@vger.kernel.org # v3.14+
      Signed-off-by: NKirill Smelkov <kirr@nexedi.com>
      Signed-off-by: NMiklos Szeredi <mszeredi@redhat.com>
      bbd84f33
    • L
      fuse: honor RLIMIT_FSIZE in fuse_file_fallocate · 0cbade02
      Liu Bo 提交于
      fstests generic/228 reported this failure that fuse fallocate does not
      honor what 'ulimit -f' has set.
      
      This adds the necessary inode_newsize_ok() check.
      Signed-off-by: NLiu Bo <bo.liu@linux.alibaba.com>
      Fixes: 05ba1f08 ("fuse: add FALLOCATE operation")
      Cc: <stable@vger.kernel.org> # v3.5
      Signed-off-by: NMiklos Szeredi <mszeredi@redhat.com>
      0cbade02
    • M
      fuse: fix writepages on 32bit · 9de5be06
      Miklos Szeredi 提交于
      Writepage requests were cropped to i_size & 0xffffffff, which meant that
      mmaped writes to any file larger than 4G might be silently discarded.
      
      Fix by storing the file size in a properly sized variable (loff_t instead
      of size_t).
      Reported-by: NAntonio SJ Musumeci <trapexit@spawn.link>
      Fixes: 6eaf4782 ("fuse: writepages: crop secondary requests")
      Cc: <stable@vger.kernel.org> # v3.13
      Signed-off-by: NMiklos Szeredi <mszeredi@redhat.com>
      9de5be06
  7. 13 2月, 2019 16 次提交
  8. 16 1月, 2019 1 次提交
  9. 12 12月, 2018 1 次提交
  10. 03 12月, 2018 1 次提交
  11. 09 11月, 2018 1 次提交
  12. 24 10月, 2018 1 次提交
  13. 15 10月, 2018 1 次提交
  14. 01 10月, 2018 3 次提交
    • M
      fuse: realloc page array · e52a8250
      Miklos Szeredi 提交于
      Writeback caching currently allocates requests with the maximum number of
      possible pages, while the actual number of pages per request depends on a
      couple of factors that cannot be determined when the request is allocated
      (whether page is already under writeback, whether page is contiguous with
      previous pages already added to a request).
      
      This patch allows such requests to start with no page allocation (all pages
      inline) and grow the page array on demand.
      
      If the max_pages tunable remains the default value, then this will mean
      just one allocation that is the same size as before.  If the tunable is
      larger, then this adds at most 3 additional memory allocations (which is
      generously compensated by the improved performance from the larger
      request).
      Signed-off-by: NMiklos Szeredi <mszeredi@redhat.com>
      e52a8250
    • C
      fuse: add max_pages to init_out · 5da784cc
      Constantine Shulyupin 提交于
      Replace FUSE_MAX_PAGES_PER_REQ with the configurable parameter max_pages to
      improve performance.
      
      Old RFC with detailed description of the problem and many fixes by Mitsuo
      Hayasaka (mitsuo.hayasaka.hu@hitachi.com):
       - https://lkml.org/lkml/2012/7/5/136
      
      We've encountered performance degradation and fixed it on a big and complex
      virtual environment.
      
      Environment to reproduce degradation and improvement:
      
      1. Add lag to user mode FUSE
      Add nanosleep(&(struct timespec){ 0, 1000 }, NULL); to xmp_write_buf in
      passthrough_fh.c
      
      2. patch UM fuse with configurable max_pages parameter. The patch will be
      provided latter.
      
      3. run test script and perform test on tmpfs
      fuse_test()
      {
      
             cd /tmp
             mkdir -p fusemnt
             passthrough_fh -o max_pages=$1 /tmp/fusemnt
             grep fuse /proc/self/mounts
             dd conv=fdatasync oflag=dsync if=/dev/zero of=fusemnt/tmp/tmp \
      		count=1K bs=1M 2>&1 | grep -v records
             rm fusemnt/tmp/tmp
             killall passthrough_fh
      }
      
      Test results:
      
      passthrough_fh /tmp/fusemnt fuse.passthrough_fh \
      	rw,nosuid,nodev,relatime,user_id=0,group_id=0 0 0
      1073741824 bytes (1.1 GB) copied, 1.73867 s, 618 MB/s
      
      passthrough_fh /tmp/fusemnt fuse.passthrough_fh \
      	rw,nosuid,nodev,relatime,user_id=0,group_id=0,max_pages=256 0 0
      1073741824 bytes (1.1 GB) copied, 1.15643 s, 928 MB/s
      
      Obviously with bigger lag the difference between 'before' and 'after'
      will be more significant.
      
      Mitsuo Hayasaka, in 2012 (https://lkml.org/lkml/2012/7/5/136),
      observed improvement from 400-550 to 520-740.
      Signed-off-by: NConstantine Shulyupin <const@MakeLinux.com>
      Signed-off-by: NMiklos Szeredi <mszeredi@redhat.com>
      5da784cc
    • M
      fuse: reduce size of struct fuse_inode · ab2257e9
      Miklos Szeredi 提交于
      Do this by grouping fields used for cached writes and putting them into a
      union with fileds used for cached readdir (with obviously no overlap, since
      we don't have hybrid objects).
      Signed-off-by: NMiklos Szeredi <mszeredi@redhat.com>
      ab2257e9