• Linus Torvalds's avatar
    Merge tag 'vfs-6.8.rw' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs · bb93c5ed
    Linus Torvalds authored
    Pull vfs rw updates from Christian Brauner:
     "This contains updates from Amir for read-write backing file helpers
      for stacking filesystems such as overlayfs:
    
       - Fanotify is currently in the process of introducing pre content
         events. Roughly, a new permission event will be added indicating
         that it is safe to write to the file being accessed. These events
         are used by hierarchical storage managers to e.g., fill the content
         of files on first access.
    
         During that work we noticed that our current permission checking is
         inconsistent in rw_verify_area() and remap_verify_area().
         Especially in the splice code permission checking is done multiple
         times. For example, one time for the whole range and then again for
         partial ranges inside the iterator.
    
         In addition, we mostly do permission checking before we call
         file_start_write() except for a few places where we call it after.
         For pre-content events we need such permission checking to be done
         before file_start_write(). So this is a nice reason to clean this
         all up.
    
         After this series, all permission checking is done before
         file_start_write().
    
         As part of this cleanup we also massaged the splice code a bit. We
         got rid of a few helpers because we are alredy drowning in special
         read-write helpers. We also cleaned up the return types for splice
         helpers.
    
       - Introduce generic read-write helpers for backing files. This lifts
         some overlayfs code to common code so it can be used by the FUSE
         passthrough work coming in over the next cycles. Make Amir and
         Miklos the maintainers for this new subsystem of the vfs"
    
    * tag 'vfs-6.8.rw' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs: (30 commits)
      fs: fix __sb_write_started() kerneldoc formatting
      fs: factor out backing_file_mmap() helper
      fs: factor out backing_file_splice_{read,write}() helpers
      fs: factor out backing_file_{read,write}_iter() helpers
      fs: prepare for stackable filesystems backing file helpers
      fsnotify: optionally pass access range in file permission hooks
      fsnotify: assert that file_start_write() is not held in permission hooks
      fsnotify: split fsnotify_perm() into two hooks
      fs: use splice_copy_file_range() inline helper
      splice: return type ssize_t from all helpers
      fs: use do_splice_direct() for nfsd/ksmbd server-side-copy
      fs: move file_start_write() into direct_splice_actor()
      fs: fork splice_file_range() from do_splice_direct()
      fs: create {sb,file}_write_not_started() helpers
      fs: create file_write_started() helper
      fs: create __sb_write_started() helper
      fs: move kiocb_start_write() into vfs_iocb_iter_write()
      fs: move permission hook out of do_iter_read()
      fs: move permission hook out of do_iter_write()
      fs: move file_start_write() into vfs_iter_write()
      ...
    bb93c5ed
vfs.c 61.7 KB