1. 06 Mar, 2024 10 commits
    • Miklos Szeredi's avatar
      fuse: get rid of ff->readdir.lock · cdf6ac2a
      Miklos Szeredi authored
      The same protection is provided by file->f_pos_lock.
      
      Note, this relies on the fact that file->f_mode has FMODE_ATOMIC_POS.
      This flag is cleared by stream_open(), which would prevent locking of
      f_pos_lock.
      
      Prior to commit 7de64d52 ("fuse: break up fuse_open_common()")
      FOPEN_STREAM on a directory would cause stream_open() to be called.
      After this commit this is not done anymore, so f_pos_lock will always
      be locked.
      Signed-off-by: default avatarMiklos Szeredi <mszeredi@redhat.com>
      cdf6ac2a
    • Kemeng Shi's avatar
      fuse: remove unneeded lock which protecting update of congestion_threshold · efc4105a
      Kemeng Shi authored
      Commit 670d21c6 ("fuse: remove reliance on bdi congestion") change how
      congestion_threshold is used and lock in
      fuse_conn_congestion_threshold_write is not needed anymore.
      1. Access to supe_block is removed along with removing of bdi congestion.
      Then down_read(&fc->killsb) which protecting access to super_block is no
      needed.
      2. Compare num_background and congestion_threshold without holding
      bg_lock. Then there is no need to hold bg_lock to update
      congestion_threshold.
      Signed-off-by: default avatarKemeng Shi <shikemeng@huaweicloud.com>
      Signed-off-by: default avatarMiklos Szeredi <mszeredi@redhat.com>
      efc4105a
    • Lei Huang's avatar
      fuse: Fix missing FOLL_PIN for direct-io · 738adade
      Lei Huang authored
      Our user space filesystem relies on fuse to provide POSIX interface.
      In our test, a known string is written into a file and the content
      is read back later to verify correct data returned. We observed wrong
      data returned in read buffer in rare cases although correct data are
      stored in our filesystem.
      
      Fuse kernel module calls iov_iter_get_pages2() to get the physical
      pages of the user-space read buffer passed in read(). The pages are
      not pinned to avoid page migration. When page migration occurs, the
      consequence are two-folds.
      
      1) Applications do not receive correct data in read buffer.
      2) fuse kernel writes data into a wrong place.
      
      Using iov_iter_extract_pages() to pin pages fixes the issue in our
      test.
      
      An auxiliary variable "struct page **pt_pages" is used in the patch
      to prepare the 2nd parameter for iov_iter_extract_pages() since
      iov_iter_get_pages2() uses a different type for the 2nd parameter.
      
      [SzM] add iov_iter_extract_will_pin(ii) and unpin only if true.
      Signed-off-by: default avatarLei Huang <lei.huang@linux.intel.com>
      Signed-off-by: default avatarMiklos Szeredi <mszeredi@redhat.com>
      738adade
    • Jiachen Zhang's avatar
      fuse: remove an unnecessary if statement · 8a5fb186
      Jiachen Zhang authored
      FUSE remote locking code paths never add any locking state to
      inode->i_flctx, so the locks_remove_posix() function called on
      file close will return without calling fuse_setlk().
      
      Therefore, as the if statement to be removed in this commit will
      always be false, remove it for clearness.
      Signed-off-by: default avatarJiachen Zhang <zhangjiachen.jaycee@bytedance.com>
      Signed-off-by: default avatarMiklos Szeredi <mszeredi@redhat.com>
      8a5fb186
    • Zhou Jifeng's avatar
      fuse: Track process write operations in both direct and writethrough modes · 2e3f7dd0
      Zhou Jifeng authored
      Due to the fact that fuse does not count the write IO of processes in the
      direct and writethrough write modes, user processes cannot track
      write_bytes through the “/proc/[pid]/io” path. For example, the system
      tool iotop cannot count the write operations of the corresponding process.
      Signed-off-by: default avatarZhou Jifeng <zhoujifeng@kylinos.com.cn>
      Signed-off-by: default avatarMiklos Szeredi <mszeredi@redhat.com>
      2e3f7dd0
    • Zhao Chen's avatar
      fuse: Use the high bit of request ID for indicating resend requests · 9e7f5296
      Zhao Chen authored
      Some FUSE daemons want to know if the received request is a resend
      request. The high bit of the fuse request ID is utilized for indicating
      this, enabling the receiver to perform appropriate handling.
      
      The init flag "FUSE_HAS_RESEND" is added to indicate this feature.
      Signed-off-by: default avatarZhao Chen <winters.zc@antgroup.com>
      Signed-off-by: default avatarMiklos Szeredi <mszeredi@redhat.com>
      9e7f5296
    • Zhao Chen's avatar
      fuse: Introduce a new notification type for resend pending requests · 760eac73
      Zhao Chen authored
      When a FUSE daemon panics and failover, we aim to minimize the impact on
      applications by reusing the existing FUSE connection. During this process,
      another daemon is employed to preserve the FUSE connection's file
      descriptor. The new started FUSE Daemon will takeover the fd and continue
      to provide service.
      
      However, it is possible for some inflight requests to be lost and never
      returned. As a result, applications awaiting replies would become stuck
      forever. To address this, we can resend these pending requests to the
      new started FUSE daemon.
      
      This patch introduces a new notification type "FUSE_NOTIFY_RESEND", which
      can trigger resending of the pending requests, ensuring they are properly
      processed again.
      Signed-off-by: default avatarZhao Chen <winters.zc@antgroup.com>
      Signed-off-by: default avatarMiklos Szeredi <mszeredi@redhat.com>
      760eac73
    • Jingbo Xu's avatar
      fuse: add support for explicit export disabling · e022f6a1
      Jingbo Xu authored
      open_by_handle_at(2) can fail with -ESTALE with a valid handle returned
      by a previous name_to_handle_at(2) for evicted fuse inodes, which is
      especially common when entry_valid_timeout is 0, e.g. when the fuse
      daemon is in "cache=none" mode.
      
      The time sequence is like:
      
      	name_to_handle_at(2)	# succeed
      	evict fuse inode
      	open_by_handle_at(2)	# fail
      
      The root cause is that, with 0 entry_valid_timeout, the dput() called in
      name_to_handle_at(2) will trigger iput -> evict(), which will send
      FUSE_FORGET to the daemon.  The following open_by_handle_at(2) will send
      a new FUSE_LOOKUP request upon inode cache miss since the previous inode
      eviction.  Then the fuse daemon may fail the FUSE_LOOKUP request with
      -ENOENT as the cached metadata of the requested inode has already been
      cleaned up during the previous FUSE_FORGET.  The returned -ENOENT is
      treated as -ESTALE when open_by_handle_at(2) returns.
      
      This confuses the application somehow, as open_by_handle_at(2) fails
      when the previous name_to_handle_at(2) succeeds.  The returned errno is
      also confusing as the requested file is not deleted and already there.
      It is reasonable to fail name_to_handle_at(2) early in this case, after
      which the application can fallback to open(2) to access files.
      
      Since this issue typically appears when entry_valid_timeout is 0 which
      is configured by the fuse daemon, the fuse daemon is the right person to
      explicitly disable the export when required.
      
      Also considering FUSE_EXPORT_SUPPORT actually indicates the support for
      lookups of "." and "..", and there are existing fuse daemons supporting
      export without FUSE_EXPORT_SUPPORT set, for compatibility, we add a new
      INIT flag for such purpose.
      Reviewed-by: default avatarAmir Goldstein <amir73il@gmail.com>
      Signed-off-by: default avatarJingbo Xu <jefflexu@linux.alibaba.com>
      Signed-off-by: default avatarMiklos Szeredi <mszeredi@redhat.com>
      e022f6a1
    • Alexander Mikhalitsyn's avatar
      fuse: __kuid_val/__kgid_val helpers in fuse_fill_attr_from_inode() · 5a4d888e
      Alexander Mikhalitsyn authored
      For the sake of consistency, let's use these helpers to extract
      {u,g}id_t values from k{u,g}id_t ones.
      
      There are no functional changes, just to make code cleaner.
      Signed-off-by: default avatarAlexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com>
      Reviewed-by: default avatarChristian Brauner <brauner@kernel.org>
      Signed-off-by: default avatarMiklos Szeredi <mszeredi@redhat.com>
      5a4d888e
    • Alexander Mikhalitsyn's avatar
      fuse: fix typo for fuse_permission comment · 2d09ab22
      Alexander Mikhalitsyn authored
      Found by chance while working on support for idmapped mounts in fuse.
      Signed-off-by: default avatarAlexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com>
      Signed-off-by: default avatarMiklos Szeredi <mszeredi@redhat.com>
      2d09ab22
  2. 05 Mar, 2024 14 commits
  3. 23 Feb, 2024 14 commits
  4. 18 Feb, 2024 2 commits