platform/upstream/btrfs-progs.git
7 years agobtrfs-progs: image: drop useless bug_on
David Sterba [Mon, 3 Oct 2016 13:13:50 +0000 (15:13 +0200)]
btrfs-progs: image: drop useless bug_on

The callers touch 'target', no point checking it inside restore_metadump
again.

Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: image: return negativer error from all paths in mdrestore_init
David Sterba [Mon, 3 Oct 2016 13:11:13 +0000 (15:11 +0200)]
btrfs-progs: image: return negativer error from all paths in mdrestore_init

Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: image: catch zero length extents, avoid endless loop
David Sterba [Mon, 3 Oct 2016 12:52:30 +0000 (14:52 +0200)]
btrfs-progs: image: catch zero length extents, avoid endless loop

If an extent is found to have length 0, we'd loop endlessly in
copy_from_extent_tree. Reproduced by fuzzed image
bko-166361-blocksize-zero.raw within test 002-simple-image .

Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: tests: add fuzzed image with bad parent refs, qgroup-verify
David Sterba [Fri, 30 Sep 2016 16:59:44 +0000 (18:59 +0200)]
btrfs-progs: tests: add fuzzed image with bad parent refs, qgroup-verify

Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: check: better error handling in find_parent_roots
David Sterba [Fri, 30 Sep 2016 16:51:46 +0000 (18:51 +0200)]
btrfs-progs: check: better error handling in find_parent_roots

Fix use-before-sanity-check leading to undefined behaviour and handle
errors more gracefully.

Reported-by: Lukas Lueg <lukas.lueg@gmail.com>
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=156811
Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: tests: add fuzzed images with bad blocksize/lengh of eb
David Sterba [Fri, 30 Sep 2016 14:23:05 +0000 (16:23 +0200)]
btrfs-progs: tests: add fuzzed images with bad blocksize/lengh of eb

Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: more sanity checks in read_tree_block_fs_info
David Sterba [Fri, 30 Sep 2016 14:19:20 +0000 (16:19 +0200)]
btrfs-progs: more sanity checks in read_tree_block_fs_info

If blocksize is 0, it passes the IS_ALIGNED check but fails later as the
length of ebs will be zero.

Reported-by: Lukas Lueg <lukas.lueg@gmail.com>
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=169311
Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: btrfstune: use common message helpers
David Sterba [Fri, 30 Sep 2016 11:00:24 +0000 (13:00 +0200)]
btrfs-progs: btrfstune: use common message helpers

Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: image: use common message helpers
David Sterba [Fri, 30 Sep 2016 11:00:24 +0000 (13:00 +0200)]
btrfs-progs: image: use common message helpers

Usage errors are turned to normal errors.

Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: Remove unnecessary parameter to clear_extent_uptodate
Qu Wenruo [Wed, 28 Sep 2016 08:30:04 +0000 (16:30 +0800)]
btrfs-progs: Remove unnecessary parameter to clear_extent_uptodate

Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: qgroup: Fix regression leads to corrupted qgroup status
Qu Wenruo [Wed, 7 Sep 2016 02:54:19 +0000 (10:54 +0800)]
btrfs-progs: qgroup: Fix regression leads to corrupted qgroup status

Commit 93dabf211d74daf6e3de642bdd887a90a00f7b49
Author: Mark Fasheh <mfasheh@suse.de>
Date:   Fri Jun 17 13:37:48 2016 -0700

    btrfs-progs: check: verify qgroups above level 0

This commit introduced a new regression which corrupts
read_qgroup_status, since it iterate leaf with manually specified slot,
not correct path->slot[0].

This leads to wrong slot[0] and read_qgroup_status() will read out wrong
flags, leading to regression.

Fix read_qgroup_status() by using eb and slot instread of wrong path
strucutre.

Reported-by: Tsutomu Itoh <t-itoh@jp.fujitsu.com>
Cc: Mark Fasheh <mfasheh@suse.de>
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: constify string arguments where appropriate
David Sterba [Thu, 29 Sep 2016 13:12:35 +0000 (15:12 +0200)]
btrfs-progs: constify string arguments where appropriate

Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: don't write to optarg in btrfs_qgroup_parse_sort_string
David Sterba [Thu, 29 Sep 2016 15:25:46 +0000 (17:25 +0200)]
btrfs-progs: don't write to optarg in btrfs_qgroup_parse_sort_string

