1. Feb 11, 2023
  2. Feb 10, 2023
  3. Feb 06, 2023
    • Dave Chinner's avatar
      xfs: don't use BMBT btree split workers for IO completion · c85007e2
      Dave Chinner authored
      
      
      When we split a BMBT due to record insertion, we offload it to a
      worker thread because we can be deep in the stack when we try to
      allocate a new block for the BMBT. Allocation can use several
      kilobytes of stack (full memory reclaim, swap and/or IO path can
      end up on the stack during allocation) and we can already be several
      kilobytes deep in the stack when we need to split the BMBT.
      
      A recent workload demonstrated a deadlock in this BMBT split
      offload. It requires several things to happen at once:
      
      1. two inodes need a BMBT split at the same time, one must be
      unwritten extent conversion from IO completion, the other must be
      from extent allocation.
      
      2. there must be a no available xfs_alloc_wq worker threads
      available in the worker pool.
      
      3. There must be sustained severe memory shortages such that new
      kworker threads cannot be allocated to the xfs_alloc_wq pool for
      both threads that need split work to be run
      
      4. The split work from the unwritten extent conversion must run
      first.
      
      5. when the BMBT block allocation runs from the split work, it must
      loop over all AGs and not be able to either trylock an AGF
      successfully, or each AGF is is able to lock has no space available
      for a single block allocation.
      
      6. The BMBT allocation must then attempt to lock the AGF that the
      second task queued to the rescuer thread already has locked before
      it finds an AGF it can allocate from.
      
      At this point, we have an ABBA deadlock between tasks queued on the
      xfs_alloc_wq rescuer thread and a locked AGF. i.e. The queued task
      holding the AGF lock can't be run by the rescuer thread until the
      task the rescuer thread is runing gets the AGF lock....
      
      This is a highly improbably series of events, but there it is.
      
      There's a couple of ways to fix this, but the easiest way to ensure
      that we only punt tasks with a locked AGF that holds enough space
      for the BMBT block allocations to the worker thread.
      
      This works for unwritten extent conversion in IO completion (which
      doesn't have a locked AGF and space reservations) because we have
      tight control over the IO completion stack. It is typically only 6
      functions deep when xfs_btree_split() is called because we've
      already offloaded the IO completion work to a worker thread and
      hence we don't need to worry about stack overruns here.
      
      The other place we can be called for a BMBT split without a
      preceeding allocation is __xfs_bunmapi() when punching out the
      center of an existing extent. We don't remove extents in the IO
      path, so these operations don't tend to be called with a lot of
      stack consumed. Hence we don't really need to ship the split off to
      a worker thread in these cases, either.
      
      Signed-off-by: default avatarDave Chinner <dchinner@redhat.com>
      Reviewed-by: default avatarDarrick J. Wong <djwong@kernel.org>
      Signed-off-by: default avatarDarrick J. Wong <djwong@kernel.org>
      c85007e2
    • Darrick J. Wong's avatar
      xfs: fix confusing variable names in xfs_refcount_item.c · 01a3af22
      Darrick J. Wong authored
      
      
      Variable names in this code module are inconsistent and confusing.
      xfs_phys_extent describe physical mappings, so rename them "pmap".
      xfs_refcount_intents describe refcount intents, so rename them "ri".
      
      Signed-off-by: default avatarDarrick J. Wong <djwong@kernel.org>
      01a3af22
    • Darrick J. Wong's avatar
      xfs: pass refcount intent directly through the log intent code · 0b11553e
      Darrick J. Wong authored
      
      
      Pass the incore refcount intent through the CUI logging code instead of
      repeatedly boxing and unboxing parameters.
      
      Signed-off-by: default avatarDarrick J. Wong <djwong@kernel.org>
      0b11553e
    • Darrick J. Wong's avatar
      xfs: fix confusing variable names in xfs_rmap_item.c · ffaa196f
      Darrick J. Wong authored
      
      
      Variable names in this code module are inconsistent and confusing.
      xfs_map_extent describe file mappings, so rename them "map".
      xfs_rmap_intents describe block mapping intents, so rename them "ri".
      
      Signed-off-by: default avatarDarrick J. Wong <djwong@kernel.org>
      ffaa196f
    • Darrick J. Wong's avatar
      xfs: pass rmap space mapping directly through the log intent code · 1534328b
      Darrick J. Wong authored
      
      
      Pass the incore rmap space mapping through the RUI logging code instead
      of repeatedly boxing and unboxing parameters.
      
      Signed-off-by: default avatarDarrick J. Wong <djwong@kernel.org>
      1534328b
    • Darrick J. Wong's avatar
      xfs: fix confusing xfs_extent_item variable names · 578c714b
      Darrick J. Wong authored
      
      
      Change the name of all pointers to xfs_extent_item structures to "xefi"
      to make the name consistent and because the current selections ("new"
      and "free") mean other things in C.
      
      Signed-off-by: default avatarDarrick J. Wong <djwong@kernel.org>
      578c714b
    • Darrick J. Wong's avatar
      xfs: pass xfs_extent_free_item directly through the log intent code · 72ba4555
      Darrick J. Wong authored
      
      
      Pass the incore xfs_extent_free_item through the EFI logging code
      instead of repeatedly boxing and unboxing parameters.
      
      Signed-off-by: default avatarDarrick J. Wong <djwong@kernel.org>
      72ba4555
    • Darrick J. Wong's avatar
      xfs: fix confusing variable names in xfs_bmap_item.c · f3ebac4c
      Darrick J. Wong authored
      
      
      Variable names in this code module are inconsistent and confusing.
      xfs_map_extent describe file mappings, so rename them "map".
      xfs_bmap_intents describe block mapping intents, so rename them "bi".
      
      Signed-off-by: default avatarDarrick J. Wong <djwong@kernel.org>
      f3ebac4c
    • Darrick J. Wong's avatar
      xfs: pass the xfs_bmbt_irec directly through the log intent code · ddccb81b
      Darrick J. Wong authored
      
      
      Instead of repeatedly boxing and unboxing the incore extent mapping
      structure as it passes through the BUI code, pass the pointer directly
      through.
      
      Signed-off-by: default avatarDarrick J. Wong <djwong@kernel.org>
      ddccb81b
    • Xu Panda's avatar
      xfs: use strscpy() to instead of strncpy() · 8954c44f
      Xu Panda authored
      
      
      The implementation of strscpy() is more robust and safer.
      That's now the recommended way to copy NUL-terminated strings.
      
      Signed-off-by: default avatarXu Panda <xu.panda@zte.com.cn>
      Signed-off-by: default avatarYang Yang <yang.yang29@zte.com.cn>
      Reviewed-by: default avatarDarrick J. Wong <djwong@kernel.org>
      Signed-off-by: default avatarDarrick J. Wong <djwong@kernel.org>
      8954c44f
  4. Jan 30, 2023
  5. Jan 29, 2023
    • Linus Torvalds's avatar
      Fix up more non-executable files marked executable · c9661827
      Linus Torvalds authored
      Joe found another DT file that shouldn't be executable, and that
      frustrated me enough that I went hunting with this script:
      
          git ls-files -s |
              grep '^100755' |
              cut -f2 |
              xargs grep -L '^#!'
      
      and that found another file that shouldn't have been marked executable
      either, despite being in the scripts directory.
      
      Maybe these two are the last ones at least for now.  But I'm sure we'll
      be back in a few years, fixing things up again.
      
      Fixes: 8c6789f4 ("ASoC: dt-bindings: Add Everest ES8326 audio CODEC")
      Fixes: 4d8e5cd2
      
       ("locking/atomics: Fix scripts/atomic/ script permissions")
      Reported-by: default avatarJoe Perches <joe@perches.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      c9661827
    • Linus Torvalds's avatar
      Merge tag '6.2-rc5-ksmbd-server-fixes' of git://git.samba.org/ksmbd · 2543fdbd
      Linus Torvalds authored
      Pull ksmbd server fixes from Steve French:
       "Four smb3 server fixes, all also for stable:
      
         - fix for signing bug
      
         - fix to more strictly check packet length
      
         - add a max connections parm to limit simultaneous connections
      
         - fix error message flood that can occur with newer Samba xattr
           format"
      
      * tag '6.2-rc5-ksmbd-server-fixes' of git://git.samba.org/ksmbd:
        ksmbd: downgrade ndr version error message to debug
        ksmbd: limit pdu length size according to connection status
        ksmbd: do not sign response to session request for guest login
        ksmbd: add max connections parameter
      2543fdbd
  6. Jan 28, 2023
  7. Jan 27, 2023
    • Miklos Szeredi's avatar
      ovl: fail on invalid uid/gid mapping at copy up · 4f11ada1
      Miklos Szeredi authored
      If st_uid/st_gid doesn't have a mapping in the mounter's user_ns, then
      copy-up should fail, just like it would fail if the mounter task was doing
      the copy using "cp -a".
      
      There's a corner case where the "cp -a" would succeed but copy up fail: if
      there's a mapping of the invalid uid/gid (65534 by default) in the user
      namespace.  This is because stat(2) will return this value if the mapping
      doesn't exist in the current user_ns and "cp -a" will in turn be able to
      create a file with this uid/gid.
      
      This behavior would be inconsistent with POSIX ACL's, which return -1 for
      invalid uid/gid which result in a failed copy.
      
      For consistency and simplicity fail the copy of the st_uid/st_gid are
      invalid.
      
      Fixes: 459c7c56
      
       ("ovl: unprivieged mounts")
      Cc: <stable@vger.kernel.org> # v5.11
      Signed-off-by: default avatarMiklos Szeredi <mszeredi@redhat.com>
      Reviewed-by: default avatarChristian Brauner <brauner@kernel.org>
      Reviewed-by: default avatarSeth Forshee <sforshee@kernel.org>
      4f11ada1
    • Miklos Szeredi's avatar
      ovl: fix tmpfile leak · baabaa50
      Miklos Szeredi authored
      
      
      Missed an error cleanup.
      
      Reported-by: default avatar <syzbot+fd749a7ea127a84e0ffd@syzkaller.appspotmail.com>
      Fixes: 2b1a7746
      
       ("ovl: use vfs_tmpfile_open() helper")
      Cc: <stable@vger.kernel.org> # v6.1
      Signed-off-by: default avatarMiklos Szeredi <mszeredi@redhat.com>
      baabaa50
    • Dylan Yudaken's avatar
      io_uring: always prep_async for drain requests · ef5c600a
      Dylan Yudaken authored
      Drain requests all go through io_drain_req, which has a quick exit in case
      there is nothing pending (ie the drain is not useful). In that case it can
      run the issue the request immediately.
      
      However for safety it queues it through task work.
      The problem is that in this case the request is run asynchronously, but
      the async work has not been prepared through io_req_prep_async.
      
      This has not been a problem up to now, as the task work always would run
      before returning to userspace, and so the user would not have a chance to
      race with it.
      
      However - with IORING_SETUP_DEFER_TASKRUN - this is no longer the case and
      the work might be defered, giving userspace a chance to change data being
      referred to in the request.
      
      Instead _always_ prep_async for drain requests, which is simpler anyway
      and removes this issue.
      
      Cc: stable@vger.kernel.org
      Fixes: c0e0d6ba
      
       ("io_uring: add IORING_SETUP_DEFER_TASKRUN")
      Signed-off-by: default avatarDylan Yudaken <dylany@meta.com>
      Link: https://lore....
      ef5c600a