1. 21 Apr, 2022 35 commits
  2. 20 Apr, 2022 4 commits
    • Kaixu Xia's avatar
      xfs: simplify local variable assignment in file write code · 2d9ac431
      Kaixu Xia authored
      Get the struct inode pointer from iocb->ki_filp->f_mapping->host
      directly and the other variables are unnecessary, so simplify the
      local variables assignment.
      Signed-off-by: default avatarKaixu Xia <kaixuxia@tencent.com>
      Reviewed-by: default avatarDarrick J. Wong <djwong@kernel.org>
      Signed-off-by: default avatarDave Chinner <david@fromorbit.com>
      2d9ac431
    • Dave Chinner's avatar
      xfs: reorder iunlink remove operation in xfs_ifree · 9a5280b3
      Dave Chinner authored
      The O_TMPFILE creation implementation creates a specific order of
      operations for inode allocation/freeing and unlinked list
      modification. Currently both are serialised by the AGI, so the order
      doesn't strictly matter as long as the are both in the same
      transaction.
      
      However, if we want to move the unlinked list insertions largely out
      from under the AGI lock, then we have to be concerned about the
      order in which we do unlinked list modification operations.
      O_TMPFILE creation tells us this order is inode allocation/free,
      then unlinked list modification.
      
      Change xfs_ifree() to use this same ordering on unlinked list
      removal. This way we always guarantee that when we enter the
      iunlinked list removal code from this path, we already have the AGI
      locked and we don't have to worry about lock nesting AGI reads
      inside unlink list locks because it's already locked and attached to
      the transaction.
      
      We can do this safely as the inode freeing and unlinked list removal
      are done in the same transaction and hence are atomic operations
      with respect to log recovery.
      Reported-by: default avatarFrank Hofmann <fhofmann@cloudflare.com>
      Fixes: 298f7bec ("xfs: pin inode backing buffer to the inode log item")
      Signed-off-by: default avatarDave Chinner <dchinner@redhat.com>
      Reviewed-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
      Signed-off-by: default avatarDave Chinner <david@fromorbit.com>
      9a5280b3
    • Tiezhu Yang's avatar
      MAINTAINERS: update IOMAP FILESYSTEM LIBRARY and XFS FILESYSTEM · d65a92de
      Tiezhu Yang authored
      In IOMAP FILESYSTEM LIBRARY and XFS FILESYSTEM, the M(ail): entry is
      redundant with the L(ist): entry, remove the redundant M(ail): entry.
      Signed-off-by: default avatarTiezhu Yang <yangtiezhu@loongson.cn>
      Reviewed-by: default avatarDarrick J. Wong <djwong@kernel.org>
      Reviewed-by: default avatarChaitanya Kulkarni <kch@nvidia.com>
      Signed-off-by: default avatarDave Chinner <david@fromorbit.com>
      d65a92de
    • Dave Chinner's avatar
      xfs: convert buffer flags to unsigned. · b9b3fe15
      Dave Chinner authored
      5.18 w/ std=gnu11 compiled with gcc-5 wants flags stored in unsigned
      fields to be unsigned. This manifests as a compiler error such as:
      
      /kisskb/src/fs/xfs/./xfs_trace.h:432:2: note: in expansion of macro 'TP_printk'
        TP_printk("dev %d:%d daddr 0x%llx bbcount 0x%x hold %d pincount %d "
        ^
      /kisskb/src/fs/xfs/./xfs_trace.h:440:5: note: in expansion of macro '__print_flags'
           __print_flags(__entry->flags, "|", XFS_BUF_FLAGS),
           ^
      /kisskb/src/fs/xfs/xfs_buf.h:67:4: note: in expansion of macro 'XBF_UNMAPPED'
        { XBF_UNMAPPED,  "UNMAPPED" }
          ^
      /kisskb/src/fs/xfs/./xfs_trace.h:440:40: note: in expansion of macro 'XFS_BUF_FLAGS'
           __print_flags(__entry->flags, "|", XFS_BUF_FLAGS),
                                              ^
      /kisskb/src/fs/xfs/./xfs_trace.h: In function 'trace_raw_output_xfs_buf_flags_class':
      /kisskb/src/fs/xfs/xfs_buf.h:46:23: error: initializer element is not constant
       #define XBF_UNMAPPED  (1 << 31)/* do not map the buffer */
      
      as __print_flags assigns XFS_BUF_FLAGS to a structure that uses an
      unsigned long for the flag. Since this results in the value of
      XBF_UNMAPPED causing a signed integer overflow, the result is
      technically undefined behavior, which gcc-5 does not accept as an
      integer constant.
      
      This is based on a patch from Arnd Bergman <arnd@arndb.de>.
      Reported-by: default avatarGeert Uytterhoeven <geert@linux-m68k.org>
      Signed-off-by: default avatarDave Chinner <dchinner@redhat.com>
      Reviewed-by: default avatarChandan Babu R <chandan.babu@oracle.com>
      Signed-off-by: default avatarDave Chinner <david@fromorbit.com>
      b9b3fe15
  3. 11 Apr, 2022 1 commit
    • Darrick J. Wong's avatar
      xfs: use a separate frextents counter for rt extent reservations · 2229276c
      Darrick J. Wong authored
      As mentioned in the previous commit, the kernel misuses sb_frextents in
      the incore mount to reflect both incore reservations made by running
      transactions as well as the actual count of free rt extents on disk.
      This results in the superblock being written to the log with an
      underestimate of the number of rt extents that are marked free in the
      rtbitmap.
      
      Teaching XFS to recompute frextents after log recovery avoids
      operational problems in the current mount, but it doesn't solve the
      problem of us writing undercounted frextents which are then recovered by
      an older kernel that doesn't have that fix.
      
      Create an incore percpu counter to mirror the ondisk frextents.  This
      new counter will track transaction reservations and the only time we
      will touch the incore super counter (i.e the one that gets logged) is
      when those transactions commit updates to the rt bitmap.  This is in
      contrast to the lazysbcount counters (e.g. fdblocks), where we know that
      log recovery will always fix any incorrect counter that we log.
      As a bonus, we only take m_sb_lock at transaction commit time.
      Signed-off-by: default avatarDarrick J. Wong <djwong@kernel.org>
      Reviewed-by: default avatarDave Chinner <dchinner@redhat.com>
      Signed-off-by: default avatarDave Chinner <david@fromorbit.com>
      2229276c