Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-15-SP7:Update
btrfsprogs.23274
0001-btrfs-progs-Don-t-BUG_ON-when-write_dev_su...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0001-btrfs-progs-Don-t-BUG_ON-when-write_dev_supers-fails.patch of Package btrfsprogs.23274
From 1e3b033c85d60948b3b949a9cba36a78e5a537b4 Mon Sep 17 00:00:00 2001 From: Qu Wenruo <wqu@suse.com> Date: Thu, 11 Apr 2019 13:24:26 +0800 Subject: [PATCH 1/7] btrfs-progs: Don't BUG_ON() when write_dev_supers() fails [BUG] Since commit "btrfs-progs: disk-io: Flush to ensure super block write is FUA" mkfs-tests/017 will fail like: ====== RUN MUSTFAIL /home/adam/btrfs-progs/mkfs.btrfs -K -f /dev/mapper/btrfs-progs-thin-vol ERROR: failed to write super block for devid 1: flush error: Input/output error disk-io.c:1810: write_all_supers: BUG_ON `ret` triggered, value -5 /home/adam/btrfs-progs/mkfs.btrfs(+0x1e5c1)[0x557a2c83e5c1] /home/adam/btrfs-progs/mkfs.btrfs(+0x1e65f)[0x557a2c83e65f] /home/adam/btrfs-progs/mkfs.btrfs(write_all_supers+0x1ce)[0x557a2c843a8a] /home/adam/btrfs-progs/mkfs.btrfs(write_ctree_super+0x12d)[0x557a2c843be2] /home/adam/btrfs-progs/mkfs.btrfs(btrfs_commit_transaction+0x250)[0x557a2c887c56] /home/adam/btrfs-progs/mkfs.btrfs(+0xc0b1)[0x557a2c82c0b1] /home/adam/btrfs-progs/mkfs.btrfs(main+0x1049)[0x557a2c82e929] /usr/lib/libc.so.6(__libc_start_main+0xf3)[0x7f6689e99223] /home/adam/btrfs-progs/mkfs.btrfs(_start+0x2e)[0x557a2c82b86e] failed (expected): /home/adam/btrfs-progs/mkfs.btrfs -K -f /dev/mapper/btrfs-progs-thin-vol [CAUSE] Just one BUG_ON() in write_all_supers(). [FIX] Just remove the BUG_ON(). Callers of write_all_supers() are already checking the return value. Also since write_all_supers() can return error, make write_ctree_super() callers, btrfs_commit_transaction() and close_ctree_fs_info() to handle the error correctly. Reviewed-by: Nikolay Borisov <nborisov@suse.com> Signed-off-by: Qu Wenruo <wqu@suse.com> --- disk-io.c | 9 +++++++-- transaction.c | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/disk-io.c b/disk-io.c index 8ead97d..da32478 100644 --- a/disk-io.c +++ b/disk-io.c @@ -1652,7 +1652,8 @@ int write_all_supers(struct btrfs_fs_info *fs_info) btrfs_set_super_flags(sb, flags | BTRFS_HEADER_FLAG_WRITTEN); ret = write_dev_supers(fs_info, sb, dev); - BUG_ON(ret); + if (ret < 0) + return ret; } return 0; } @@ -1708,8 +1709,12 @@ int close_ctree_fs_info(struct btrfs_fs_info *fs_info) BUG_ON(ret); ret = __commit_transaction(trans, root); BUG_ON(ret); - write_ctree_super(trans); + ret = write_ctree_super(trans); kfree(trans); + if (ret) { + err = ret; + goto skip_commit; + } } if (fs_info->finalize_on_close) { diff --git a/transaction.c b/transaction.c index e756db3..3a63988 100644 --- a/transaction.c +++ b/transaction.c @@ -197,7 +197,7 @@ commit_tree: __commit_transaction(trans, root); if (ret < 0) goto out; - write_ctree_super(trans); + ret = write_ctree_super(trans); btrfs_finish_extent_commit(trans, fs_info->extent_root, &fs_info->pinned_extents); kfree(trans); -- 2.26.2
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor