for-5.12-rc4-tag
-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEE8rQSAMVO+zA4DBdWxWXV+ddtWDsFAmBctBgACgkQxWXV+ddt WDu1nA//bzuPwW3nO+enE+ipi4t6UJTJpHLeDgdMshWwhBIHVt+oFxTUIt4Zd0kT 0hJ+mbNrZHzmDmzpb6ifQn0D6k+wq6zbsEgLtwgmPmBszaXIw46FvnYnxd9FtCde 9SQzBKa86i/KMkRtaIvpUcunniIo5Aj0Hvu0oPgTKObqiB4HP2nV6rKody+mP9JW RanWbBi0JvI4UE/J2Ud1sNWFdDtVpXpcktj1dsI8gbsYNR05HpM08SEUgeF/ts3I yB/L18I5CUeFHyo/yogbj7kkikugPGsmOj/A86UZ6x3NxWoC+m7UXoGrO2/qlFem qd3ioXZKlnPqeX29kAy/REa3xjE61istlDVC/vckqmXBfYc6WK/KAJvFAGI+/3VI 9HvIbBokUQzekhFlA02RTqGcasStXX7VSeJyzyAbXjGhZQKfFTHR8ZBtrREiVBC9 58K+g8SSqIb/9iJqYV4h82lSBRSdf9kHx7CSB2gOBuifihY+chVr4Xzhq12IlXbK TNlue0BTwYLJStwx2dnY2beLbLG34/4FNRsuAR/9JsCio7Bfj0qN8htIyvfsiMxr mkrH7+Ykd10FqC8uu6MHiW9k428871Era3B97TgyQ0V17ehh4IN0v9V7kckk9EWw 3omaPwuF2FGfFOoTR7ipKO0nDx0/y2knnDSTsWknNG09Ciwa+Ww= =SuJv -----END PGP SIGNATURE----- Merge tag 'for-5.12-rc4-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux Pull btrfs fixes from David Sterba: "Fixes for issues that have some user visibility and are simple enough for this time of development cycle: - a few fixes for rescue= mount option, adding more checks for missing trees - fix sleeping in atomic context on qgroup deletion - fix subvolume deletion on mount - fix build with M= syntax - fix checksum mismatch error message for direct io" * tag 'for-5.12-rc4-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux: btrfs: fix check_data_csum() error message for direct I/O btrfs: fix sleep while in non-sleep context during qgroup removal btrfs: fix subvolume/snapshot deletion not triggered on mount btrfs: fix build when using M=fs/btrfs btrfs: do not initialize dev replace for bad dev root btrfs: initialize device::fs_info always btrfs: do not initialize dev stats if we have no dev_root btrfs: zoned: remove outdated WARN_ON in direct IO
This commit is contained in:
commit
701c09c988
|
@ -7,10 +7,12 @@ subdir-ccflags-y += -Wmissing-format-attribute
|
|||
subdir-ccflags-y += -Wmissing-prototypes
|
||||
subdir-ccflags-y += -Wold-style-definition
|
||||
subdir-ccflags-y += -Wmissing-include-dirs
|
||||
subdir-ccflags-y += $(call cc-option, -Wunused-but-set-variable)
|
||||
subdir-ccflags-y += $(call cc-option, -Wunused-const-variable)
|
||||
subdir-ccflags-y += $(call cc-option, -Wpacked-not-aligned)
|
||||
subdir-ccflags-y += $(call cc-option, -Wstringop-truncation)
|
||||
condflags := \
|
||||
$(call cc-option, -Wunused-but-set-variable) \
|
||||
$(call cc-option, -Wunused-const-variable) \
|
||||
$(call cc-option, -Wpacked-not-aligned) \
|
||||
$(call cc-option, -Wstringop-truncation)
|
||||
subdir-ccflags-y += $(condflags)
|
||||
# The following turn off the warnings enabled by -Wextra
|
||||
subdir-ccflags-y += -Wno-missing-field-initializers
|
||||
subdir-ccflags-y += -Wno-sign-compare
|
||||
|
|
|
@ -81,6 +81,9 @@ int btrfs_init_dev_replace(struct btrfs_fs_info *fs_info)
|
|||
struct btrfs_dev_replace_item *ptr;
|
||||
u64 src_devid;
|
||||
|
||||
if (!dev_root)
|
||||
return 0;
|
||||
|
||||
path = btrfs_alloc_path();
|
||||
if (!path) {
|
||||
ret = -ENOMEM;
|
||||
|
|
|
@ -2387,8 +2387,9 @@ static int btrfs_read_roots(struct btrfs_fs_info *fs_info)
|
|||
} else {
|
||||
set_bit(BTRFS_ROOT_TRACK_DIRTY, &root->state);
|
||||
fs_info->dev_root = root;
|
||||
btrfs_init_devices_late(fs_info);
|
||||
}
|
||||
/* Initialize fs_info for all devices in any case */
|
||||
btrfs_init_devices_late(fs_info);
|
||||
|
||||
/* If IGNOREDATACSUMS is set don't bother reading the csum root. */
|
||||
if (!btrfs_test_opt(fs_info, IGNOREDATACSUMS)) {
|
||||
|
@ -3009,6 +3010,21 @@ int btrfs_start_pre_rw_mount(struct btrfs_fs_info *fs_info)
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* btrfs_find_orphan_roots() is responsible for finding all the dead
|
||||
* roots (with 0 refs), flag them with BTRFS_ROOT_DEAD_TREE and load
|
||||
* them into the fs_info->fs_roots_radix tree. This must be done before
|
||||
* calling btrfs_orphan_cleanup() on the tree root. If we don't do it
|
||||
* first, then btrfs_orphan_cleanup() will delete a dead root's orphan
|
||||
* item before the root's tree is deleted - this means that if we unmount
|
||||
* or crash before the deletion completes, on the next mount we will not
|
||||
* delete what remains of the tree because the orphan item does not
|
||||
* exists anymore, which is what tells us we have a pending deletion.
|
||||
*/
|
||||
ret = btrfs_find_orphan_roots(fs_info);
|
||||
if (ret)
|
||||
goto out;
|
||||
|
||||
ret = btrfs_cleanup_fs_roots(fs_info);
|
||||
if (ret)
|
||||
goto out;
|
||||
|
@ -3068,7 +3084,6 @@ int btrfs_start_pre_rw_mount(struct btrfs_fs_info *fs_info)
|
|||
}
|
||||
}
|
||||
|
||||
ret = btrfs_find_orphan_roots(fs_info);
|
||||
out:
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -3099,11 +3099,13 @@ void btrfs_writepage_endio_finish_ordered(struct page *page, u64 start,
|
|||
* @bio_offset: offset to the beginning of the bio (in bytes)
|
||||
* @page: page where is the data to be verified
|
||||
* @pgoff: offset inside the page
|
||||
* @start: logical offset in the file
|
||||
*
|
||||
* The length of such check is always one sector size.
|
||||
*/
|
||||
static int check_data_csum(struct inode *inode, struct btrfs_io_bio *io_bio,
|
||||
u32 bio_offset, struct page *page, u32 pgoff)
|
||||
u32 bio_offset, struct page *page, u32 pgoff,
|
||||
u64 start)
|
||||
{
|
||||
struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
|
||||
SHASH_DESC_ON_STACK(shash, fs_info->csum_shash);
|
||||
|
@ -3130,8 +3132,8 @@ static int check_data_csum(struct inode *inode, struct btrfs_io_bio *io_bio,
|
|||
kunmap_atomic(kaddr);
|
||||
return 0;
|
||||
zeroit:
|
||||
btrfs_print_data_csum_error(BTRFS_I(inode), page_offset(page) + pgoff,
|
||||
csum, csum_expected, io_bio->mirror_num);
|
||||
btrfs_print_data_csum_error(BTRFS_I(inode), start, csum, csum_expected,
|
||||
io_bio->mirror_num);
|
||||
if (io_bio->device)
|
||||
btrfs_dev_stat_inc_and_print(io_bio->device,
|
||||
BTRFS_DEV_STAT_CORRUPTION_ERRS);
|
||||
|
@ -3184,7 +3186,8 @@ int btrfs_verify_data_csum(struct btrfs_io_bio *io_bio, u32 bio_offset,
|
|||
pg_off += sectorsize, bio_offset += sectorsize) {
|
||||
int ret;
|
||||
|
||||
ret = check_data_csum(inode, io_bio, bio_offset, page, pg_off);
|
||||
ret = check_data_csum(inode, io_bio, bio_offset, page, pg_off,
|
||||
page_offset(page) + pg_off);
|
||||
if (ret < 0)
|
||||
return -EIO;
|
||||
}
|
||||
|
@ -7910,7 +7913,8 @@ static blk_status_t btrfs_check_read_dio_bio(struct inode *inode,
|
|||
ASSERT(pgoff < PAGE_SIZE);
|
||||
if (uptodate &&
|
||||
(!csum || !check_data_csum(inode, io_bio,
|
||||
bio_offset, bvec.bv_page, pgoff))) {
|
||||
bio_offset, bvec.bv_page,
|
||||
pgoff, start))) {
|
||||
clean_io_failure(fs_info, failure_tree, io_tree,
|
||||
start, bvec.bv_page,
|
||||
btrfs_ino(BTRFS_I(inode)),
|
||||
|
@ -8169,10 +8173,6 @@ static blk_qc_t btrfs_submit_direct(struct inode *inode, struct iomap *iomap,
|
|||
bio->bi_end_io = btrfs_end_dio_bio;
|
||||
btrfs_io_bio(bio)->logical = file_offset;
|
||||
|
||||
WARN_ON_ONCE(write && btrfs_is_zoned(fs_info) &&
|
||||
fs_info->max_zone_append_size &&
|
||||
bio_op(bio) != REQ_OP_ZONE_APPEND);
|
||||
|
||||
if (bio_op(bio) == REQ_OP_ZONE_APPEND) {
|
||||
status = extract_ordered_extent(BTRFS_I(inode), bio,
|
||||
file_offset);
|
||||
|
|
|
@ -226,7 +226,6 @@ static void __del_qgroup_rb(struct btrfs_fs_info *fs_info,
|
|||
{
|
||||
struct btrfs_qgroup_list *list;
|
||||
|
||||
btrfs_sysfs_del_one_qgroup(fs_info, qgroup);
|
||||
list_del(&qgroup->dirty);
|
||||
while (!list_empty(&qgroup->groups)) {
|
||||
list = list_first_entry(&qgroup->groups,
|
||||
|
@ -243,7 +242,6 @@ static void __del_qgroup_rb(struct btrfs_fs_info *fs_info,
|
|||
list_del(&list->next_member);
|
||||
kfree(list);
|
||||
}
|
||||
kfree(qgroup);
|
||||
}
|
||||
|
||||
/* must be called with qgroup_lock held */
|
||||
|
@ -569,6 +567,8 @@ void btrfs_free_qgroup_config(struct btrfs_fs_info *fs_info)
|
|||
qgroup = rb_entry(n, struct btrfs_qgroup, node);
|
||||
rb_erase(n, &fs_info->qgroup_tree);
|
||||
__del_qgroup_rb(fs_info, qgroup);
|
||||
btrfs_sysfs_del_one_qgroup(fs_info, qgroup);
|
||||
kfree(qgroup);
|
||||
}
|
||||
/*
|
||||
* We call btrfs_free_qgroup_config() when unmounting
|
||||
|
@ -1578,6 +1578,14 @@ int btrfs_remove_qgroup(struct btrfs_trans_handle *trans, u64 qgroupid)
|
|||
spin_lock(&fs_info->qgroup_lock);
|
||||
del_qgroup_rb(fs_info, qgroupid);
|
||||
spin_unlock(&fs_info->qgroup_lock);
|
||||
|
||||
/*
|
||||
* Remove the qgroup from sysfs now without holding the qgroup_lock
|
||||
* spinlock, since the sysfs_remove_group() function needs to take
|
||||
* the mutex kernfs_mutex through kernfs_remove_by_name_ns().
|
||||
*/
|
||||
btrfs_sysfs_del_one_qgroup(fs_info, qgroup);
|
||||
kfree(qgroup);
|
||||
out:
|
||||
mutex_unlock(&fs_info->qgroup_ioctl_lock);
|
||||
return ret;
|
||||
|
|
|
@ -7448,6 +7448,9 @@ static int btrfs_device_init_dev_stats(struct btrfs_device *device,
|
|||
int item_size;
|
||||
int i, ret, slot;
|
||||
|
||||
if (!device->fs_info->dev_root)
|
||||
return 0;
|
||||
|
||||
key.objectid = BTRFS_DEV_STATS_OBJECTID;
|
||||
key.type = BTRFS_PERSISTENT_ITEM_KEY;
|
||||
key.offset = device->devid;
|
||||
|
|
Loading…
Reference in New Issue