Dup the string that gets passed to strtok so we don't destroy callers
buffer.

Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: remove stray function declaration
David Sterba [Thu, 29 Sep 2016 15:04:59 +0000 (17:04 +0200)]
btrfs-progs: remove stray function declaration

Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: restore: update help text
David Sterba [Tue, 27 Sep 2016 12:48:39 +0000 (14:48 +0200)]
btrfs-progs: restore: update help text

Make it clear that --xattr restores the xattrs. Fix some whitespace
damage and add an enum for the long-only option.

Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: super-recover: Reuse btrfs_read_dev_super function
Qu Wenruo [Tue, 20 Sep 2016 02:19:02 +0000 (10:19 +0800)]
btrfs-progs: super-recover: Reuse btrfs_read_dev_super function

We have enhanced super block validation check in disk_io.c, while
super-recover doesn't use that function and use a custom one.

That is duplicated, so reuse btrfs_read_dev_super to handle it, which
not only enhanced super check, but also reduce the code length.

Reported-by: hawken <hawken@thehawken.org>
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: Return more meaningful value for btrfs_read_deve_super
Qu Wenruo [Mon, 26 Sep 2016 04:54:26 +0000 (12:54 +0800)]
btrfs-progs: Return more meaningful value for btrfs_read_deve_super

btrfs_read_dev_super() only returns 0 or -1, which doesn't really help,
caller won't know if it's caused by bad superblock or superblock out of
range.

Return -errno if pread64() return -1, and return -EOF if none or part of
the super is read out, and return what check_super() returned.

So caller can get -EIO to catch real corrupted super blocks.

Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: fix user-facing typos in docs and help strings
Nicholas D Steeves [Sun, 25 Sep 2016 01:26:41 +0000 (21:26 -0400)]
btrfs-progs: fix user-facing typos in docs and help strings

Signed-off-by: Nicholas D Steeves <nsteeves@gmail.com>
Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: docs: document exit codes from scrub
Adam Borowski [Fri, 23 Sep 2016 21:51:57 +0000 (23:51 +0200)]
btrfs-progs: docs: document exit codes from scrub

Signed-off-by: Adam Borowski <kilobyte@angband.pl>
Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: move 3rd party kernel library modules to own directory
David Sterba [Fri, 23 Sep 2016 14:09:33 +0000 (16:09 +0200)]
btrfs-progs: move 3rd party kernel library modules to own directory

Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: build: add basic support for subdirectory build
David Sterba [Fri, 23 Sep 2016 14:06:57 +0000 (16:06 +0200)]
btrfs-progs: build: add basic support for subdirectory build

Add explicit target file names and set the top source directory.

Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: tests: add script to scan results for some known runtime errors
David Sterba [Fri, 23 Sep 2016 13:51:28 +0000 (15:51 +0200)]
btrfs-progs: tests: add script to scan results for some known runtime errors

Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: tests: iterate over fuzzed images and test various tools
David Sterba [Fri, 23 Sep 2016 13:38:04 +0000 (15:38 +0200)]
btrfs-progs: tests: iterate over fuzzed images and test various tools

Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: change btrfs_csum_final result param type to u8
Domagoj Tršan [Sat, 17 Sep 2016 23:10:23 +0000 (00:10 +0100)]
btrfs-progs: change btrfs_csum_final result param type to u8

Signed-off-by: Domagoj Tršan <domagoj.trsan@gmail.com>
Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: convert: check source file system state
Lakshmipathi.G [Thu, 15 Sep 2016 12:08:52 +0000 (14:08 +0200)]
btrfs-progs: convert: check source file system state

Signed-off-by: Lakshmipathi.G <Lakshmipathi.G@giis.co.in>
[ add doc note ]
Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: mkfs: remove useless helper
David Sterba [Tue, 13 Sep 2016 10:27:45 +0000 (12:27 +0200)]
btrfs-progs: mkfs: remove useless helper

Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: use PATH_MAX in cmd_inspect_logical_resolve
David Sterba [Tue, 13 Sep 2016 10:13:44 +0000 (12:13 +0200)]
btrfs-progs: use PATH_MAX in cmd_inspect_logical_resolve

Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: remove unused variable in add_inode_items
David Sterba [Tue, 13 Sep 2016 10:03:04 +0000 (12:03 +0200)]
btrfs-progs: remove unused variable in add_inode_items

