Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'xfs-fixes-6.15-rc7' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux

Pull xfs fixes from Carlos Maiolino:
"This includes a bug fix for a possible data corruption vector on the
zoned allocator garbage collector"

* tag 'xfs-fixes-6.15-rc7' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux:
xfs: Fix comment on xfs_trans_ail_update_bulk()
xfs: Fix a comment on xfs_ail_delete
xfs: Fail remount with noattr2 on a v5 with v4 enabled
xfs: fix zoned GC data corruption due to wrong bv_offset
xfs: free up mp->m_free[0].count in error case

+48 -19
+27 -1
fs/xfs/xfs_super.c
··· 1149 1149 return 0; 1150 1150 1151 1151 free_freecounters: 1152 - while (--i > 0) 1152 + while (--i >= 0) 1153 1153 percpu_counter_destroy(&mp->m_free[i].count); 1154 1154 percpu_counter_destroy(&mp->m_delalloc_rtextents); 1155 1155 free_delalloc: ··· 2114 2114 if (error) 2115 2115 return error; 2116 2116 2117 + /* attr2 -> noattr2 */ 2118 + if (xfs_has_noattr2(new_mp)) { 2119 + if (xfs_has_crc(mp)) { 2120 + xfs_warn(mp, 2121 + "attr2 is always enabled for a V5 filesystem - can't be changed."); 2122 + return -EINVAL; 2123 + } 2124 + mp->m_features &= ~XFS_FEAT_ATTR2; 2125 + mp->m_features |= XFS_FEAT_NOATTR2; 2126 + } else if (xfs_has_attr2(new_mp)) { 2127 + /* noattr2 -> attr2 */ 2128 + mp->m_features &= ~XFS_FEAT_NOATTR2; 2129 + mp->m_features |= XFS_FEAT_ATTR2; 2130 + } 2131 + 2117 2132 /* inode32 -> inode64 */ 2118 2133 if (xfs_has_small_inums(mp) && !xfs_has_small_inums(new_mp)) { 2119 2134 mp->m_features &= ~XFS_FEAT_SMALL_INUMS; ··· 2140 2125 mp->m_features |= XFS_FEAT_SMALL_INUMS; 2141 2126 mp->m_maxagi = xfs_set_inode_alloc(mp, mp->m_sb.sb_agcount); 2142 2127 } 2128 + 2129 + /* 2130 + * Now that mp has been modified according to the remount options, we 2131 + * do a final option validation with xfs_finish_flags() just like it is 2132 + * just like it is done during mount. We cannot use 2133 + * done during mount. We cannot use xfs_finish_flags() on new_mp as it 2134 + * contains only the user given options. 2135 + */ 2136 + error = xfs_finish_flags(mp); 2137 + if (error) 2138 + return error; 2143 2139 2144 2140 /* ro -> rw */ 2145 2141 if (xfs_is_readonly(mp) && !(flags & SB_RDONLY)) {
+18 -16
fs/xfs/xfs_trans_ail.c
··· 315 315 } 316 316 317 317 /* 318 - * Delete the given item from the AIL. Return a pointer to the item. 318 + * Delete the given item from the AIL. 319 319 */ 320 320 static void 321 321 xfs_ail_delete( ··· 777 777 } 778 778 779 779 /* 780 - * xfs_trans_ail_update - bulk AIL insertion operation. 780 + * xfs_trans_ail_update_bulk - bulk AIL insertion operation. 781 781 * 782 - * @xfs_trans_ail_update takes an array of log items that all need to be 782 + * @xfs_trans_ail_update_bulk takes an array of log items that all need to be 783 783 * positioned at the same LSN in the AIL. If an item is not in the AIL, it will 784 - * be added. Otherwise, it will be repositioned by removing it and re-adding 785 - * it to the AIL. If we move the first item in the AIL, update the log tail to 786 - * match the new minimum LSN in the AIL. 784 + * be added. Otherwise, it will be repositioned by removing it and re-adding 785 + * it to the AIL. 787 786 * 788 - * This function takes the AIL lock once to execute the update operations on 789 - * all the items in the array, and as such should not be called with the AIL 790 - * lock held. As a result, once we have the AIL lock, we need to check each log 791 - * item LSN to confirm it needs to be moved forward in the AIL. 787 + * If we move the first item in the AIL, update the log tail to match the new 788 + * minimum LSN in the AIL. 792 789 * 793 - * To optimise the insert operation, we delete all the items from the AIL in 794 - * the first pass, moving them into a temporary list, then splice the temporary 795 - * list into the correct position in the AIL. This avoids needing to do an 796 - * insert operation on every item. 790 + * This function should be called with the AIL lock held. 797 791 * 798 - * This function must be called with the AIL lock held. The lock is dropped 799 - * before returning. 792 + * To optimise the insert operation, we add all items to a temporary list, then 793 + * splice this list into the correct position in the AIL. 794 + * 795 + * Items that are already in the AIL are first deleted from their current 796 + * location before being added to the temporary list. 797 + * 798 + * This avoids needing to do an insert operation on every item. 799 + * 800 + * The AIL lock is dropped by xfs_ail_update_finish() before returning to 801 + * the caller. 800 802 */ 801 803 void 802 804 xfs_trans_ail_update_bulk(
+3 -2
fs/xfs/xfs_zone_gc.c
··· 807 807 { 808 808 struct xfs_zone_gc_data *data = chunk->data; 809 809 struct xfs_mount *mp = chunk->ip->i_mount; 810 - unsigned int folio_offset = chunk->bio.bi_io_vec->bv_offset; 810 + phys_addr_t bvec_paddr = 811 + bvec_phys(bio_first_bvec_all(&chunk->bio)); 811 812 struct xfs_gc_bio *split_chunk; 812 813 813 814 if (chunk->bio.bi_status) ··· 823 822 824 823 bio_reset(&chunk->bio, mp->m_rtdev_targp->bt_bdev, REQ_OP_WRITE); 825 824 bio_add_folio_nofail(&chunk->bio, chunk->scratch->folio, chunk->len, 826 - folio_offset); 825 + offset_in_folio(chunk->scratch->folio, bvec_paddr)); 827 826 828 827 while ((split_chunk = xfs_zone_gc_split_write(data, chunk))) 829 828 xfs_zone_gc_submit_write(data, split_chunk);