1. 12 Jun, 2023 1 commit
    • Amir Goldstein's avatar
      fsnotify: move fsnotify_open() hook into do_dentry_open() · 7b8c9d7b
      Amir Goldstein authored
      fsnotify_open() hook is called only from high level system calls
      context and not called for the very many helpers to open files.
      
      This may makes sense for many of the special file open cases, but it is
      inconsistent with fsnotify_close() hook that is called for every last
      fput() of on a file object with FMODE_OPENED.
      
      As a result, it is possible to observe ACCESS, MODIFY and CLOSE events
      without ever observing an OPEN event.
      
      Fix this inconsistency by replacing all the fsnotify_open() hooks with
      a single hook inside do_dentry_open().
      
      If there are special cases that would like to opt-out of the possible
      overhead of fsnotify() call in fsnotify_open(), they would probably also
      want to avoid the overhead of fsnotify() call in the rest of the fsnotify
      hooks, so they should be opening that file with the __FMODE_NONOTIFY flag.
      
      However, in the majority of those cases, the s_fsnotify_connectors
      optimization in fsnotify_parent() would be sufficient to avoid the
      overhead of fsnotify() call anyway.
      Signed-off-by: default avatarAmir Goldstein <amir73il@gmail.com>
      Signed-off-by: default avatarJan Kara <jack@suse.cz>
      Message-Id: <20230611122429.1499617-1-amir73il@gmail.com>
      7b8c9d7b
  2. 25 May, 2023 3 commits
    • Amir Goldstein's avatar
      exportfs: check for error return value from exportfs_encode_*() · 7cdafe6c
      Amir Goldstein authored
      The exportfs_encode_*() helpers call the filesystem ->encode_fh()
      method which returns a signed int.
      
      All the in-tree implementations of ->encode_fh() return a positive
      integer and FILEID_INVALID (255) for error.
      
      Fortify the callers for possible future ->encode_fh() implementation
      that will return a negative error value.
      
      name_to_handle_at() would propagate the returned error to the users
      if filesystem ->encode_fh() method returns an error.
      Reported-by: default avatarDan Carpenter <dan.carpenter@linaro.org>
      Link: https://lore.kernel.org/linux-fsdevel/ca02955f-1877-4fde-b453-3c1d22794740@kili.mountain/Signed-off-by: default avatarAmir Goldstein <amir73il@gmail.com>
      Reviewed-by: default avatarJeff Layton <jlayton@kernel.org>
      Signed-off-by: default avatarJan Kara <jack@suse.cz>
      Message-Id: <20230524154825.881414-1-amir73il@gmail.com>
      7cdafe6c
    • Amir Goldstein's avatar
      fanotify: support reporting non-decodeable file handles · a95aef69
      Amir Goldstein authored
      fanotify users do not always need to decode the file handles reported
      with FAN_REPORT_FID.
      
      Relax the restriction that filesystem needs to support NFS export and
      allow reporting file handles from filesystems that only support ecoding
      unique file handles.
      
      Even filesystems that do not have export_operations at all can fallback
      to use the default FILEID_INO32_GEN encoding, but we use the existence
      of export_operations as an indication that the encoded file handles will
      be sufficiently unique and that user will be able to compare them to
      filesystem objects using AT_HANDLE_FID flag to name_to_handle_at(2).
      
      For filesystems that do not support NFS export, users will have to use
      the AT_HANDLE_FID of name_to_handle_at(2) if they want to compare the
      object in path to the object fid reported in an event.
      Signed-off-by: default avatarAmir Goldstein <amir73il@gmail.com>
      Signed-off-by: default avatarJan Kara <jack@suse.cz>
      Message-Id: <20230502124817.3070545-5-amir73il@gmail.com>
      a95aef69
    • Amir Goldstein's avatar
      exportfs: allow exporting non-decodeable file handles to userspace · 96b2b072
      Amir Goldstein authored
      Some userspace programs use st_ino as a unique object identifier, even
      though inode numbers may be recycable.
      
      This issue has been addressed for NFS export long ago using the exportfs
      file handle API and the unique file handle identifiers are also exported
      to userspace via name_to_handle_at(2).
      
      fanotify also uses file handles to identify objects in events, but only
      for filesystems that support NFS export.
      
      Relax the requirement for NFS export support and allow more filesystems
      to export a unique object identifier via name_to_handle_at(2) with the
      flag AT_HANDLE_FID.
      
      A file handle requested with the AT_HANDLE_FID flag, may or may not be
      usable as an argument to open_by_handle_at(2).
      
      To allow filesystems to opt-in to supporting AT_HANDLE_FID, a struct
      export_operations is required, but even an empty struct is sufficient
      for encoding FIDs.
      Acked-by: default avatarJeff Layton <jlayton@kernel.org>
      Acked-by: default avatarChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: default avatarAmir Goldstein <amir73il@gmail.com>
      Acked-by: default avatarChristian Brauner <brauner@kernel.org>
      Signed-off-by: default avatarJan Kara <jack@suse.cz>
      Message-Id: <20230502124817.3070545-4-amir73il@gmail.com>
      96b2b072
  3. 22 May, 2023 2 commits
  4. 14 May, 2023 13 commits
  5. 13 May, 2023 17 commits
  6. 12 May, 2023 4 commits
    • Borislav Petkov (AMD)'s avatar
      x86/retbleed: Fix return thunk alignment · 9a48d604
      Borislav Petkov (AMD) authored
      SYM_FUNC_START_LOCAL_NOALIGN() adds an endbr leading to this layout
      (leaving only the last 2 bytes of the address):
      
        3bff <zen_untrain_ret>:
        3bff:       f3 0f 1e fa             endbr64
        3c03:       f6                      test   $0xcc,%bl
      
        3c04 <__x86_return_thunk>:
        3c04:       c3                      ret
        3c05:       cc                      int3
        3c06:       0f ae e8                lfence
      
      However, "the RET at __x86_return_thunk must be on a 64 byte boundary,
      for alignment within the BTB."
      
      Use SYM_START instead.
      Signed-off-by: default avatarBorislav Petkov (AMD) <bp@alien8.de>
      Reviewed-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Cc: <stable@kernel.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      9a48d604
    • Linus Torvalds's avatar
      Merge tag 'for-6.4-rc1-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux · 76c7f887
      Linus Torvalds authored
      Pull more btrfs fixes from David Sterba:
      
       - fix incorrect number of bitmap entries for space cache if loading is
         interrupted by some error
      
       - fix backref walking, this breaks a mode of LOGICAL_INO_V2 ioctl that
         is used in deduplication tools
      
       - zoned mode fixes:
            - properly finish zone reserved for relocation
            - correctly calculate super block zone end on ZNS
            - properly initialize new extent buffer for redirty
      
       - make mount option clear_cache work with block-group-tree, to rebuild
         free-space-tree instead of temporarily disabling it that would lead
         to a forced read-only mount
      
       - fix alignment check for offset when printing extent item
      
      * tag 'for-6.4-rc1-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux:
        btrfs: make clear_cache mount option to rebuild FST without disabling it
        btrfs: zero the buffer before marking it dirty in btrfs_redirty_list_add
        btrfs: zoned: fix full zone super block reading on ZNS
        btrfs: zoned: zone finish data relocation BG with last IO
        btrfs: fix backref walking not returning all inode refs
        btrfs: fix space cache inconsistency after error loading it from disk
        btrfs: print-tree: parent bytenr must be aligned to sector size
      76c7f887
    • Linus Torvalds's avatar
      Merge tag '6.4-rc1-smb3-client-fixes' of git://git.samba.org/sfrench/cifs-2.6 · fd88f147
      Linus Torvalds authored
      Pull cifs client fixes from Steve French:
      
       - fix for copy_file_range bug for very large files that are multiples
         of rsize
      
       - do not ignore "isolated transport" flag if set on share
      
       - set rasize default better
      
       - three fixes related to shutdown and freezing (fixes 4 xfstests, and
         closes deferred handles faster in some places that were missed)
      
      * tag '6.4-rc1-smb3-client-fixes' of git://git.samba.org/sfrench/cifs-2.6:
        cifs: release leases for deferred close handles when freezing
        smb3: fix problem remounting a share after shutdown
        SMB3: force unmount was failing to close deferred close files
        smb3: improve parallel reads of large files
        do not reuse connection if share marked as isolated
        cifs: fix pcchunk length type in smb2_copychunk_range
      fd88f147
    • Linus Torvalds's avatar
      Merge tag 'vfs/v6.4-rc1/pipe' of gitolite.kernel.org:pub/scm/linux/kernel/git/vfs/vfs · df8c2d13
      Linus Torvalds authored
      Pull vfs fix from Christian Brauner:
       "During the pipe nonblock rework the check for both O_NONBLOCK and
        IOCB_NOWAIT was dropped. Both checks need to be performed to ensure
        that files without O_NONBLOCK but IOCB_NOWAIT don't block when writing
        to or reading from a pipe.
      
        This just contains the fix adding the check for IOCB_NOWAIT back in"
      
      * tag 'vfs/v6.4-rc1/pipe' of gitolite.kernel.org:pub/scm/linux/kernel/git/vfs/vfs:
        pipe: check for IOCB_NOWAIT alongside O_NONBLOCK
      df8c2d13