Commit Graph

3185 Commits

Author SHA1 Message Date
Tsutomu Itoh 3a8234ee73 btrfs-progs: test: fix error of test target of Makefile
Add test-cli to test target of Makefile.

Signed-off-by: Tsutomu Itoh <t-itoh@jp.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-23 11:07:05 +01:00
Omar Sandoval a064f24e2e btrfs-progs: document space_cache=v2 more thoroughly
Signed-off-by: Omar Sandoval <osandov@fb.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-23 11:07:05 +01:00
Omar Sandoval 87895ef4da btrfs-progs: implement btrfs check --clear-space-cache v2
Reviewed-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: Omar Sandoval <osandov@fb.com>
[ adjusted error messages ]
Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-23 11:07:05 +01:00
Omar Sandoval 9814411021 btrfs-progs: add btrfs_clear_free_space_tree() from the kernel
Reviewed-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: Omar Sandoval <osandov@fb.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-23 11:07:05 +01:00
Omar Sandoval 441d8aea8f btrfs-progs: add OPEN_CTREE_INVALIDATE_FST flag
If this flag is passed to open_ctree(), we'll clear the
FREE_SPACE_TREE_VALID compat_ro bit. The kernel will then reconstruct
the free space tree the next time the filesystem is mounted.

Reviewed-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: Omar Sandoval <osandov@fb.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-23 11:07:05 +01:00
Omar Sandoval 9e02fbfcd3 btrfs-progs: format FREE_SPACE_TREE{,_VALID} nicely in dump-super
Signed-off-by: Omar Sandoval <osandov@fb.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-23 11:07:05 +01:00
Omar Sandoval 41eaae6d74 btrfs-progs: add the FREE_SPACE_TREE_VALID compat_ro bit definition
This is just the definition; we don't support it yet.

Signed-off-by: Omar Sandoval <osandov@fb.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-23 11:07:05 +01:00
Tsutomu Itoh f9a13d867b btrfs-progs: send: fix failure of fstests btrfs/038
The following patch was imperfect, so xfstests btrfs/038 was failed.

  6d4fb3d  btrfs-progs: send: fix handling of multiple snapshots (-p option)