It hasn't been used since the first commit.

Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: cleanup, kill trivial btrfs_key_type helper
David Sterba [Tue, 13 Sep 2016 10:00:17 +0000 (12:00 +0200)]
btrfs-progs: cleanup, kill trivial btrfs_key_type helper

Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: cleanup, kill trivial btrfs_set_key_type helper
David Sterba [Tue, 13 Sep 2016 09:58:21 +0000 (11:58 +0200)]
btrfs-progs: cleanup, kill trivial btrfs_set_key_type helper

Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: improve error handling in clone_inode_rec
David Sterba [Tue, 13 Sep 2016 09:26:06 +0000 (11:26 +0200)]
btrfs-progs: improve error handling in clone_inode_rec

Cleanup the rb_tree.

Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: corrupt-block: fix assertion condition
David Sterba [Fri, 9 Sep 2016 11:37:35 +0000 (13:37 +0200)]
btrfs-progs: corrupt-block: fix assertion condition

The ->data is no longer a pointer but an embedded array.

Resolves-coverity-id: 1372671
Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: check: switch some messages to common helpers
David Sterba [Thu, 8 Sep 2016 16:31:10 +0000 (18:31 +0200)]
btrfs-progs: check: switch some messages to common helpers

Switch the messages that do not come from the actual image checking,
more like the parameter verification.

Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: image: switch to common message helpers
David Sterba [Thu, 8 Sep 2016 13:57:42 +0000 (15:57 +0200)]
btrfs-progs: image: switch to common message helpers

Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: convert: improve error handling in do_rollback
David Sterba [Thu, 8 Sep 2016 09:22:48 +0000 (11:22 +0200)]
btrfs-progs: convert: improve error handling in do_rollback

Handle transaction errors.

Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: check: improve error handling in add_extent_rec_nolookup
David Sterba [Thu, 8 Sep 2016 09:20:11 +0000 (11:20 +0200)]
btrfs-progs: check: improve error handling in add_extent_rec_nolookup

Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: check: handle errors returned by add_extent_rec_nolookup
David Sterba [Thu, 8 Sep 2016 09:18:24 +0000 (11:18 +0200)]
btrfs-progs: check: handle errors returned by add_extent_rec_nolookup

Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: use standard allocation functions in non-kenrel code
David Sterba [Wed, 7 Sep 2016 14:22:33 +0000 (16:22 +0200)]
btrfs-progs: use standard allocation functions in non-kenrel code

Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: improve error handling in btrfs_add_to_fsid
David Sterba [Wed, 7 Sep 2016 14:18:31 +0000 (16:18 +0200)]
btrfs-progs: improve error handling in btrfs_add_to_fsid

Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: corrupt-block: improved error handling in corrupt_item_nocow
David Sterba [Wed, 7 Sep 2016 14:09:11 +0000 (16:09 +0200)]
btrfs-progs: corrupt-block: improved error handling in corrupt_item_nocow

Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: dump-super: switch to common message helpers
David Sterba [Wed, 7 Sep 2016 13:16:31 +0000 (15:16 +0200)]
btrfs-progs: dump-super: switch to common message helpers

Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: improve error handling in btrfs_alloc_data_chunk
David Sterba [Wed, 7 Sep 2016 13:57:41 +0000 (15:57 +0200)]
btrfs-progs: improve error handling in btrfs_alloc_data_chunk

Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: remove redundant check in btrfs_add_to_fsid
David Sterba [Wed, 7 Sep 2016 13:52:06 +0000 (15:52 +0200)]
btrfs-progs: remove redundant check in btrfs_add_to_fsid

The callers do the sanity checks.

Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: prop: simplify help printing code
David Sterba [Wed, 7 Sep 2016 13:18:09 +0000 (15:18 +0200)]
btrfs-progs: prop: simplify help printing code

Remove a trivial helper.

Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: tree-stats: switch to common message helpers
David Sterba [Wed, 7 Sep 2016 13:16:31 +0000 (15:16 +0200)]
btrfs-progs: tree-stats: switch to common message helpers

Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: fi du: improved error handling in mark_inode_seen
David Sterba [Wed, 7 Sep 2016 13:09:14 +0000 (15:09 +0200)]
btrfs-progs: fi du: improved error handling in mark_inode_seen

The callchain handles errors, don't crash on unexpected condition.

Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: fi du: catch bogus extent lengths
David Sterba [Wed, 7 Sep 2016 12:51:17 +0000 (14:51 +0200)]
btrfs-progs: fi du: catch bogus extent lengths

If we get a zero-length from the ioctl for whatever reason, we should
not crash.

Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: inspect: improved error handling
David Sterba [Wed, 7 Sep 2016 12:36:14 +0000 (14:36 +0200)]
btrfs-progs: inspect: improved error handling

Two remaining BUG_ON, be more specific what's wrong.

Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: improved error handling in btrfs_print_tree
David Sterba [Tue, 6 Sep 2016 13:55:59 +0000 (15:55 +0200)]
btrfs-progs: improved error handling in btrfs_print_tree

Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: qgroup: switch to common message helpers
David Sterba [Tue, 6 Sep 2016 13:41:13 +0000 (15:41 +0200)]
btrfs-progs: qgroup: switch to common message helpers

Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: remove trivial helpers for filtering functions
David Sterba [Tue, 6 Sep 2016 13:30:31 +0000 (15:30 +0200)]
btrfs-progs: remove trivial helpers for filtering functions

Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: catch invalid flags in open_ctree_fd
David Sterba [Tue, 6 Sep 2016 12:31:18 +0000 (14:31 +0200)]
btrfs-progs: catch invalid flags in open_ctree_fd

Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: convert: improve error handling in create_image_file_range
David Sterba [Tue, 6 Sep 2016 12:07:25 +0000 (14:07 +0200)]
btrfs-progs: convert: improve error handling in create_image_file_range

Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: mkfs: handle block ordering errors in make_btrfs
David Sterba [Tue, 6 Sep 2016 11:52:09 +0000 (13:52 +0200)]
btrfs-progs: mkfs: handle block ordering errors in make_btrfs

Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: chunk-recover: improve error handling in insert_stripe
David Sterba [Tue, 6 Sep 2016 11:39:41 +0000 (13:39 +0200)]
btrfs-progs: chunk-recover: improve error handling in insert_stripe

Switch to negative errnos, the callchain handles errors.

Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: switch column values to asserts
David Sterba [Tue, 6 Sep 2016 11:27:03 +0000 (13:27 +0200)]
btrfs-progs: switch column values to asserts

This is checking correct usage, not runtime errors.

Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: check: improved error handling in calc_extent_flag
David Sterba [Tue, 6 Sep 2016 11:08:29 +0000 (13:08 +0200)]
btrfs-progs: check: improved error handling in calc_extent_flag

All callers handle errors.

Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: receive: improved error handling in process_snapshot
David Sterba [Tue, 6 Sep 2016 11:08:29 +0000 (13:08 +0200)]
btrfs-progs: receive: improved error handling in process_snapshot

Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: handle errors from btrfs_alloc_path
David Sterba [Wed, 31 Aug 2016 18:38:46 +0000 (20:38 +0200)]
btrfs-progs: handle errors from btrfs_alloc_path

All functions already return an error condition, so the callers should
expect that.

Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: mkfs: check for sane sectorsize earlier
David Sterba [Wed, 31 Aug 2016 18:16:35 +0000 (20:16 +0200)]
btrfs-progs: mkfs: check for sane sectorsize earlier

Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: more verbose error handling in creation helpers
David Sterba [Wed, 31 Aug 2016 18:05:13 +0000 (20:05 +0200)]
btrfs-progs: more verbose error handling in creation helpers

Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: switch BUG_ON to ASSERT in reserve_free_space
David Sterba [Wed, 31 Aug 2016 17:31:57 +0000 (19:31 +0200)]
btrfs-progs: switch BUG_ON to ASSERT in reserve_free_space

