mirror of
https://github.com/torvalds/linux.git
synced 2026-07-29 02:31:27 +02:00
for-7.2-rc5-tag
-----BEGIN PGP SIGNATURE-----
iQJPBAABCgA5FiEE8rQSAMVO+zA4DBdWxWXV+ddtWDsFAmpnj88bFIAAAAAABAAO
bWFudTIsMi41KzEuMTIsMiwyAAoJEMVl1fnXbVg7BWYP/3nQdizQL42lDw+HLaQI
hBUuoynJiMHoUEkUi/awuiQHoOaY5/Q4RivJFK5UQDgnJ/mNcT7Zvsh3jikRv5gS
y3nqbK2i8uVo5uvoSKtktEtnv7FmrlXPuYZ8WogujtDpc8zeta+Xs0DIuxCny5E2
P0+o6auah/fbRwEzIilzgM0mR3XvROCwsZxxomONpFQv8tR7lKVCIzAq+syadcSd
7+Uip4lwd9Z59ICoTtrIWIyrm8vjtgvVNM0LTDJ9SMCWBqZAQ5SVdioHvxspgOao
/G4nvdqSRh/7A2t9vreo+vlvosVYdxq7CGNSQXnOe6hj/XqPI+q74Z6Rxehd5sX1
9aAP2tkMfBCHLLdYuLjc4ylwXOB7F9OhpVn+gUIUezysGC9hYLna3NZ3QlwBQoOW
ZoAWupX38z8WEGL9OlSJMAuzonLpVpsv5KQTE0ZKsHQB5P16OQFSRvoIXRPcKpQW
kjgVoBbV8xaXIZDVmzg28Uo8ZMerIuefP636k3fHk6hawtfetg2EYQ54jxWlZ3Du
g0aUso4bBWIilUQf9NS+RnqzYUi/QVVe0JMvlIXKDdLBLPrbyXhtLZuhOuckLsom
LLPEwM45CFCUyp0CBeiUvRGGt3ayFsyLnH1ALzvowtEZwmu1dF+mTNJlqGNOOl1y
mEuaeaNfIGZ3yBTIE0WUtFh9
=kDaM
-----END PGP SIGNATURE-----
Merge tag 'for-7.2-rc5-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux
Pull btrfs fixes from David Sterba:
"Zoned mode:
- fix assertion and handle case of finished zone and truncated extent
- fix zone metadata write pointer on actual zone reset
- fix deadlock caused metadata writeback and transaction commit
- fix return value reuse leading to confusion about chunk
reservations
raid56 scrub:
- fix tracking of sector checksums when there are not checksums found
- fix inverted logic when submitting parity read bio
mount/remount fixes:
- fix leaking 'remount in progress' state which can break other
operations to work (qgroup rescan, autodefrag, reclaim)
- adjust using global block reserve after read-only mount when using
rescue= option
- handle missing raid stripe tree when mounted with 'ignorebadroots'
Misc:
- fix -Wmaybe-uninitialized warning in GET_CSUMS ioctl"
* tag 'for-7.2-rc5-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux:
btrfs: raid56: fix scrub read assembly submitting no reads
btrfs: zoned: skip fully truncated ordered extents at zone finish
btrfs: initialize 'args' to avoid compiler warning in btrfs_ioctl_get_csums()
btrfs: zoned: fix missing chunk metadata reservation
btrfs: raid56: fix an incorrect csum skip during scrub
btrfs: report missing raid stripe tree root during lookup
btrfs: skip global block reserve accounting for rescue mounts
btrfs: zoned: reset meta_write_pointer on zone reset
btrfs: zoned: fix deadlock between metadata writeback and transaction commit
btrfs: fix leaking BTRFS_FS_STATE_REMOUNTING flag
This commit is contained in:
commit
3b5f4b83c4
|
|
@ -4532,25 +4532,29 @@ static void reserve_chunk_space(struct btrfs_trans_handle *trans,
|
|||
if (IS_ERR(bg)) {
|
||||
ret = PTR_ERR(bg);
|
||||
} else {
|
||||
int activate_ret;
|
||||
|
||||
/*
|
||||
* We have a new chunk. We also need to activate it for
|
||||
* zoned filesystem.
|
||||
*/
|
||||
ret = btrfs_zoned_activate_one_bg(info, true);
|
||||
if (ret < 0)
|
||||
return;
|
||||
|
||||
/*
|
||||
* If we fail to add the chunk item here, we end up
|
||||
* trying again at phase 2 of chunk allocation, at
|
||||
* btrfs_create_pending_block_groups(). So ignore
|
||||
* any error here. An ENOSPC here could happen, due to
|
||||
* the cases described at do_chunk_alloc() - the system
|
||||
* block group we just created was just turned into RO
|
||||
* mode by a scrub for example, or a running discard
|
||||
* temporarily removed its free space entries, etc.
|
||||
*/
|
||||
btrfs_chunk_alloc_add_chunk_item(trans, bg);
|
||||
activate_ret = btrfs_zoned_activate_one_bg(info, true);
|
||||
if (activate_ret < 0) {
|
||||
ret = activate_ret;
|
||||
} else {
|
||||
/*
|
||||
* If we fail to add the chunk item here, we end
|
||||
* up trying again at phase 2 of chunk allocation,
|
||||
* at btrfs_create_pending_block_groups(). So
|
||||
* ignore any error here. An ENOSPC here could
|
||||
* happen, due to the cases described at
|
||||
* do_chunk_alloc() - the system block group we
|
||||
* just created was just turned into RO mode by a
|
||||
* scrub for example, or a running discard
|
||||
* temporarily removed its free space entries, etc.
|
||||
*/
|
||||
btrfs_chunk_alloc_add_chunk_item(trans, bg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -322,10 +322,25 @@ void btrfs_block_rsv_add_bytes(struct btrfs_block_rsv *block_rsv,
|
|||
void btrfs_update_global_block_rsv(struct btrfs_fs_info *fs_info)
|
||||
{
|
||||
struct btrfs_block_rsv *block_rsv = &fs_info->global_block_rsv;
|
||||
struct btrfs_space_info *sinfo = block_rsv->space_info;
|
||||
struct btrfs_space_info *sinfo;
|
||||
struct btrfs_root *root, *tmp;
|
||||
u64 num_bytes = btrfs_root_used(&fs_info->tree_root->root_item);
|
||||
unsigned int min_items = 1;
|
||||
u64 num_bytes;
|
||||
|
||||
/*
|
||||
* A full read-only mount (rescue options) cannot start transactions,
|
||||
* so the global reserve is never consumed. Mark it as full and skip
|
||||
* the accounting.
|
||||
*/
|
||||
if (btrfs_is_full_ro(fs_info)) {
|
||||
spin_lock(&block_rsv->lock);
|
||||
block_rsv->full = true;
|
||||
spin_unlock(&block_rsv->lock);
|
||||
return;
|
||||
}
|
||||
|
||||
sinfo = block_rsv->space_info;
|
||||
num_bytes = btrfs_root_used(&fs_info->tree_root->root_item);
|
||||
|
||||
/*
|
||||
* The global block rsv is based on the size of the extent tree, the
|
||||
|
|
|
|||
|
|
@ -3288,15 +3288,6 @@ int btrfs_check_features(struct btrfs_fs_info *fs_info, bool is_rw_mount)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static bool fs_is_full_ro(const struct btrfs_fs_info *fs_info)
|
||||
{
|
||||
if (!sb_rdonly(fs_info->sb))
|
||||
return false;
|
||||
if (unlikely(fs_info->mount_opt & BTRFS_MOUNT_FULL_RO_MASK))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* Try to wait for any metadata readahead, and invalidate all btree folios.
|
||||
*
|
||||
|
|
@ -3462,7 +3453,7 @@ int __cold open_ctree(struct super_block *sb, struct btrfs_fs_devices *fs_device
|
|||
WRITE_ONCE(fs_info->fs_error, -EUCLEAN);
|
||||
|
||||
/* If the fs has any rescue options, no transaction is allowed. */
|
||||
if (fs_is_full_ro(fs_info))
|
||||
if (btrfs_is_full_ro(fs_info))
|
||||
WRITE_ONCE(fs_info->fs_error, -EROFS);
|
||||
|
||||
/* Set up fs_info before parsing mount options */
|
||||
|
|
|
|||
|
|
@ -1159,6 +1159,15 @@ void __btrfs_clear_fs_compat_ro(struct btrfs_fs_info *fs_info, u64 flag,
|
|||
#define btrfs_test_opt(fs_info, opt) ((fs_info)->mount_opt & \
|
||||
BTRFS_MOUNT_##opt)
|
||||
|
||||
static inline bool btrfs_is_full_ro(const struct btrfs_fs_info *fs_info)
|
||||
{
|
||||
if (!sb_rdonly(fs_info->sb))
|
||||
return false;
|
||||
if (unlikely(fs_info->mount_opt & BTRFS_MOUNT_FULL_RO_MASK))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
static inline bool btrfs_fs_closing(const struct btrfs_fs_info *fs_info)
|
||||
{
|
||||
return unlikely(test_bit(BTRFS_FS_CLOSING_START, &fs_info->flags));
|
||||
|
|
|
|||
|
|
@ -5205,7 +5205,7 @@ static int btrfs_ioctl_get_csums(struct file *file, void __user *argp)
|
|||
struct btrfs_inode *inode = BTRFS_I(vfs_inode);
|
||||
struct btrfs_fs_info *fs_info = inode->root->fs_info;
|
||||
struct btrfs_root *root = inode->root;
|
||||
struct btrfs_ioctl_get_csums_args args;
|
||||
struct btrfs_ioctl_get_csums_args args = { 0 };
|
||||
BTRFS_PATH_AUTO_FREE(path);
|
||||
const u64 ino = btrfs_ino(inode);
|
||||
const u32 csum_size = fs_info->csum_size;
|
||||
|
|
|
|||
|
|
@ -414,6 +414,12 @@ int btrfs_get_raid_extent_offset(struct btrfs_fs_info *fs_info,
|
|||
int slot;
|
||||
int ret;
|
||||
|
||||
if (unlikely(!stripe_root)) {
|
||||
btrfs_err_rl(fs_info, "missing raid stripe tree root for logical %llu",
|
||||
logical);
|
||||
return -EUCLEAN;
|
||||
}
|
||||
|
||||
stripe_key.objectid = logical;
|
||||
stripe_key.type = BTRFS_RAID_STRIPE_KEY;
|
||||
stripe_key.offset = 0;
|
||||
|
|
|
|||
|
|
@ -1679,8 +1679,10 @@ static void verify_bio_data_sectors(struct btrfs_raid_bio *rbio,
|
|||
continue;
|
||||
|
||||
/* No csum for this sector, skip to the next sector. */
|
||||
if (!test_bit(total_sector_nr, rbio->csum_bitmap))
|
||||
if (!test_bit(total_sector_nr, rbio->csum_bitmap)) {
|
||||
total_sector_nr++;
|
||||
continue;
|
||||
}
|
||||
|
||||
expected_csum = rbio->csum_buf + total_sector_nr * fs_info->csum_size;
|
||||
btrfs_calculate_block_csum_pages(fs_info, paddrs, csum_buf);
|
||||
|
|
@ -2909,13 +2911,12 @@ static int scrub_assemble_read_bios(struct btrfs_raid_bio *rbio)
|
|||
continue;
|
||||
|
||||
/*
|
||||
* We want to find all the sectors missing from the rbio and
|
||||
* read them from the disk. If sector_paddr_in_rbio() finds a sector
|
||||
* in the bio list we don't need to read it off the stripe.
|
||||
* A parity-scrub rbio carries no data in its bio list: the
|
||||
* only bio there is the empty completion bio added by
|
||||
* raid56_parity_alloc_scrub_rbio(). Every sector is read
|
||||
* from the stripe, so only assert that invariant here.
|
||||
*/
|
||||
paddrs = sector_paddrs_in_rbio(rbio, stripe, sectornr, 1);
|
||||
if (paddrs == NULL)
|
||||
continue;
|
||||
ASSERT(!sector_paddrs_in_rbio(rbio, stripe, sectornr, 1));
|
||||
|
||||
paddrs = rbio_stripe_paddrs(rbio, stripe, sectornr);
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -1520,12 +1520,14 @@ static int btrfs_reconfigure(struct fs_context *fc)
|
|||
sync_filesystem(sb);
|
||||
set_bit(BTRFS_FS_STATE_REMOUNTING, &fs_info->fs_state);
|
||||
|
||||
if (!btrfs_check_options(fs_info, &ctx->mount_opt, fc->sb_flags))
|
||||
return -EINVAL;
|
||||
if (!btrfs_check_options(fs_info, &ctx->mount_opt, fc->sb_flags)) {
|
||||
ret = -EINVAL;
|
||||
goto restore;
|
||||
}
|
||||
|
||||
ret = btrfs_check_features(fs_info, !(fc->sb_flags & SB_RDONLY));
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
goto restore;
|
||||
|
||||
btrfs_ctx_to_info(fs_info, ctx);
|
||||
btrfs_remount_begin(fs_info, old_ctx.mount_opt, fc->sb_flags);
|
||||
|
|
|
|||
|
|
@ -2138,6 +2138,16 @@ void btrfs_finish_ordered_zoned(struct btrfs_ordered_extent *ordered)
|
|||
if (test_bit(BTRFS_ORDERED_PREALLOC, &ordered->flags))
|
||||
return;
|
||||
|
||||
/*
|
||||
* A fully truncated ordered extent wrote no data and so has
|
||||
* no zone append result to record.
|
||||
*/
|
||||
if (test_bit(BTRFS_ORDERED_TRUNCATED, &ordered->flags) &&
|
||||
ordered->truncated_len == 0) {
|
||||
ASSERT(list_empty(&ordered->csum_list));
|
||||
return;
|
||||
}
|
||||
|
||||
ASSERT(!list_empty(&ordered->csum_list));
|
||||
sum = list_first_entry(&ordered->csum_list, struct btrfs_ordered_sum, list);
|
||||
logical = sum->logical;
|
||||
|
|
@ -2190,7 +2200,11 @@ static bool check_bg_is_active(struct btrfs_eb_write_context *ctx,
|
|||
|
||||
if (fs_info->treelog_bg == block_group->start) {
|
||||
if (!btrfs_zone_activate(block_group)) {
|
||||
int ret_fin = btrfs_zone_finish_one_bg(fs_info);
|
||||
int ret_fin;
|
||||
|
||||
btrfs_zoned_meta_io_unlock(fs_info);
|
||||
ret_fin = btrfs_zone_finish_one_bg(fs_info);
|
||||
btrfs_zoned_meta_io_lock(fs_info);
|
||||
|
||||
if (ret_fin != 1 || !btrfs_zone_activate(block_group))
|
||||
return false;
|
||||
|
|
@ -3185,6 +3199,17 @@ int btrfs_reset_unused_block_groups(struct btrfs_space_info *space_info, u64 num
|
|||
reclaimed = bg->alloc_offset;
|
||||
bg->zone_unusable = bg->length - bg->zone_capacity;
|
||||
bg->alloc_offset = 0;
|
||||
/*
|
||||
* The zone was just reset to empty, so alloc_offset went back to
|
||||
* the start of the zone. For metadata/system block groups the
|
||||
* write pointer must follow it back to the start of the zone;
|
||||
* otherwise it stays stale at the previous (finished) zone end,
|
||||
* and metadata written into the reused zone would sit behind the
|
||||
* write pointer, could never be written out in sequential order,
|
||||
* and would be stranded (pinning its folio) until unmount.
|
||||
*/
|
||||
if (bg->flags & (BTRFS_BLOCK_GROUP_METADATA | BTRFS_BLOCK_GROUP_SYSTEM))
|
||||
bg->meta_write_pointer = bg->start;
|
||||
/*
|
||||
* This holds because we currently reset fully used then freed
|
||||
* block group.
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user