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 'for-6.9-rc6-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux

Pull btrfs fixes from David Sterba:

- set correct ram_bytes when splitting ordered extent. This can be
inconsistent on-disk but harmless as it's not used for calculations
and it's only advisory for compression

- fix lockdep splat when taking cleaner mutex in qgroups disable ioctl

- fix missing mutex unlock on error path when looking up sys chunk for
relocation

* tag 'for-6.9-rc6-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux:
btrfs: set correct ram_bytes when splitting ordered extent
btrfs: take the cleaner_mutex earlier in qgroup disable
btrfs: add missing mutex_unlock in btrfs_relocate_sys_chunks()

+40 -16
+30 -3
fs/btrfs/ioctl.c
··· 3758 3758 goto drop_write; 3759 3759 } 3760 3760 3761 - down_write(&fs_info->subvol_sem); 3762 - 3763 3761 switch (sa->cmd) { 3764 3762 case BTRFS_QUOTA_CTL_ENABLE: 3765 3763 case BTRFS_QUOTA_CTL_ENABLE_SIMPLE_QUOTA: 3764 + down_write(&fs_info->subvol_sem); 3766 3765 ret = btrfs_quota_enable(fs_info, sa); 3766 + up_write(&fs_info->subvol_sem); 3767 3767 break; 3768 3768 case BTRFS_QUOTA_CTL_DISABLE: 3769 + /* 3770 + * Lock the cleaner mutex to prevent races with concurrent 3771 + * relocation, because relocation may be building backrefs for 3772 + * blocks of the quota root while we are deleting the root. This 3773 + * is like dropping fs roots of deleted snapshots/subvolumes, we 3774 + * need the same protection. 3775 + * 3776 + * This also prevents races between concurrent tasks trying to 3777 + * disable quotas, because we will unlock and relock 3778 + * qgroup_ioctl_lock across BTRFS_FS_QUOTA_ENABLED changes. 3779 + * 3780 + * We take this here because we have the dependency of 3781 + * 3782 + * inode_lock -> subvol_sem 3783 + * 3784 + * because of rename. With relocation we can prealloc extents, 3785 + * so that makes the dependency chain 3786 + * 3787 + * cleaner_mutex -> inode_lock -> subvol_sem 3788 + * 3789 + * so we must take the cleaner_mutex here before we take the 3790 + * subvol_sem. The deadlock can't actually happen, but this 3791 + * quiets lockdep. 3792 + */ 3793 + mutex_lock(&fs_info->cleaner_mutex); 3794 + down_write(&fs_info->subvol_sem); 3769 3795 ret = btrfs_quota_disable(fs_info); 3796 + up_write(&fs_info->subvol_sem); 3797 + mutex_unlock(&fs_info->cleaner_mutex); 3770 3798 break; 3771 3799 default: 3772 3800 ret = -EINVAL; ··· 3802 3774 } 3803 3775 3804 3776 kfree(sa); 3805 - up_write(&fs_info->subvol_sem); 3806 3777 drop_write: 3807 3778 mnt_drop_write_file(file); 3808 3779 return ret;
+1
fs/btrfs/ordered-data.c
··· 1188 1188 ordered->disk_bytenr += len; 1189 1189 ordered->num_bytes -= len; 1190 1190 ordered->disk_num_bytes -= len; 1191 + ordered->ram_bytes -= len; 1191 1192 1192 1193 if (test_bit(BTRFS_ORDERED_IO_DONE, &ordered->flags)) { 1193 1194 ASSERT(ordered->bytes_left == 0);
+8 -13
fs/btrfs/qgroup.c
··· 1342 1342 lockdep_assert_held_write(&fs_info->subvol_sem); 1343 1343 1344 1344 /* 1345 - * Lock the cleaner mutex to prevent races with concurrent relocation, 1346 - * because relocation may be building backrefs for blocks of the quota 1347 - * root while we are deleting the root. This is like dropping fs roots 1348 - * of deleted snapshots/subvolumes, we need the same protection. 1349 - * 1350 - * This also prevents races between concurrent tasks trying to disable 1351 - * quotas, because we will unlock and relock qgroup_ioctl_lock across 1352 - * BTRFS_FS_QUOTA_ENABLED changes. 1345 + * Relocation will mess with backrefs, so make sure we have the 1346 + * cleaner_mutex held to protect us from relocate. 1353 1347 */ 1354 - mutex_lock(&fs_info->cleaner_mutex); 1348 + lockdep_assert_held(&fs_info->cleaner_mutex); 1355 1349 1356 1350 mutex_lock(&fs_info->qgroup_ioctl_lock); 1357 1351 if (!fs_info->quota_root) ··· 1367 1373 clear_bit(BTRFS_FS_QUOTA_ENABLED, &fs_info->flags); 1368 1374 btrfs_qgroup_wait_for_completion(fs_info, false); 1369 1375 1376 + /* 1377 + * We have nothing held here and no trans handle, just return the error 1378 + * if there is one. 1379 + */ 1370 1380 ret = flush_reservations(fs_info); 1371 1381 if (ret) 1372 - goto out_unlock_cleaner; 1382 + return ret; 1373 1383 1374 1384 /* 1375 1385 * 1 For the root item ··· 1437 1439 btrfs_end_transaction(trans); 1438 1440 else if (trans) 1439 1441 ret = btrfs_commit_transaction(trans); 1440 - out_unlock_cleaner: 1441 - mutex_unlock(&fs_info->cleaner_mutex); 1442 - 1443 1442 return ret; 1444 1443 } 1445 1444
+1
fs/btrfs/volumes.c
··· 3455 3455 * alignment and size). 3456 3456 */ 3457 3457 ret = -EUCLEAN; 3458 + mutex_unlock(&fs_info->reclaim_bgs_lock); 3458 3459 goto error; 3459 3460 } 3460 3461