Skip to content

Commit 8f5fd92

Browse files
committed
Merge tag 'for-4.16-rc5-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux
Pull btrfs fixes from David Sterba: "There's an important revert in this pull request that needs to go to stable as it causes a corruption on big endian machines. The other fix is for FIEMAP incorrectly reporting shared extents before a sync and one fix for a crash in raid56. So far we got only one report about the BE corruption, the stable kernels were out for like a week, so hopefully the scope of the damage is low" * tag 'for-4.16-rc5-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux: Revert "btrfs: use proper endianness accessors for super_copy" btrfs: add missing initialization in btrfs_check_shared btrfs: Fix NULL pointer exception in find_bio_stripe
2 parents 8757ae2 + 093e037 commit 8f5fd92

File tree

4 files changed

+15
-15
lines changed

4 files changed

+15
-15
lines changed

fs/btrfs/backref.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1519,6 +1519,7 @@ int btrfs_check_shared(struct btrfs_root *root, u64 inum, u64 bytenr)
15191519
if (!node)
15201520
break;
15211521
bytenr = node->val;
1522+
shared.share_count = 0;
15221523
cond_resched();
15231524
}
15241525

fs/btrfs/raid56.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1370,6 +1370,7 @@ static int find_bio_stripe(struct btrfs_raid_bio *rbio,
13701370
stripe_start = stripe->physical;
13711371
if (physical >= stripe_start &&
13721372
physical < stripe_start + rbio->stripe_len &&
1373+
stripe->dev->bdev &&
13731374
bio->bi_disk == stripe->dev->bdev->bd_disk &&
13741375
bio->bi_partno == stripe->dev->bdev->bd_partno) {
13751376
return i;

fs/btrfs/sysfs.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,7 @@ static ssize_t btrfs_nodesize_show(struct kobject *kobj,
423423
{
424424
struct btrfs_fs_info *fs_info = to_fs_info(kobj);
425425

426-
return snprintf(buf, PAGE_SIZE, "%u\n", fs_info->nodesize);
426+
return snprintf(buf, PAGE_SIZE, "%u\n", fs_info->super_copy->nodesize);
427427
}
428428

429429
BTRFS_ATTR(, nodesize, btrfs_nodesize_show);
@@ -433,7 +433,8 @@ static ssize_t btrfs_sectorsize_show(struct kobject *kobj,
433433
{
434434
struct btrfs_fs_info *fs_info = to_fs_info(kobj);
435435

436-
return snprintf(buf, PAGE_SIZE, "%u\n", fs_info->sectorsize);
436+
return snprintf(buf, PAGE_SIZE, "%u\n",
437+
fs_info->super_copy->sectorsize);
437438
}
438439

439440
BTRFS_ATTR(, sectorsize, btrfs_sectorsize_show);
@@ -443,7 +444,8 @@ static ssize_t btrfs_clone_alignment_show(struct kobject *kobj,
443444
{
444445
struct btrfs_fs_info *fs_info = to_fs_info(kobj);
445446

446-
return snprintf(buf, PAGE_SIZE, "%u\n", fs_info->sectorsize);
447+
return snprintf(buf, PAGE_SIZE, "%u\n",
448+
fs_info->super_copy->sectorsize);
447449
}
448450

449451
BTRFS_ATTR(, clone_alignment, btrfs_clone_alignment_show);

fs/btrfs/transaction.c

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1722,23 +1722,19 @@ static void update_super_roots(struct btrfs_fs_info *fs_info)
17221722

17231723
super = fs_info->super_copy;
17241724

1725-
/* update latest btrfs_super_block::chunk_root refs */
17261725
root_item = &fs_info->chunk_root->root_item;
1727-
btrfs_set_super_chunk_root(super, root_item->bytenr);
1728-
btrfs_set_super_chunk_root_generation(super, root_item->generation);
1729-
btrfs_set_super_chunk_root_level(super, root_item->level);
1726+
super->chunk_root = root_item->bytenr;
1727+
super->chunk_root_generation = root_item->generation;
1728+
super->chunk_root_level = root_item->level;
17301729

1731-
/* update latest btrfs_super_block::root refs */
17321730
root_item = &fs_info->tree_root->root_item;
1733-
btrfs_set_super_root(super, root_item->bytenr);
1734-
btrfs_set_super_generation(super, root_item->generation);
1735-
btrfs_set_super_root_level(super, root_item->level);
1736-
1731+
super->root = root_item->bytenr;
1732+
super->generation = root_item->generation;
1733+
super->root_level = root_item->level;
17371734
if (btrfs_test_opt(fs_info, SPACE_CACHE))
1738-
btrfs_set_super_cache_generation(super, root_item->generation);
1735+
super->cache_generation = root_item->generation;
17391736
if (test_bit(BTRFS_FS_UPDATE_UUID_TREE_GEN, &fs_info->flags))
1740-
btrfs_set_super_uuid_tree_generation(super,
1741-
root_item->generation);
1737+
super->uuid_tree_generation = root_item->generation;
17421738
}
17431739

17441740
int btrfs_transaction_in_commit(struct btrfs_fs_info *info)

0 commit comments

Comments
 (0)