1. 21 Apr, 2022 18 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 7 commits
    • 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
    • Darrick J. Wong's avatar
      xfs: recalculate free rt extents after log recovery · 5a605fd6
      Darrick J. Wong authored
      I've been observing periodic corruption reports from xfs_scrub involving
      the free rt extent counter (frextents) while running xfs/141.  That test
      uses an error injection knob to induce a torn write to the log, and an
      arbitrary number of recovery mounts, frextents will count fewer free rt
      extents than can be found the rtbitmap.
      
      The root cause of the problem is a combination of the misuse of
      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.  The following sequence can reproduce the undercount:
      
      Thread 1			Thread 2
      xfs_trans_alloc(rtextents=3)
      xfs_mod_frextents(-3)
      <blocks>
      				xfs_attr_set()
      				xfs_bmap_attr_addfork()
      				xfs_add_attr2()
      				xfs_log_sb()
      				xfs_sb_to_disk()
      				xfs_trans_commit()
      <log flushed to disk>
      <log goes down>
      
      Note that thread 1 subtracts 3 from sb_frextents even though it never
      commits to using that space.  Thread 2 writes the undercounted value to
      the ondisk superblock and logs it to the xattr transaction, which is
      then flushed to disk.  At next mount, log recovery will find the logged
      superblock and write that back into the filesystem.  At the end of log
      recovery, we reread the superblock and install the recovered
      undercounted frextents value into the incore superblock.  From that
      point on, we've effectively leaked thread 1's transaction reservation.
      
      The correct fix for this is to separate the incore reservation from the
      ondisk usage, but that's a matter for the next patch.  Because the
      kernel has been logging superblocks with undercounted frextents for a
      very long time and we don't demand that sysadmins run xfs_repair after a
      crash, fix the undercount by recomputing frextents after log recovery.
      
      Gating this on log recovery is a reasonable balance (I think) between
      correcting the problem and slowing down every mount attempt.  Note that
      xfs_repair will fix undercounted frextents.
      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>
      5a605fd6
    • Darrick J. Wong's avatar
      xfs: pass explicit mount pointer to rtalloc query functions · f34061f5
      Darrick J. Wong authored
      Pass an explicit xfs_mount pointer to the rtalloc query functions so
      that they can support transactionless queries.
      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>
      f34061f5
    • Matthew Wilcox (Oracle)'s avatar
      xfs: Use generic_file_open() · f3bf67c6
      Matthew Wilcox (Oracle) authored
      Remove the open-coded check of O_LARGEFILE.  This changes the errno
      to be the same as other filesystems; it was changed generically in
      2.6.24 but that fix skipped XFS.
      Signed-off-by: default avatarMatthew Wilcox (Oracle) <willy@infradead.org>
      Reviewed-by: default avatarDave Chinner <dchinner@redhat.com>
      Signed-off-by: default avatarDave Chinner <david@fromorbit.com>
      f3bf67c6
    • Jonathan Lassoff's avatar
      xfs: Add XFS messages to printk index · e2703569
      Jonathan Lassoff authored
      In order for end users to quickly react to new issues that come up in
      production, it is proving useful to leverage the printk indexing system.
      
      This printk index enables kernel developers to use calls to printk()
      with changeable format strings (as they always have; no change of
      expectations), while enabling end users to examine format strings to
      detect changes.
      Since end users are using regular expressions to match messages printed
      through printk(), being able to detect changes in chosen format strings
      from release to release provides a useful signal to review
      printk()-matching regular expressions for any necessary updates.
      
      So that detailed XFS messages are captures by this printk index, this
      patch wraps the xfs_<level> and xfs_alert_tag functions.
      Signed-off-by: default avatarJonathan Lassoff <jof@thejof.com>
      Reviewed-by: default avatarChris Down <chris@chrisdown.name>
      Reviewed-by: default avatarPetr Mladek <pmladek@suse.com>
      Reviewed-by: default avatarDave Chinner <dchinner@redhat.com>
      Signed-off-by: default avatarDave Chinner <david@fromorbit.com>
      e2703569
    • Jonathan Lassoff's avatar
      xfs: Simplify XFS logging methods. · e60aa787
      Jonathan Lassoff authored
      Rather than have a constructor to define many nearly-identical
      functions, use preprocessor macros to pass down a kernel logging level
      to a common function.
      Signed-off-by: default avatarJonathan Lassoff <jof@thejof.com>
      Reviewed-by: default avatarChris Down <chris@chrisdown.name>
      Reviewed-by: default avatarDave Chinner <dchinner@redhat.com>
      Signed-off-by: default avatarDave Chinner <david@fromorbit.com>
      e60aa787
    • Linus Torvalds's avatar
      Linux 5.18-rc2 · ce522ba9
      Linus Torvalds authored
      ce522ba9
  4. 10 Apr, 2022 11 commits
    • Linus Torvalds's avatar
      Merge tag 'tty-5.18-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty · 8b57b304
      Linus Torvalds authored
      Pull serial driver fix from Greg KH:
       "This is a single serial driver fix for a build issue that showed up
        due to changes that came in through the tty tree in 5.18-rc1 that were
        missed previously. It resolves a build error with the mpc52xx_uart
        driver.
      
        It has been in linux-next this week with no reported problems"
      
      * tag 'tty-5.18-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty:
        tty: serial: mpc52xx_uart: make rx/tx hooks return unsigned, part II.
      8b57b304
    • Linus Torvalds's avatar
      Merge tag 'staging-5.18-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging · 95aa17c3
      Linus Torvalds authored
      Pull staging driver fix from Greg KH:
       "Here is a single staging driver fix for 5.18-rc2 that resolves an
        endian issue for the r8188eu driver. It has been in linux-next all
        this week with no reported problems"
      
      * tag 'staging-5.18-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging:
        staging: r8188eu: Fix PPPoE tag insertion on little endian systems
      95aa17c3
    • Linus Torvalds's avatar
      Merge tag 'driver-core-5.18-rc2' of... · 33563138
      Linus Torvalds authored
      Merge tag 'driver-core-5.18-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core
      
      Pull driver core updates from Greg KH:
       "Here are two small driver core changes for 5.18-rc2.
      
        They are the final bits in the removal of the default_attrs field in
        struct kobj_type. I had to wait until after 5.18-rc1 for all of the
        changes to do this came in through different development trees, and
        then one new user snuck in. So this series has two changes:
      
         - removal of the default_attrs field in the powerpc/pseries/vas code.
      
           The change has been acked by the PPC maintainers to come through
           this tree
      
         - removal of default_attrs from struct kobj_type now that all
           in-kernel users are removed.
      
           This cleans up the kobject code a little bit and removes some
           duplicated functionality that confused people (now there is only
           one way to do default groups)
      
        Both of these have been in linux-next for all of this week with no
        reported problems"
      
      * tag 'driver-core-5.18-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core:
        kobject: kobj_type: remove default_attrs
        powerpc/pseries/vas: use default_groups in kobj_type
      33563138
    • Linus Torvalds's avatar
      Merge tag 'char-misc-5.18-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc · f58d3410
      Linus Torvalds authored
      Pull char/misc driver fix from Greg KH:
       "A single driver fix. It resolves the build warning issue on 32bit
        systems in the habannalabs driver that came in during the 5.18-rc1
        merge cycle.
      
        It has been in linux-next for all this week with no reported problems"
      
      * tag 'char-misc-5.18-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc:
        habanalabs: Fix test build failures
      f58d3410
    • Linus Torvalds's avatar
      Merge tag 'powerpc-5.18-2' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux · 4ea3c642
      Linus Torvalds authored
      Pull powerpc fixes from Michael Ellerman:
      
       - Fix KVM "lost kick" race, where an attempt to pull a vcpu out of the
         guest could be lost (or delayed until the next guest exit).
      
       - Disable SCV (system call vectored) when PR KVM guests could be run.
      
       - Fix KVM PR guests using SCV, by disallowing AIL != 0 for KVM PR
         guests.
      
       - Add a new KVM CAP to indicate if AIL == 3 is supported.
      
       - Fix a regression when hotplugging a CPU to a memoryless/cpuless node.
      
       - Make virt_addr_valid() stricter for 64-bit Book3E & 32-bit, which
         fixes crashes seen due to hardened usercopy.
      
       - Revert a change to max_mapnr which broke HIGHMEM.
      
      Thanks to Christophe Leroy, Fabiano Rosas, Kefeng Wang, Nicholas Piggin,
      and Srikar Dronamraju.
      
      * tag 'powerpc-5.18-2' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux:
        Revert "powerpc: Set max_mapnr correctly"
        powerpc: Fix virt_addr_valid() for 64-bit Book3E & 32-bit
        KVM: PPC: Move kvmhv_on_pseries() into kvm_ppc.h
        powerpc/numa: Handle partially initialized numa nodes
        powerpc/64: Fix build failure with allyesconfig in book3s_64_entry.S
        KVM: PPC: Use KVM_CAP_PPC_AIL_MODE_3
        KVM: PPC: Book3S PR: Disallow AIL != 0
        KVM: PPC: Book3S PR: Disable SCV when AIL could be disabled
        KVM: PPC: Book3S HV P9: Fix "lost kick" race
      4ea3c642
    • Linus Torvalds's avatar
      Merge tag 'irq-urgent-2022-04-10' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 1519610b
      Linus Torvalds authored
      Pull irq fixes from Thomas Gleixner:
       "A set of interrupt chip driver fixes:
      
         - A fix for a long standing bug in the ARM GICv3 redistributor
           polling which uses the wrong bit number to test.
      
         - Prevent translation of bogus ACPI table entries which map device
           interrupts into the IPI space on ARM GICs.
      
         - Don't write into the pending register of ARM GICV4 before the scan
           in hardware has completed.
      
         - A set of build and correctness fixes for the Qualcomm MPM driver"
      
      * tag 'irq-urgent-2022-04-10' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        irqchip/gic, gic-v3: Prevent GSI to SGI translations
        irqchip/gic-v3: Fix GICR_CTLR.RWP polling
        irqchip/gic-v4: Wait for GICR_VPENDBASER.Dirty to clear before descheduling
        irqchip/irq-qcom-mpm: fix return value check in qcom_mpm_init()
        irq/qcom-mpm: Fix build error without MAILBOX
      1519610b
    • Linus Torvalds's avatar
      Merge tag 'x86_urgent_for_v5.18_rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 9c6913b7
      Linus Torvalds authored
      Pull x86 fixes from Borislav Petkov:
      
       - Fix the MSI message data struct definition
      
       - Use local labels in the exception table macros to avoid symbol
         conflicts with clang LTO builds
      
       - A couple of fixes to objtool checking of the relatively newly added
         SLS and IBT code
      
       - Rename a local var in the WARN* macro machinery to prevent shadowing
      
      * tag 'x86_urgent_for_v5.18_rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        x86/msi: Fix msi message data shadow struct
        x86/extable: Prefer local labels in .set directives
        x86,bpf: Avoid IBT objtool warning
        objtool: Fix SLS validation for kcov tail-call replacement
        objtool: Fix IBT tail-call detection
        x86/bug: Prevent shadowing in __WARN_FLAGS
        x86/mm/tlb: Revert retpoline avoidance approach
      9c6913b7
    • Linus Torvalds's avatar
      Merge tag 'perf_urgent_for_v5.18_rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · b51f86e9
      Linus Torvalds authored
      Pull perf fixes from Borislav Petkov:
      
       - A couple of fixes to cgroup-related handling of perf events
      
       - A couple of fixes to event encoding on Sapphire Rapids
      
       - Pass event caps of inherited events so that perf doesn't fail wrongly
         at fork()
      
       - Add support for a new Raptor Lake CPU
      
      * tag 'perf_urgent_for_v5.18_rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        perf/core: Always set cpuctx cgrp when enable cgroup event
        perf/core: Fix perf_cgroup_switch()
        perf/core: Use perf_cgroup_info->active to check if cgroup is active
        perf/core: Don't pass task around when ctx sched in
        perf/x86/intel: Update the FRONTEND MSR mask on Sapphire Rapids
        perf/x86/intel: Don't extend the pseudo-encoding to GP counters
        perf/core: Inherit event_caps
        perf/x86/uncore: Add Raptor Lake uncore support
        perf/x86/msr: Add Raptor Lake CPU support
        perf/x86/cstate: Add Raptor Lake support
        perf/x86: Add Intel Raptor Lake support
      b51f86e9
    • Linus Torvalds's avatar
      Merge tag 'locking_urgent_for_v5.18_rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 50c94de6
      Linus Torvalds authored
      Pull locking fixes from Borislav Petkov:
      
       - Allow the compiler to optimize away unused percpu accesses and change
         the local_lock_* macros back to inline functions
      
       - A couple of fixes to static call insn patching
      
      * tag 'locking_urgent_for_v5.18_rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        Revert "mm/page_alloc: mark pagesets as __maybe_unused"
        Revert "locking/local_lock: Make the empty local_lock_*() function a macro."
        x86/percpu: Remove volatile from arch_raw_cpu_ptr().
        static_call: Remove __DEFINE_STATIC_CALL macro
        static_call: Properly initialise DEFINE_STATIC_CALL_RET0()
        static_call: Don't make __static_call_return0 static
        x86,static_call: Fix __static_call_return0 for i386
      50c94de6
    • Linus Torvalds's avatar
      Merge tag 'sched_urgent_for_v5.18_rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 7136849e
      Linus Torvalds authored
      Pull scheduler fixes from Borislav Petkov:
      
       - Use the correct static key checking primitive on the IRQ exit path
      
       - Two fixes for the new forceidle balancer
      
      * tag 'sched_urgent_for_v5.18_rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        entry: Fix compile error in dynamic_irqentry_exit_cond_resched()
        sched: Teach the forced-newidle balancer about CPU affinity limitation.
        sched/core: Fix forceidle balancing
      7136849e
    • Linus Torvalds's avatar
      Merge tag 'perf-tools-fixes-for-v5.18-2022-04-09' of... · 1862a69c
      Linus Torvalds authored
      Merge tag 'perf-tools-fixes-for-v5.18-2022-04-09' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux
      
      Pull perf tools fixes from Arnaldo Carvalho de Melo:
      
       - Fix the clang command line option probing and remove some options to
         filter out, fixing the build with the latest clang versions
      
       - Fix 'perf bench' futex and epoll benchmarks to deal with machines
         with more than 1K CPUs
      
       - Fix 'perf test tsc' error message when not supported
      
       - Remap perf ring buffer if there is no space for event, fixing perf
         usage in 32-bit ChromeOS
      
       - Drop objdump stderr to avoid getting stuck waiting for stdout output
         in 'perf annotate'
      
       - Fix up garbled output by now showing unwind error messages when
         augmenting frame in best effort mode
      
       - Fix perf's libperf_print callback, use the va_args eprintf() variant
      
       - Sync vhost and arm64 cputype headers with the kernel sources
      
       - Fix 'perf report --mem-mode' with ARM SPE
      
       - Add missing external commands ('iiostat', etc) to 'perf --list-cmds'
      
      * tag 'perf-tools-fixes-for-v5.18-2022-04-09' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux:
        perf annotate: Drop objdump stderr to avoid getting stuck waiting for stdout output
        perf tools: Add external commands to list-cmds
        perf docs: Add perf-iostat link to manpages
        perf session: Remap buf if there is no space for event
        perf bench: Fix epoll bench to correct usage of affinity for machines with #CPUs > 1K
        perf bench: Fix futex bench to correct usage of affinity for machines with #CPUs > 1K
        perf tools: Fix perf's libperf_print callback
        perf: arm-spe: Fix perf report --mem-mode
        perf unwind: Don't show unwind error messages when augmenting frame pointer stack
        tools headers arm64: Sync arm64's cputype.h with the kernel sources
        perf test tsc: Fix error message when not supported
        perf build: Don't use -ffat-lto-objects in the python feature test when building with clang-13
        perf python: Fix probing for some clang command line options
        tools build: Filter out options and warnings not supported by clang
        tools build: Use $(shell ) instead of `` to get embedded libperl's ccopts
        tools include UAPI: Sync linux/vhost.h with the kernel sources
      1862a69c