1. 11 Jul, 2024 17 commits
    • Filipe Manana's avatar
      btrfs: use a regular rb_root instead of cached rb_root for extent_map_tree · 4e660ca3
      Filipe Manana authored
      We are currently using a cached rb_root (struct rb_root_cached) for the
      rb root of struct extent_map_tree. This doesn't offer much of an advantage
      here because:
      
      1) It's only advantage over the regular rb_root is that it caches a
         pointer to the left most node (first node), so a call to
         rb_first_cached() doesn't have to chase pointers until it reaches
         the left most node;
      
      2) We only have two scenarios that access left most node with
         rb_first_cached():
      
            When dropping all extent maps from an inode, during inode eviction;
      
            When iterating over extent maps during the extent map shrinker;
      
      3) In both cases we keep removing extent maps, which causes deletion of
         the left most node so rb_erase_cached() has to call rb_next() to find
         out what's the next left most node and assign it to
         struct rb_root_cached::rb_leftmost;
      
      4) We can do that ourselves in those two uses cases and stop using a
         rb_root_cached rb tree and use instead a regular rb_root rb tree.
      
         This reduces the size of struct extent_map_tree by 8 bytes and, since
         this structure is embedded in struct btrfs_inode, it also reduces the
         size of that structure by 8 bytes.
      
         So on a 64 bits platform the size of btrfs_inode is reduced from 1032
         bytes down to 1024 bytes.
      
         This means we will be able to have 4 inodes per 4K page instead of 3.
      Signed-off-by: default avatarFilipe Manana <fdmanana@suse.com>
      Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
      Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
      4e660ca3
    • Filipe Manana's avatar
      btrfs: rename rb_root member of extent_map_tree from map to root · 7f5830bc
      Filipe Manana authored
      Currently we name the rb_root member of struct extent_map_tree as 'map',
      which is odd and confusing. Since it's a root node, rename it to 'root'.
      Signed-off-by: default avatarFilipe Manana <fdmanana@suse.com>
      Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
      Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
      7f5830bc
    • Filipe Manana's avatar
      btrfs: remove objectid from struct btrfs_inode on 64 bits platforms · 7a7bc214
      Filipe Manana authored
      On 64 bits platforms we don't really need to have a dedicated member (the
      objectid field) for the inode's number since we store in the VFS inode's
      i_ino member, which is an unsigned long and this type is 64 bits wide on
      64 bits platforms. We only need that field in case we are on a 32 bits
      platform because the unsigned long type is 32 bits wide on such platforms
      See commit 33345d01 ("Btrfs: Always use 64bit inode number") regarding
      this 64/32 bits detail.
      
      The objectid field of struct btrfs_inode is also used to store the ID of
      a root for directories that are stubs for unreferenced roots. In such
      cases the inode is a directory and has the BTRFS_INODE_ROOT_STUB runtime
      flag set.
      
      So in order to reduce the size of btrfs_inode structure on 64 bits
      platforms we can remove the objectid member and use the VFS inode's i_ino
      member instead whenever we need to get the inode number. In case the inode
      is a root stub (BTRFS_INODE_ROOT_STUB set) we can use the member
      last_reflink_trans to store the ID of the unreferenced root, since such
      inode is a directory and reflinks can't be done against directories.
      
      So remove the objectid fields for 64 bits platforms and alias the
      last_reflink_trans field with a name of ref_root_id in a union.
      On a release kernel config, this reduces the size of struct btrfs_inode
      from 1040 bytes down to 1032 bytes.
      Signed-off-by: default avatarFilipe Manana <fdmanana@suse.com>
      Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
      Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
      7a7bc214
    • Filipe Manana's avatar
      btrfs: remove location key from struct btrfs_inode · 068fc8f9
      Filipe Manana authored
      Currently struct btrfs_inode has a key member, named "location", that is
      either:
      
      1) The key of the inode's item. In this case the objectid is the number
         of the inode;
      
      2) A key stored in a dir entry with a type of BTRFS_ROOT_ITEM_KEY, for
         the case where we have a root that is a snapshot of a subvolume that
         points to other subvolumes. In this case the objectid is the ID of
         a subvolume inside the snapshotted parent subvolume.
      
      The key is only used to lookup the inode item for the first case, while
      for the second it's never used since it corresponds to directory stubs
      created with new_simple_dir() and which are marked as dummy, so there's
      no actual inode item to ever update. In the second case we only check
      the key type at btrfs_ino() for 32 bits platforms and its objectid is
      only needed for unlink.
      
      Instead of using a key we can do fine with just the objectid, since we
      can generate the key whenever we need it having only the objectid, as
      in all use cases the type is always BTRFS_INODE_ITEM_KEY and the offset
      is always 0.
      
      So use only an objectid instead of a full key. This reduces the size of
      struct btrfs_inode from 1048 bytes down to 1040 bytes on a release kernel.
      Signed-off-by: default avatarFilipe Manana <fdmanana@suse.com>
      Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
      Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
      068fc8f9
    • Filipe Manana's avatar
      btrfs: don't allocate file extent tree for non regular files · 3d7db6e8
      Filipe Manana authored
      When not using the NO_HOLES feature we always allocate an io tree for an
      inode's file_extent_tree. This is wasteful because that io tree is only
      used for regular files, so we allocate more memory than needed for inodes
      that represent directories or symlinks for example, or for inodes that
      correspond to free space inodes.
      
      So improve on this by allocating the io tree only for inodes of regular
      files that are not free space inodes.
      Reviewed-by: default avatarQu Wenruo <wqu@suse.com>
      Signed-off-by: default avatarFilipe Manana <fdmanana@suse.com>
      Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
      Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
      3d7db6e8
    • Filipe Manana's avatar
      btrfs: unify index_cnt and csum_bytes from struct btrfs_inode · d9891ae2
      Filipe Manana authored
      The index_cnt field of struct btrfs_inode is used only for two purposes:
      
      1) To store the index for the next entry added to a directory;
      
      2) For the data relocation inode to track the logical start address of the
         block group currently being relocated.
      
      For the relocation case we use index_cnt because it's not used for
      anything else in the relocation use case - we could have used other fields
      that are not used by relocation such as defrag_bytes, last_unlink_trans
      or last_reflink_trans for example (among others).
      
      Since the csum_bytes field is not used for directories, do the following
      changes:
      
      1) Put index_cnt and csum_bytes in a union, and index_cnt is only
         initialized when the inode is a directory. The csum_bytes is only
         accessed in IO paths for regular files, so we're fine here;
      
      2) Use the defrag_bytes field for relocation, since the data relocation
         inode is never used for defrag purposes. And to make the naming better,
         alias it to reloc_block_group_start by using a union.
      
      This reduces the size of struct btrfs_inode by 8 bytes in a release
      kernel, from 1056 bytes down to 1048 bytes.
      Reviewed-by: default avatarQu Wenruo <wqu@suse.com>
      Signed-off-by: default avatarFilipe Manana <fdmanana@suse.com>
      Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
      Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
      d9891ae2
    • Filipe Manana's avatar
      btrfs: remove inode_lock from struct btrfs_root and use xarray locks · e2844cce
      Filipe Manana authored
      Currently we use the spinlock inode_lock from struct btrfs_root to
      serialize access to two different data structures:
      
      1) The delayed inodes xarray (struct btrfs_root::delayed_nodes);
      2) The inodes xarray (struct btrfs_root::inodes).
      
      Instead of using our own lock, we can use the spinlock that is part of the
      xarray implementation, by using the xa_lock() and xa_unlock() APIs and
      using the xarray APIs with the double underscore prefix that don't take
      the xarray locks and assume the caller is using xa_lock() and xa_unlock().
      
      So remove the spinlock inode_lock from struct btrfs_root and use the
      corresponding xarray locks. This brings 2 benefits:
      
      1) We reduce the size of struct btrfs_root, from 1336 bytes down to
         1328 bytes on a 64 bits release kernel config;
      
      2) We reduce lock contention by not using anymore the same lock for
         changing two different and unrelated xarrays.
      Reviewed-by: default avatarQu Wenruo <wqu@suse.com>
      Signed-off-by: default avatarFilipe Manana <fdmanana@suse.com>
      Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
      Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
      e2844cce
    • Filipe Manana's avatar
      btrfs: reduce nesting and deduplicate error handling at btrfs_iget_path() · d25f4ec1
      Filipe Manana authored
      Make btrfs_iget_path() simpler and easier to read by avoiding nesting of
      if-then-else statements and having an error label to do all the error
      handling instead of repeating it a couple times.
      Reviewed-by: default avatarQu Wenruo <wqu@suse.com>
      Signed-off-by: default avatarFilipe Manana <fdmanana@suse.com>
      Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
      Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
      d25f4ec1
    • Filipe Manana's avatar
      btrfs: preallocate inodes xarray entry to avoid transaction abort · 061ea858
      Filipe Manana authored
      When creating a new inode, at btrfs_create_new_inode(), one of the very
      last steps is to add the inode to the root's inodes xarray. This often
      requires allocating memory which may fail (even though xarrays have a
      dedicated kmem_cache which make it less likely to fail), and at that point
      we are forced to abort the current transaction (as some, but not all, of
      the inode metadata was added to its subvolume btree).
      
      To avoid a transaction abort, preallocate memory for the xarray early at
      btrfs_create_new_inode(), so that if we fail we don't need to abort the
      transaction and the insertion into the xarray is guaranteed to succeed.
      Reviewed-by: default avatarQu Wenruo <wqu@suse.com>
      Signed-off-by: default avatarFilipe Manana <fdmanana@suse.com>
      Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
      Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
      061ea858
    • Filipe Manana's avatar
      btrfs: use an xarray to track open inodes in a root · 310b2f5d
      Filipe Manana authored
      Currently we use a red black tree (rb-tree) to track the currently open
      inodes of a root (in struct btrfs_root::inode_tree). This however is not
      very efficient when the number of inodes is large since rb-trees are
      binary trees. For example for 100K open inodes, the tree has a depth of
      17. Besides that, inserting into the tree requires navigating through it
      and pulling useless cache lines in the process since the red black tree
      nodes are embedded within the btrfs inode - on the other hand, by being
      embedded, it requires no extra memory allocations.
      
      We can improve this by using an xarray instead, which is efficient when
      indices are densely clustered (such as inode numbers), is more cache
      friendly and behaves like a resizable array, with a much better search
      and insertion complexity than a red black tree. This only has one small
      disadvantage which is that insertion will sometimes require allocating
      memory for the xarray - which may fail (not that often since it uses a
      kmem_cache) - but on the other hand we can reduce the btrfs inode
      structure size by 24 bytes (from 1080 down to 1056 bytes) after removing
      the embedded red black tree node, which after the next patches will allow
      to reduce the size of the structure to 1024 bytes, meaning we will be able
      to store 4 inodes per 4K page instead of 3 inodes.
      
      This change does a straightforward change to use an xarray, and results
      in a transaction abort if we can't allocate memory for the xarray when
      creating an inode - but the next patch changes things so that we don't
      need to abort.
      
      Running the following fs_mark test showed some improvements:
      
          $ cat test.sh
          #!/bin/bash
      
          DEV=/dev/nullb0
          MNT=/mnt/nullb0
          MOUNT_OPTIONS="-o ssd"
          FILES=100000
          THREADS=$(nproc --all)
      
          echo "performance" | \
              tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
      
          mkfs.btrfs -f $DEV
          mount $MOUNT_OPTIONS $DEV $MNT
      
          OPTS="-S 0 -L 5 -n $FILES -s 0 -t $THREADS -k"
          for ((i = 1; i <= $THREADS; i++)); do
              OPTS="$OPTS -d $MNT/d$i"
          done
      
          fs_mark $OPTS
      
          umount $MNT
      
      Before this patch:
      
          FSUse%        Count         Size    Files/sec     App Overhead
              10      1200000            0      92081.6         12505547
              16      2400000            0     138222.6         13067072
              23      3600000            0     148833.1         13290336
              43      4800000            0      97864.7         13931248
              53      6000000            0      85597.3         14384313
      
      After this patch:
      
          FSUse%        Count         Size    Files/sec     App Overhead
              10      1200000            0      93225.1         12571078
              16      2400000            0     146720.3         12805007
              23      3600000            0     160626.4         13073835
              46      4800000            0     116286.2         13802927
              53      6000000            0      90087.9         14754892
      
      The test was run with a release kernel config (Debian's default config).
      
      Also capturing the insertion times into the rb tree and into the xarray,
      that is measuring the duration of the old function inode_tree_add() and
      the duration of the new btrfs_add_inode_to_root() function, gave the
      following results (in nanoseconds):
      
      Before this patch, inode_tree_add() execution times:
      
         Count: 5000000
         Range:  0.000 - 5536887.000; Mean: 775.674; Median: 729.000; Stddev: 4820.961
         Percentiles:  90th: 1015.000; 95th: 1139.000; 99th: 1397.000
               0.000 -       7.816:      40 |
               7.816 -      37.858:     209 |
              37.858 -     170.278:    6059 |
             170.278 -     753.961: 2754890 #####################################################
             753.961 -    3326.728: 2232312 ###########################################
            3326.728 -   14667.018:    4366 |
           14667.018 -   64652.943:     852 |
           64652.943 -  284981.761:     550 |
          284981.761 - 1256150.914:     221 |
         1256150.914 - 5536887.000:       7 |
      
      After this patch, btrfs_add_inode_to_root() execution times:
      
         Count: 5000000
         Range:  0.000 - 2900652.000; Mean: 272.148; Median: 241.000; Stddev: 2873.369
         Percentiles:  90th: 342.000; 95th: 432.000; 99th: 572.000
              0.000 -       7.264:     104 |
              7.264 -      33.145:     352 |
             33.145 -     140.081:  109606 #
            140.081 -     581.930: 4840090 #####################################################
            581.930 -    2407.590:   43532 |
           2407.590 -    9950.979:    2245 |
           9950.979 -   41119.278:     514 |
          41119.278 -  169902.616:     155 |
         169902.616 -  702018.539:      47 |
         702018.539 - 2900652.000:       9 |
      
      Average, percentiles, standard deviation, etc, are all much better.
      Reviewed-by: default avatarQu Wenruo <wqu@suse.com>
      Signed-off-by: default avatarFilipe Manana <fdmanana@suse.com>
      Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
      Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
      310b2f5d
    • Qu Wenruo's avatar
      btrfs: raid56: do extra dumping for CONFIG_BTRFS_ASSERT · bbbee460
      Qu Wenruo authored
      There are several hard-to-hit ASSERT()s hit inside raid56.
      Unfortunately the ASSERT() expression is a little complex, and except
      the ASSERT(), there is nothing to provide any clue.
      
      Considering if race is involved, it's pretty hard to reproduce.
      Meanwhile sometimes the dump of the rbio structure can provide some
      pretty good clues, it's worth to do the extra multi-line dump for
      btrfs raid56 related code.
      
      The dump looks like this:
      
        BTRFS critical (device dm-3): bioc logical=4598530048 full_stripe=4598530048 size=0 map_type=0x81 mirror=0 replace_nr_stripes=0 replace_stripe_src=-1 num_stripes=5
        BTRFS critical (device dm-3):     nr=0 devid=1 physical=1166147584
        BTRFS critical (device dm-3):     nr=1 devid=2 physical=1145176064
        BTRFS critical (device dm-3):     nr=2 devid=4 physical=1145176064
        BTRFS critical (device dm-3):     nr=3 devid=5 physical=1145176064
        BTRFS critical (device dm-3):     nr=4 devid=3 physical=1145176064
        BTRFS critical (device dm-3): rbio flags=0x0 nr_sectors=80 nr_data=4 real_stripes=5 stripe_nsectors=16 scrubp=0 dbitmap=0x0
        BTRFS critical (device dm-3): logical=4598530048
        assertion failed: orig_logical >= full_stripe_start && orig_logical + orig_len <= full_stripe_start + rbio->nr_data * BTRFS_STRIPE_LEN, in fs/btrfs/raid56.c:1702
      Reviewed-by: default avatarFilipe Manana <fdmanana@suse.com>
      Signed-off-by: default avatarQu Wenruo <wqu@suse.com>
      Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
      Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
      bbbee460
    • Filipe Manana's avatar
      btrfs: fix function name in comment for btrfs_remove_ordered_extent() · 3441b070
      Filipe Manana authored
      Due to a refactoring introduced by commit 53d9981c ("btrfs: split
      btrfs_alloc_ordered_extent to allocation and insertion helpers"), the
      function btrfs_alloc_ordered_extent() was renamed to
      alloc_ordered_extent(), so the comment at btrfs_remove_ordered_extent()
      is no longer very accurate. Update the comment to refer to the new
      name "alloc_ordered_extent()".
      Reviewed-by: default avatarQu Wenruo <wqu@suse.com>
      Signed-off-by: default avatarFilipe Manana <fdmanana@suse.com>
      Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
      Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
      3441b070
    • Filipe Manana's avatar
      btrfs: fix misspelled end IO compression callbacks · 416d6ab4
      Filipe Manana authored
      Fix typo in the end IO compression callbacks, from "comprssed" to
      "compressed".
      Reviewed-by: default avatarQu Wenruo <wqu@suse.com>
      Signed-off-by: default avatarFilipe Manana <fdmanana@suse.com>
      Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
      Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
      416d6ab4
    • Filipe Manana's avatar
      btrfs: remove no longer used btrfs_migrate_to_delayed_refs_rsv() · d153fc55
      Filipe Manana authored
      The function btrfs_migrate_to_delayed_refs_rsv() is no longer used.
      Its last use was removed in commit 2f6397e4 ("btrfs: don't refill
      whole delayed refs block reserve when starting transaction").
      So remove the function.
      Reviewed-by: default avatarQu Wenruo <wqu@suse.com>
      Signed-off-by: default avatarFilipe Manana <fdmanana@suse.com>
      Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
      Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
      d153fc55
    • Filipe Manana's avatar
      btrfs: zoned: make btrfs_get_dev_zone() static · 55a2f388
      Filipe Manana authored
      It's not used outside zoned.c, so make it static.
      Reviewed-by: default avatarJohannes Thumshirn <johannes.thumshirn@wdc.com>
      Signed-off-by: default avatarFilipe Manana <fdmanana@suse.com>
      Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
      Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
      55a2f388
    • Johannes Thumshirn's avatar
      btrfs: pass struct btrfs_io_geometry into handle_ops_on_dev_replace() · 3ef6adef
      Johannes Thumshirn authored
      Passing in a 'struct btrfs_io_geometry into handle_ops_on_dev_replace
      can reduce the number of arguments by two.
      
      No functional changes otherwise.
      Reviewed-by: default avatarFilipe Manana <fdmanana@suse.com>
      Signed-off-by: default avatarJohannes Thumshirn <johannes.thumshirn@wdc.com>
      Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
      Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
      3ef6adef
    • David Sterba's avatar
      btrfs: qgroup: do quick checks if quotas are enabled before starting ioctls · 34064fc3
      David Sterba authored
      The ioctls that add relations, create qgroups or set limits start/join
      transaction. When quotas are not enabled this is not necessary, there
      will be errors reported back anyway but this could be also misleading
      and we should really report that quotas are not enabled. For that use
      -ENOTCONN.
      
      The helper is meant to do a quick check before any other standard ioctl
      checks are done. If quota is disabled meanwhile we still rely on proper
      locking inside any active operation changing the qgroup structures.
      Reviewed-by: default avatarAnand Jain <anand.jain@oracle.com>
      Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
      34064fc3
  2. 07 Jul, 2024 3 commits
    • Linus Torvalds's avatar
      Linux 6.10-rc7 · 256abd8e
      Linus Torvalds authored
      256abd8e
    • Linus Torvalds's avatar
      Merge tag 'clk-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/clk/linux · 5a4bd506
      Linus Torvalds authored
      Pull clk fixes from Stephen Boyd:
       "A set of clk fixes for the Qualcomm, Mediatek, and Allwinner drivers:
      
         - Fix the Qualcomm Stromer Plus PLL set_rate() clk_op to explicitly
           set the alpha enable bit and not set bits that don't exist
      
         - Mark Qualcomm IPQ9574 crypto clks as voted to avoid stuck clk
           warnings
      
         - Fix the parent of some PLLs on Qualcomm sm6530 so their rate is
           correct
      
         - Fix the min/max rate clamping logic in the Allwinner driver that
           got broken in v6.9
      
         - Limit runtime PM enabling in the Mediatek driver to only
           mt8183-mfgcfg so that system wide resume doesn't break on other
           Mediatek SoCs"
      
      * tag 'clk-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/clk/linux:
        clk: mediatek: mt8183: Only enable runtime PM on mt8183-mfgcfg
        clk: sunxi-ng: common: Don't call hw_to_ccu_common on hw without common
        clk: qcom: gcc-ipq9574: Add BRANCH_HALT_VOTED flag
        clk: qcom: apss-ipq-pll: remove 'config_ctl_hi_val' from Stromer pll configs
        clk: qcom: clk-alpha-pll: set ALPHA_EN bit for Stromer Plus PLLs
        clk: qcom: gcc-sm6350: Fix gpll6* & gpll7 parents
      5a4bd506
    • Linus Torvalds's avatar
      Merge tag 'powerpc-6.10-4' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux · c6653f49
      Linus Torvalds authored
      Pull powerpc fixes from Michael Ellerman:
      
       - Fix unnecessary copy to 0 when kernel is booted at address 0
      
       - Fix usercopy crash when dumping dtl via debugfs
      
       - Avoid possible crash when PCI hotplug races with error handling
      
       - Fix kexec crash caused by scv being disabled before other CPUs
         call-in
      
       - Fix powerpc selftests build with USERCFLAGS set
      
      Thanks to Anjali K, Ganesh Goudar, Gautam Menghani, Jinglin Wen,
      Nicholas Piggin, Sourabh Jain, Srikar Dronamraju, and Vishal Chourasia.
      
      * tag 'powerpc-6.10-4' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux:
        selftests/powerpc: Fix build with USERCFLAGS set
        powerpc/pseries: Fix scv instruction crash with kexec
        powerpc/eeh: avoid possible crash when edev->pdev changes
        powerpc/pseries: Whitelist dtl slub object for copying to userspace
        powerpc/64s: Fix unnecessary copy to 0 when kernel is booted at address 0
      c6653f49
  3. 06 Jul, 2024 3 commits
    • Linus Torvalds's avatar
      Merge tag '6.10-rc6-smb3-client-fix' of git://git.samba.org/sfrench/cifs-2.6 · 256fdd4b
      Linus Torvalds authored
      Pull smb client fix from Steve French:
       "Fix for smb3 readahead performance regression"
      
      * tag '6.10-rc6-smb3-client-fix' of git://git.samba.org/sfrench/cifs-2.6:
        cifs: Fix read-performance regression by dropping readahead expansion
      256fdd4b
    • Linus Torvalds's avatar
      Merge tag 'i2c-for-6.10-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux · 22f902df
      Linus Torvalds authored
      Pull i2c fix from Wolfram Sang:
       "An i2c driver fix"
      
      * tag 'i2c-for-6.10-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux:
        i2c: pnx: Fix potential deadlock warning from del_timer_sync() call in isr
      22f902df
    • Michael Ellerman's avatar
      selftests/powerpc: Fix build with USERCFLAGS set · 8b7f59de
      Michael Ellerman authored
      Currently building the powerpc selftests with USERCFLAGS set to anything
      causes the build to break:
      
        $ make -C tools/testing/selftests/powerpc V=1 USERCFLAGS=-Wno-error
        ...
        gcc -Wno-error    cache_shape.c ...
        cache_shape.c:18:10: fatal error: utils.h: No such file or directory
           18 | #include "utils.h"
              |          ^~~~~~~~~
        compilation terminated.
      
      This happens because the USERCFLAGS are added to CFLAGS in lib.mk, which
      causes the check of CFLAGS in powerpc/flags.mk to skip setting CFLAGS at
      all, resulting in none of the usual CFLAGS being passed. That can
      be seen in the output above, the only flag passed to the compiler is
      -Wno-error.
      
      Fix it by dropping the conditional setting of CFLAGS in flags.mk.
      Instead always set CFLAGS, but also append USERCFLAGS if they are set.
      
      Note that appending to CFLAGS (with +=) wouldn't work, because flags.mk
      is included by multiple Makefiles (to support partial builds), causing
      CFLAGS to be appended to multiple times. Additionally that would place
      the USERCFLAGS prior to the standard CFLAGS, meaning the USERCFLAGS
      couldn't override the standard flags. Being able to override the
      standard flags is desirable, for example for adding -Wno-error.
      
      With the fix in place, the CFLAGS are set correctly, including the
      USERCFLAGS:
      
        $ make -C tools/testing/selftests/powerpc V=1 USERCFLAGS=-Wno-error
        ...
        gcc -std=gnu99 -O2 -Wall -Werror -DGIT_VERSION='"v6.10-rc2-7-gdea17e7e56c3"'
        -I/home/michael/linux/tools/testing/selftests/powerpc/include -Wno-error
        cache_shape.c ...
      
      Fixes: 5553a793 ("selftests/powerpc: Add flags.mk to support pmu buildable")
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      Link: https://msgid.link/20240706120833.909853-1-mpe@ellerman.id.au
      8b7f59de
  4. 05 Jul, 2024 11 commits
  5. 04 Jul, 2024 6 commits
    • Jarkko Sakkinen's avatar
      tpm: Address !chip->auth in tpm_buf_append_hmac_session*() · 7ca110f2
      Jarkko Sakkinen authored
      Unless tpm_chip_bootstrap() was called by the driver, !chip->auth can
      cause a null derefence in tpm_buf_hmac_session*().  Thus, address
      !chip->auth in tpm_buf_hmac_session*() and remove the fallback
      implementation for !TCG_TPM2_HMAC.
      
      Cc: stable@vger.kernel.org # v6.9+
      Reported-by: default avatarStefan Berger <stefanb@linux.ibm.com>
      Closes: https://lore.kernel.org/linux-integrity/20240617193408.1234365-1-stefanb@linux.ibm.com/
      Fixes: 1085b827 ("tpm: Add the rest of the session HMAC API")
      Tested-by: Michael Ellerman <mpe@ellerman.id.au> # ppc
      Signed-off-by: default avatarJarkko Sakkinen <jarkko@kernel.org>
      7ca110f2
    • Jarkko Sakkinen's avatar
      tpm: Address !chip->auth in tpm_buf_append_name() · a61809a3
      Jarkko Sakkinen authored
      Unless tpm_chip_bootstrap() was called by the driver, !chip->auth can
      cause a null derefence in tpm_buf_append_name().  Thus, address
      !chip->auth in tpm_buf_append_name() and remove the fallback
      implementation for !TCG_TPM2_HMAC.
      
      Cc: stable@vger.kernel.org # v6.10+
      Reported-by: default avatarStefan Berger <stefanb@linux.ibm.com>
      Closes: https://lore.kernel.org/linux-integrity/20240617193408.1234365-1-stefanb@linux.ibm.com/
      Fixes: d0a25bb9 ("tpm: Add HMAC session name/handle append")
      Tested-by: Michael Ellerman <mpe@ellerman.id.au> # ppc
      Signed-off-by: default avatarJarkko Sakkinen <jarkko@kernel.org>
      a61809a3
    • Jarkko Sakkinen's avatar
      tpm: Address !chip->auth in tpm2_*_auth_session() · 25ee48a5
      Jarkko Sakkinen authored
      Unless tpm_chip_bootstrap() was called by the driver, !chip->auth can cause
      a null derefence in tpm2_*_auth_session(). Thus, address !chip->auth in
      tpm2_*_auth_session().
      
      Cc: stable@vger.kernel.org # v6.9+
      Reported-by: default avatarStefan Berger <stefanb@linux.ibm.com>
      Closes: https://lore.kernel.org/linux-integrity/20240617193408.1234365-1-stefanb@linux.ibm.com/
      Fixes: 699e3efd ("tpm: Add HMAC session start and end functions")
      Tested-by: Michael Ellerman <mpe@ellerman.id.au> # ppc
      Signed-off-by: default avatarJarkko Sakkinen <jarkko@kernel.org>
      25ee48a5
    • Linus Torvalds's avatar
      Merge tag 'for-6.10-rc6-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux · 661e504d
      Linus Torvalds authored
      Pull btrfs fixes from David Sterba:
      
       - fix folio refcounting when releasing them (encoded write, dummy
         extent buffer)
      
       - fix out of bounds read when checking qgroup inherit data
      
       - fix how configurable chunk size is handled in zoned mode
      
       - in the ref-verify tool, fix uninitialized return value when checking
         extent owner ref and simple quota are not enabled
      
      * tag 'for-6.10-rc6-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux:
        btrfs: fix folio refcount in __alloc_dummy_extent_buffer()
        btrfs: fix folio refcount in btrfs_do_encoded_write()
        btrfs: fix uninitialized return value in the ref-verify tool
        btrfs: always do the basic checks for btrfs_qgroup_inherit structure
        btrfs: zoned: fix calc_available_free_space() for zoned mode
      661e504d
    • Linus Torvalds's avatar
      Merge tag 'net-6.10-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net · 033771c0
      Linus Torvalds authored
      Pull networking fixes from Jakub Kicinski:
       "Including fixes from bluetooth, wireless and netfilter.
      
        There's one fix for power management with Intel's e1000e here,
        Thorsten tells us there's another problem that started in v6.9. We're
        trying to wrap that up but I don't think it's blocking.
      
        Current release - new code bugs:
      
         - wifi: mac80211: disable softirqs for queued frame handling
      
         - af_unix: fix uninit-value in __unix_walk_scc(), with the new
           garbage collection algo
      
        Previous releases - regressions:
      
         - Bluetooth:
            - qca: fix BT enable failure for QCA6390 after warm reboot
            - add quirk to ignore reserved PHY bits in LE Extended Adv Report,
              abused by some Broadcom controllers found on Apple machines
      
         - wifi: wilc1000: fix ies_len type in connect path
      
        Previous releases - always broken:
      
         - tcp: fix DSACK undo in fast recovery to call tcp_try_to_open(),
           avoid premature timeouts
      
         - net: make sure skb_datagram_iter maps fragments page by page, in
           case we somehow get compound highmem mixed in
      
         - eth: bnx2x: fix multiple UBSAN array-index-out-of-bounds when more
           queues are used
      
        Misc:
      
         - MAINTAINERS: Remembering Larry Finger"
      
      * tag 'net-6.10-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (62 commits)
        bnxt_en: Fix the resource check condition for RSS contexts
        mlxsw: core_linecards: Fix double memory deallocation in case of invalid INI file
        inet_diag: Initialize pad field in struct inet_diag_req_v2
        tcp: Don't flag tcp_sk(sk)->rx_opt.saw_unknown for TCP AO.
        selftests: make order checking verbose in msg_zerocopy selftest
        selftests: fix OOM in msg_zerocopy selftest
        ice: use proper macro for testing bit
        ice: Reject pin requests with unsupported flags
        ice: Don't process extts if PTP is disabled
        ice: Fix improper extts handling
        selftest: af_unix: Add test case for backtrack after finalising SCC.
        af_unix: Fix uninit-value in __unix_walk_scc()
        bonding: Fix out-of-bounds read in bond_option_arp_ip_targets_set()
        net: rswitch: Avoid use-after-free in rswitch_poll()
        netfilter: nf_tables: unconditionally flush pending work before notifier
        wifi: iwlwifi: mvm: check vif for NULL/ERR_PTR before dereference
        wifi: iwlwifi: mvm: avoid link lookup in statistics
        wifi: iwlwifi: mvm: don't wake up rx_sync_waitq upon RFKILL
        wifi: iwlwifi: properly set WIPHY_FLAG_SUPPORTS_EXT_KEK_KCK
        wifi: wilc1000: fix ies_len type in connect path
        ...
      033771c0
    • Linus Torvalds's avatar
      Merge tag 's390-6.10-8' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux · d470e9f5
      Linus Torvalds authored
      Pull s390 fixes from Heiko Carstens:
      
       - Fix and add physical to virtual address translations in dasd and
         virtio_ccw drivers. For virtio_ccw this is just a minimal fix.
         More code cleanup will follow.
      
       - Small defconfig updates
      
      * tag 's390-6.10-8' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux:
        s390/dasd: Fix invalid dereferencing of indirect CCW data pointer
        s390/vfio_ccw: Fix target addresses of TIC CCWs
        s390: Update defconfigs
      d470e9f5