That's not a real error condition, catch bad function usge.

Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: dump-tree: improved error handling in cmd_inspect_dump_tree
David Sterba [Fri, 26 Aug 2016 10:53:31 +0000 (12:53 +0200)]
btrfs-progs: dump-tree: improved error handling in cmd_inspect_dump_tree

Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: dump-tree: improved error handling in print_extents
David Sterba [Fri, 26 Aug 2016 10:53:31 +0000 (12:53 +0200)]
btrfs-progs: dump-tree: improved error handling in print_extents

Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: fi usage: improved error handling in load_device_info
David Sterba [Fri, 26 Aug 2016 10:53:31 +0000 (12:53 +0200)]
btrfs-progs: fi usage: improved error handling in load_device_info

Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: scrub: improved error handling in scrub_read_file
David Sterba [Fri, 26 Aug 2016 10:53:31 +0000 (12:53 +0200)]
btrfs-progs: scrub: improved error handling in scrub_read_file

Signed-off-by: David Sterba <dsterba@suse.com>
7 years agoBtrfs progs v4.7.3
David Sterba [Wed, 21 Sep 2016 11:59:53 +0000 (13:59 +0200)]
Btrfs progs v4.7.3

Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: update CHANGES for 4.7.3
David Sterba [Thu, 28 Jul 2016 12:18:59 +0000 (14:18 +0200)]
btrfs-progs: update CHANGES for 4.7.3

Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: mkfs: use preallocated buffers for config uuids
David Sterba [Wed, 31 Aug 2016 17:38:31 +0000 (19:38 +0200)]
btrfs-progs: mkfs: use preallocated buffers for config uuids

No need for dynamic allocation, the buffers are small, remove the
now-useless error conditions.

Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: mkfs: fix reading rotational status value
David Sterba [Wed, 21 Sep 2016 11:36:04 +0000 (13:36 +0200)]
btrfs-progs: mkfs: fix reading rotational status value

ASAN reports that we're reading beyond the bounds, and is right. The
variable is too short to store a nonempty string for atoi.

Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: defrag: set errno correctly in the callback
David Sterba [Tue, 20 Sep 2016 14:45:36 +0000 (16:45 +0200)]
btrfs-progs: defrag: set errno correctly in the callback

In case defrag fails, the errno is not properly reported everywhere but
rather the last value of 'e', which could be 0. Then we get confusing
error messages like:

ERROR: defrag failed on /path/to/file: Success

Reported-by: Adam Mizerski <adam@mizerski.pl>
Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: subvol create: remove v from getopt
David Sterba [Mon, 19 Sep 2016 17:43:24 +0000 (19:43 +0200)]
btrfs-progs: subvol create: remove v from getopt

The option 'v' was mistakenly added in
2ed161bd281beca29feebebbc8c4227cc6e918c3 but there's no such option for
create at the moment, remove it.

Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: subvol delete: add missing verbose option
Vincent Batts [Thu, 15 Sep 2016 19:15:50 +0000 (15:15 -0400)]
btrfs-progs: subvol delete: add missing verbose option

There was already the logic for verbose output, but the flag parsing did
not include it.

Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: docs: fix typos in btrfs-subvolume
adduxa [Sat, 17 Sep 2016 08:34:38 +0000 (11:34 +0300)]
btrfs-progs: docs: fix typos in btrfs-subvolume

[ Documentation fix, github pull request 16 ]
Signed-off-by: David Sterba <dsterba@suse.com>
7 years agoRevert "btrfs-progs: fix compat_ro mask for free space tree"
Omar Sandoval [Sat, 10 Sep 2016 00:02:14 +0000 (17:02 -0700)]
Revert "btrfs-progs: fix compat_ro mask for free space tree"

btrfs-progs can't mount space_cache=v2 filesystems read-write, which is
why the compat bit wasn't added to the supported mask in the first
place. Remove it.

Signed-off-by: Omar Sandoval <osandov@fb.com>
Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: reorganize extent_buffer and fix alignment of data
David Sterba [Mon, 12 Sep 2016 09:13:24 +0000 (11:13 +0200)]
btrfs-progs: reorganize extent_buffer and fix alignment of data

Reported by UBSAN, the checksum code tries to access unaligned data that
come from the extent_buffer.

struct extent_buffer {
        struct cache_extent        cache_node;           /*     0    48 */
        u64                        start;                /*    48     8 */
        u64                        dev_bytenr;           /*    56     8 */
        /* --- cacheline 1 boundary (64 bytes) --- */
        u32                        len;                  /*    64     4 */

        /* XXX 4 bytes hole, try to pack */

