Commit Graph

3300 Commits

Author SHA1 Message Date
David Sterba 7dbb17dbb2 btrfs-progs: tests: add quotation around variables in support scripts
Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-11 16:25:19 +01:00
David Sterba 8dc653f003 btrfs-progs: tests: add quotation around variables in common.convert
Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-11 16:25:19 +01:00
David Sterba cc0d3d3198 btrfs-progs: tests: add quotes around variables in common
Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-11 16:25:19 +01:00
David Sterba 747146e237 btrfs-progs: tests: add path assertions to post-checks
Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-11 16:25:19 +01:00
David Sterba 8a44fd062a btrfs-progs: tests: add assertion helper
Helper to extend sanity checks in various functions.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-11 16:25:18 +01:00
David Sterba 66b9b36805 btrfs-progs: tests: refactor post-convert check helpers
Separate checksum test from convert_test_post_check and use it to fix
the broken test 005 as reported.

References: https://bugzilla.kernel.org/show_bug.cgi?id=177141
Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-11 16:25:18 +01:00
David Sterba 4ad7a967d1 btrfs-progs: tests: check if kernel has btrfs support
Add some sanity checks, reported among other issues via bugzilla.

References: https://bugzilla.kernel.org/show_bug.cgi?id=177141
Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-11 16:25:18 +01:00
David Sterba dbf16fe5e4 btrfs-progs: mkfs: print the new UUID
Unless the uuid is specified as the command line option, it's not
printed in the summary.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-11 16:25:18 +01:00
David Sterba ebcd9f7eef btrfs-progs: mkfs: add names of matching sysfs feature names
The mkfs parameters do not match file names exported through sysfs.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-11 16:25:18 +01:00
David Sterba bcccfb52d9 btrfs-progs: mkfs: enhance feature table
Add string and numeric version for later use so we don't have to convert
all the time.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-11 16:25:18 +01:00
David Sterba 9ab0db84ec btrfs-progs: mkfs: extend mkfs features with compat, safe and default versions
Enhance the mkfs_features list with the minimum kernel versions that
will allow for turning on compatible and/or safe options.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-11 16:25:18 +01:00
David Sterba 279609aedf btrfs-progs: mkfs: add temporary variable for fs features
A minor cleanup before other changes.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-11 16:25:17 +01:00
Qu Wenruo 388cdce509 btrfs-progs: Fix memory leak in write_raid56_with_parity
Ebs and pointers are allocated, but if any of the allocation failed, we
should free the allocated memory.

Resolves-Coverity-CID: 1374101
Resolves-Coverity-CID: 1374100
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-11 16:23:30 +01:00
Tsutomu Itoh f529d6472e btrfs-progs: tests: add checking of send multiple clone source option
Sending stream size of clone-src(-c) option is checked.
Fixed by "btrfs-progs: send: fix handling of -c option".

Signed-off-by: Tsutomu Itoh <t-itoh@jp.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-11 16:23:30 +01:00
David Sterba 84d1f29d47 btrfs-progs: send: check for output file existence before creating
In some cases the root might not be able to create the output file (and
streaming to stdout is not an option). Make the output file creation two
step and let it work if the file is already created.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-11 16:23:29 +01:00
Tsutomu Itoh 7d405df0da btrfs-progs: send: fix handling of -c option
When two or more -c options are specified, cannot find a suitable
parent. So, output stream is bigger than correct one.

[before]
At subvol Snap1
At subvol Snap2
At subvol ../SnapY
-rw------- 1 root root 3153 Oct 19 10:37 /tmp/data1

[after]
At subvol Snap1
At subvol Snap2
At subvol ../SnapY
-rw------- 1 root root 1492 Oct 19 10:39 /tmp/data1

Signed-off-by: Tsutomu Itoh <t-itoh@jp.fujitsu.com>
[ constify subvol argument, renamed single letter variables ]
Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-11 16:23:29 +01:00
David Sterba 45827710e2 btrfs-progs: tests: teach extract_image about packed streams
Packed streams for testing purposes should be packed with 'xz -9' and
use suffix .stream.xz .

Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-11 16:23:29 +01:00
David Sterba c29fea4344 btrfs-progs: use correct type for device id iteration in get_fs_info
Coverity reports (CID 1374096) that there's return value overflow of
ret from get_device_info, but this most likely cannot happen. There's
another minor issue where we use int to iterate over devids.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-09 13:47:35 +01:00
David Sterba 92847b5cd6 btrfs-progs: crc32: use fallback implementation for unaligned buffers
ASAN reports that at some point the crc function gets an unaligned
buffer. It's the optimized intel version that casts char to ulong, the
buffer is the embedded filename in the directory items.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-09 13:47:35 +01:00
David Sterba 0bd0d9c062 btrfs-progs: tests: teach scan-results about more errors
ASAN detects use after free.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-09 13:47:35 +01:00
David Sterba 3934ba255d btrfs-progs: fix search tree v2 ioctl detection
The result of the test applies per-filesystem, so we can't simply cache
it. The function hasn't been used yet.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-09 13:47:35 +01:00
David Sterba 92576929fb btrfs-progs: fix unaligned u64 access in btrfs_alloc_data_chunk
The key.offset member is not well-aligned as the key is packed, use a
temporary variable to pass the argument. Reported by ASAN in misc test
002.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-09 13:47:34 +01:00
David Sterba 9e0dd182b4 btrfs-progs: docs: update mkfs help string and manual page
Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-09 13:47:34 +01:00
David Sterba d75ea3ca87 btrfs-progs: mkfs: simplify checks in directory_select
Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-09 13:47:34 +01:00
David Sterba 8c4e5fbe89 btrfs-progs: btrfstune: use on-stack path buffer in change_devices_uuid
We don't need to conserve stack space too much unlike kernel, also
remove one error condition.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-09 13:47:34 +01:00
David Sterba ac2a089560 btrfs-progs: btrfstune: use on-stack path buffer in change_extents_uuid
We don't need to conserve stack space too much unlike kernel, also
remove one error condition.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-09 13:47:34 +01:00
David Sterba a75e84a819 btrfs-progs: chunk-recover: use on-stack path buffer in rebuild_block_group
We don't need to conserve stack space too much unlike kernel, also
remove one error condition.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-09 13:47:34 +01:00
David Sterba e680b4e5ad btrfs-progs: check: remove unused variable in record_extent
In a similar code, it's used for a message. Not used in this code since
the beggingin, safe to remove.