[before]
| # ./check btrfs/038
| FSTYP         -- btrfs
| PLATFORM      -- Linux/x86_64 luna 4.9.0-rc5
| MKFS_OPTIONS  -- /dev/sdb3
| MOUNT_OPTIONS -- /dev/sdb3 /test6
|
| btrfs/038 1s ... [failed, exit status 1] - output mismatch (see /For_RT/xfstests2/results//btrfs/038.out.bad)
|     --- tests/btrfs/038.out     2015-08-04 16:09:38.000000000 +0900
|     +++ /For_RT/xfstests2/results//btrfs/038.out.bad    2016-11-15 13:39:48.589435290 +0900
|     @@ -7,3 +7,5 @@
|      XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|      wrote 10000/10000 bytes at offset 300000
|      XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
|     +failed: '/usr/local/bin/btrfs send -p /test6/mysnap1 -c /test6/clones_snap /test6/mysnap2 -f /tmp/tmp.aLpvAC7lsx/2.snap'
|     +(see /For_RT/xfstests2/results//btrfs/038.full for details)
|     ...
|     (Run 'diff -u tests/btrfs/038.out /For_RT/xfstests2/results//btrfs/038.out.bad'  to see the entire diff)
| Ran: btrfs/038
| Failures: btrfs/038

[after]
| # ./check btrfs/038
| FSTYP         -- btrfs
| PLATFORM      -- Linux/x86_64 luna 4.9.0-rc5
| MKFS_OPTIONS  -- /dev/sdb3
| MOUNT_OPTIONS -- /dev/sdb3 /test6
|
| btrfs/038 1s ... 1s
| Ran: btrfs/038
| Passed all 1 tests

Signed-off-by: Tsutomu Itoh <t-itoh@jp.fujitsu.com>
[ Verified that this fixes both btrfs/038 and btrfs/117 ]
Tested-by: Omar Sandoval <osandov@fb.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-23 11:07:05 +01:00
David Sterba a2d91697c1 btrfs-progs: tests: add more tests to the CI build
Run more tests in the travis build environment. The mkfs tests are still
left out due to missing capabilities of losetup.

Other minor travis adjustments.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-23 11:07:03 +01:00
David Sterba 4884ae2f5e btrfs-progs: tests: enhance TEST_LOG features
Add new keyword to dump the log file after any test fails. Can be useful
for remote analysis of test failures.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-23 10:51:43 +01:00
David Sterba 7cd40e125b btrfs-progs: tests: check for TEST_LOG values by a regex
The set of possible values will be extended so check for existence of
the keyword.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-23 10:51:38 +01:00
David Sterba 9da3ce40f5 btrfs-progs: tests: change options to list all loop devices
The option --list might not be available on older versions, the
equvalent is --all. Discovered via failed travis build.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-23 10:51:29 +01:00
David Sterba 6572f884ba btrfs-progs: tests: use the root helper for various info retrieval commands
The current user might not be able to peek into the loop files directly,
use the helper. Discovered by running tests in travis.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-23 10:51:21 +01:00
David Sterba a2214e582c btrfs-progs: docs: fix typo in btrfs-scrub manual page
Reported on IRC.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-23 10:50:37 +01:00
David Sterba bb2c0e23d8 btrfs-progs: send-stream: track the read position in the stream
Can be later used for more precise error reporting.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-23 10:50:35 +01:00
David Sterba 691d1ac8fa btrfs-progs: tests: add basic checks for bad stream on the receive side
Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-23 10:50:29 +01:00
David Sterba fefbab7520 btrfs-progs: send-stream: check number of read bytes from stream
The read_buf does not verify that we've read the expected number of
bytes.  A corrupted of malformated stream will not be detdcted.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-23 10:50:20 +01:00
David Sterba 028476f19c btrfs-progs: send-stream: document return values of some functions
Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-23 10:50:16 +01:00
David Sterba bcf81d9457 btrfs-progs: send-stream: use proper type for cmd in read_cmd
We just read and assign the value, there's no reason to use different
types.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-23 10:50:13 +01:00
David Sterba f9834e87d4 btrfs-progs: send-stream: don't use single letter variable in tlv_get
Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-23 10:50:10 +01:00
David Sterba 4c06613842 btrfs-progs: send-stream: use proper types for tlv header values
Switch types to unsigned and adjust the checks.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-23 10:50:08 +01:00
David Sterba d13168cebf btrfs-progs: send-stream: use proper type for read return value
Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-23 10:50:05 +01:00
David Sterba 2513dfed8f btrfs-progs: send-stream: change length type to unsigned
The command length is unsigned, use the right type, also to make the
length checks work.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-23 10:50:01 +01:00
David Sterba 23ac27781e btrfs-progs: send-stream: check command length before reading from stream
The command + header length could not fit to the intermediate buffer.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-23 10:49:57 +01:00
David Sterba d63854d1b6 btrfs-progs: send-stream: pass char buffer to read_buf
Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-23 10:49:51 +01:00
David Sterba 194666a672 btrfs-progs: send-stream: fix size types passed to read_buf
Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-23 10:49:49 +01:00
David Sterba 7b794974ba btrfs-progs: send-stream: rename single letter variable
Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-23 10:49:46 +01:00
David Sterba eb4cfd8921 btrfs-progs: send-stream: switch to common message helpers
Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-23 10:49:41 +01:00
David Sterba 5ee216a86f btrfs-progs: tests: add more fuzzed images from bugzilla
Fixing the problems by one does not scale now. Add more images despite
the fuzz tests will fail. They have been for some time already.

Reported-by: Lukas Lueg <lukas.lueg@gmail.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-23 10:49:37 +01:00
David Sterba 08a072c709 btrfs-progs: ioctl: fix compilation if ioctl.h is included standalone
Definition of NULL is missing if ioctl.h is included standalone or when
no other include pulls the definition.

Reported-by: Sergei Trofimovich <slyich@gmail.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-23 10:49:33 +01:00
Goldwyn Rodrigues becd520b5c btrfs-progs: return best entry, if it is the first one
The find_most_right_entry() tends to miss on the best entry if it is the
first one on the list and there are only two entries in the list.  So,
we assign both prev and best to entry.

To do this, the selection process (rather the rejection) has to be
performed earlier to skip on broken==count.

Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-23 10:49:31 +01:00
Qu Wenruo d6ab2fdca4 btrfs-progs: utils: Fix NULL pointer derefernces in string_is_numerical
In get_running_kernel_version() function, we directly pass return
pointer from strtok_r() to string_is_numerical().

Return pointer from strok_r() can be NULL, but string_is_numerical()
can't handle it and will cause NULL pointer derefernces.

Fix it by check if it's a NULL pointer first.

Resolves-Coverity-CID: 1374097
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-23 10:48:13 +01:00
David Sterba 04329d1e77
Btrfs progs v4.8.3
Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-11 16:28:18 +01:00
David Sterba 6ecb170b5b btrfs-progs: update CHANGES for v4.8.3
Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-11 16:26:57 +01:00
David Sterba 9d0e6a67f9 btrfs-progs: tests: enhance run_mayfail description comment
Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-11 16:25:19 +01:00
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