        struct extent_io_tree *    tree;                 /*    72     8 */
        struct list_head           lru;                  /*    80    16 */
        struct list_head           recow;                /*    96    16 */
        int                        refs;                 /*   112     4 */
        u32                        flags;                /*   116     4 */
        int                        fd;                   /*   120     4 */
        char                       data[0];              /*   124     0 */

        /* size: 128, cachelines: 2, members: 11 */
        /* sum members: 120, holes: 1, sum holes: 4 */
        /* padding: 4 */
};

Add explicit alignment to data.

Reported-by: Lukas Lueg <lukas.lueg@gmail.com>
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=156471
Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: tests: add 021-partially-dropped-snapshot-case
Wang Xiaoguang [Thu, 25 Aug 2016 05:21:01 +0000 (13:21 +0800)]
btrfs-progs: tests: add 021-partially-dropped-snapshot-case

Signed-off-by: Wang Xiaoguang <wangxg.fnst@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: check: make low memory mode support partially dropped snapshots
Wang Xiaoguang [Thu, 25 Aug 2016 05:21:00 +0000 (13:21 +0800)]
btrfs-progs: check: make low memory mode support partially dropped snapshots

Signed-off-by: Wang Xiaoguang <wangxg.fnst@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: better error report in btrfs_scan_fs_devices
David Sterba [Fri, 9 Sep 2016 13:56:18 +0000 (15:56 +0200)]
btrfs-progs: better error report in btrfs_scan_fs_devices

Print the found sizes.

Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: tests: add fuzzed images for bad block group offset
David Sterba [Fri, 9 Sep 2016 13:33:20 +0000 (15:33 +0200)]
btrfs-progs: tests: add fuzzed images for bad block group offset

Reported-by: Lukas Lueg <lukas.lueg@gmail.com>
Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: avoid looping forever when a bad blockgroup key is found
Jeff Mahoney [Fri, 9 Sep 2016 13:22:19 +0000 (15:22 +0200)]
btrfs-progs: avoid looping forever when a bad blockgroup key is found

If we discover a bad BLOCK_GROUP_ITEM_KEY with offset = 0, we'll end up looping
forever when we read the block groups in.  This is due to the search for the
next block group starting at the current object + the offset.  If offset is 0,
we'll just get the same key over and over and never advance.  This patch
ensures that we'll advance at least one objectid per iteration.

Signed-off-by: Jeff Mahoney <jeffm@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: remove stray newline from message in check_super
David Sterba [Thu, 8 Sep 2016 16:42:45 +0000 (18:42 +0200)]
btrfs-progs: remove stray newline from message in check_super

Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: tests: run check with various options on the fuzzed images
David Sterba [Thu, 8 Sep 2016 16:17:48 +0000 (18:17 +0200)]
btrfs-progs: tests: run check with various options on the fuzzed images

Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: tests: add fuzz test to try btrfs-image on all images
David Sterba [Thu, 8 Sep 2016 16:06:44 +0000 (18:06 +0200)]
btrfs-progs: tests: add fuzz test to try btrfs-image on all images

Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: tests: rename test 001 to mention check
David Sterba [Thu, 8 Sep 2016 15:57:02 +0000 (17:57 +0200)]
btrfs-progs: tests: rename test 001 to mention check

Make it more clear that the test does 'btrfs check'.

Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: tests: add fuzzed image for a bad backref
David Sterba [Thu, 8 Sep 2016 12:12:25 +0000 (14:12 +0200)]
btrfs-progs: tests: add fuzzed image for a bad backref

Reported-by: Lukas Lueg <lukas.lueg@gmail.com>
Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: tree-stats: check and report mount status
David Sterba [Wed, 7 Sep 2016 13:31:27 +0000 (15:31 +0200)]
btrfs-progs: tree-stats: check and report mount status

Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: docs: update flushoncommit default value
David Sterba [Tue, 6 Sep 2016 17:06:42 +0000 (19:06 +0200)]
btrfs-progs: docs: update flushoncommit default value

Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: docs: Add warning for build RAID btrfs on partions from the same device
Qu Wenruo [Tue, 6 Sep 2016 15:35:33 +0000 (17:35 +0200)]
btrfs-progs: docs: Add warning for build RAID btrfs on partions from the same device