Resolves-coverity-id: 1364085
Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-09 13:47:34 +01:00
David Sterba d1ec1fe602 btrfs-progs: restore: use on-stack path buffer in find_first_dir
We don't need to conserve stack space too much unlike kernel, also
remove one error condition.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-09 13:47:34 +01:00
David Sterba 6dfe365b4b btrfs-progs: restore: use on-stack path buffer in do_list_roots
We don't need to conserve stack space too much unlike kernel, also
remove one error condition.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-09 13:47:33 +01:00
David Sterba 61b72497bb btrfs-progs: restore: use on-stack path buffer in search_dir
We don't need to conserve stack space too much unlike kernel, also
remove one error condition.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-09 13:47:33 +01:00
David Sterba 69b7e72345 btrfs-progs: restore: use on-stack path buffer in copy_symlink
We don't need to conserve stack space too much unlike kernel, also
remove one error condition.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-09 13:47:33 +01:00
David Sterba 047f343721 btrfs-progs: restore: use on-stack path buffer in copy_file
We don't need to conserve stack space too much unlike kernel, also
remove one error condition.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-09 13:47:33 +01:00
David Sterba 51e564543b btrfs-progs: restore: use on-stack path buffer in copy_metadata
We don't need to conserve stack space too much unlike kernel, also
remove one error condition.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-09 13:47:33 +01:00
David Sterba e79daa7a82 btrfs-progs: restore: use on-stack path buffer in set_file_xattrs
We don't need to conserve stack space too much unlike kernel, also
remove one error condition.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-09 13:47:33 +01:00
David Sterba 951e6276e6 btrfs-progs: tree-stats: use on-stack path buffer in calc_root_size
We don't need to conserve stack space too much unlike kernel, also
remove one error condition.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-09 13:47:33 +01:00
David Sterba 9733b4b926 btrfs-progs: check: use on-stack path buffer in repair_root_items
We don't need to conserve stack space too much unlike kernel, also
remove one error condition.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-09 13:47:33 +01:00
David Sterba 5ec9951e7d btrfs-progs: check: use on-stack path buffer in build_roots_info_cache
We don't need to conserve stack space too much unlike kernel, also
remove one error condition.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-09 13:47:33 +01:00
David Sterba 1b42d77eb6 btrfs-progs: check: use on-stack path buffer in fill_csum_tree_from_extent
We don't need to conserve stack space too much unlike kernel, also
remove one error condition.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-09 13:47:33 +01:00
David Sterba 02ca1e8a0f btrfs-progs: check: use on-stack path buffer in fill_csum_tree_from_fs
We don't need to conserve stack space too much unlike kernel, also
remove one error condition.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-09 13:47:33 +01:00
David Sterba c050db55e2 btrfs-progs: check: use on-stack path buffer in fill_csum_tree_from_one_fs_root
We don't need to conserve stack space too much unlike kernel, also
remove one error condition.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-09 13:47:33 +01:00
David Sterba 5cbedb02e1 btrfs-progs: check: use on-stack path buffer in delete_bad_item
We don't need to conserve stack space too much unlike kernel, also
remove one error condition.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-09 13:47:33 +01:00
David Sterba 29bfb8318b btrfs-progs: check: use on-stack path buffer in recow_extent_buffer
We don't need to conserve stack space too much unlike kernel, also
remove one error condition.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-09 13:47:32 +01:00
David Sterba d0c3fa4d5b btrfs-progs: check: use on-stack path buffer in reset_balance
We don't need to conserve stack space too much unlike kernel, also
remove one error condition.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-09 13:47:32 +01:00
David Sterba 54db6df0e8 btrfs-progs: check: use on-stack path buffer in reset_block_groups
We don't need to conserve stack space too much unlike kernel, also
remove one error condition.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-09 13:47:32 +01:00
David Sterba 848e7f01ad btrfs-progs: check: use on-stack path buffer in fixup_extent_flags
We don't need to conserve stack space too much unlike kernel, also
remove one error condition.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-09 13:47:32 +01:00
David Sterba 1e1bb046e5 btrfs-progs: check: use on-stack path buffer in fixup_extent_refs
We don't need to conserve stack space too much unlike kernel, also
remove one error condition.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-09 13:47:32 +01:00
David Sterba 1f7f342b26 btrfs-progs: check: use on-stack path buffer in record_orphan_data_extents
We don't need to conserve stack space too much unlike kernel, also
remove one error condition.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-09 13:47:32 +01:00
David Sterba f2f7da66c5 btrfs-progs: check: use on-stack path buffer in delete_duplicate_records
We don't need to conserve stack space too much unlike kernel, also
remove one error condition.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-09 13:47:32 +01:00
David Sterba 919f914483 btrfs-progs: check: use on-stack path buffer in check_extent_exists
We don't need to conserve stack space too much unlike kernel, also
remove one error condition.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-09 13:47:32 +01:00