Quite a common sense for any RAID-like multi-device setup, just in case.

Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: mkfs: Warn user for minimal RAID5/6 devices setup
Qu Wenruo [Tue, 6 Sep 2016 15:35:06 +0000 (17:35 +0200)]
btrfs-progs: mkfs: Warn user for minimal RAID5/6 devices setup

For RAID5, 2 devices setup is just RAID1 with more overhead.
For RAID6, 3 devices setup is RAID1 with 3 copies, not what most user
want.

So warn user at mkfs time for such case, and add explain in man pages.

Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: tests: post btrfs-convert verify permissions and ACLs
Lakshmipathi.G [Mon, 5 Sep 2016 19:27:36 +0000 (21:27 +0200)]
btrfs-progs: tests: post btrfs-convert verify permissions and ACLs

Signed-off-by: Lakshmipathi.G <Lakshmipathi.G@giis.co.in>
Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: build: add UBSAN to debugging features
David Sterba [Sat, 3 Sep 2016 19:36:53 +0000 (21:36 +0200)]
btrfs-progs: build: add UBSAN to debugging features

usage: make D=ubsan

Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: dump-super: changes in options to specify superblocks
David Sterba [Fri, 2 Sep 2016 14:57:23 +0000 (16:57 +0200)]
btrfs-progs: dump-super: changes in options to specify superblocks

Some tools (check, select-super, dump-super) can use the alternate
superblocks, but the options are not consistent. To make it less
confusing, change the meaning of option -s in 'dump-super' to specify
the superblock copy, instead of taking the offset.

Though this is a change in UI, the old usage is detected and the result
would be the same, no breakage in existing scripts.

Signed-off-by: David Sterba <dsterba@suse.com>
7 years agoBtrfs progs v4.7.2
David Sterba [Mon, 5 Sep 2016 10:21:24 +0000 (12:21 +0200)]
Btrfs progs v4.7.2

Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: update CHANGES for 4.7.2
David Sterba [Thu, 28 Jul 2016 12:18:59 +0000 (14:18 +0200)]
btrfs-progs: update CHANGES for 4.7.2

Signed-off-by: David Sterba <dsterba@suse.com>
7 years agoRevert "btrfs-progs: check: supplement extent backref list with rbtree"
David Sterba [Mon, 5 Sep 2016 10:02:31 +0000 (12:02 +0200)]
Revert "btrfs-progs: check: supplement extent backref list with rbtree"

This reverts commit 31d8235410985e0b64487354c9ba67d40c4bdfe3.

False report of backref mismatches, lots of messages similar to:

Incorrect local backref count on 12713984 root 5 owner 257 offset 12845056 found 1 wanted 0 back 0x7b3ed0
backpointer mismatch on [12713984 131072]

Repairing will make things worse. A fix has been proposed, but is not
finalized so we go with a revert.

Reported-by: Chris Murphy <bugzilla@colorremedies.com>
References: https://bugzilla.kernel.org/show_bug.cgi?id=155791
Signed-off-by: David Sterba <dsterba@suse.com>
7 years agoRevert "btrfs-progs: check: switch to iterating over the backref_tree"
David Sterba [Mon, 5 Sep 2016 10:01:07 +0000 (12:01 +0200)]
Revert "btrfs-progs: check: switch to iterating over the backref_tree"

This reverts commit bbebe814c0e335745cfa773df966418e754b50e3.

7 years agobtrfs-progs: build: add ASAN to debugging features
David Sterba [Sat, 3 Sep 2016 19:36:53 +0000 (21:36 +0200)]
btrfs-progs: build: add ASAN to debugging features

usage: make D=asan

Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: tests: add fuzzed image for heap overflow while checking chunk items
David Sterba [Sat, 3 Sep 2016 18:52:18 +0000 (20:52 +0200)]
btrfs-progs: tests: add fuzzed image for heap overflow while checking chunk items

Reported-by: Lukas Lueg <lukas.lueg@gmail.com>
Signed-off-by: David Sterba <dsterba@suse.com>
7 years agobtrfs-progs: tests: add fuzzed image for invalid chunk sectorsize
David Sterba [Sat, 3 Sep 2016 18:52:18 +0000 (20:52 +0200)]
btrfs-progs: tests: add fuzzed image for invalid chunk sectorsize

Reported-by: Lukas Lueg <lukas.lueg@gmail.com>
Signed-off-by: David Sterba <dsterba@suse.com>