Commit Graph

2931 Commits

Author SHA1 Message Date
Qu Wenruo
3296d058b7 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>
2016-10-03 15:07:22 +02:00
Qu Wenruo
50c8c995ea 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>
2016-10-03 15:07:22 +02:00
Nicholas D Steeves
6bdb1cfbc1 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>
2016-10-03 15:07:22 +02:00
Adam Borowski
aa8ad8d4ae btrfs-progs: docs: document exit codes from scrub
Signed-off-by: Adam Borowski <kilobyte@angband.pl>
Signed-off-by: David Sterba <dsterba@suse.com>
2016-10-03 15:07:22 +02:00
David Sterba
1200be31e6 btrfs-progs: move 3rd party kernel library modules to own directory
Signed-off-by: David Sterba <dsterba@suse.com>
2016-10-03 15:07:22 +02:00
David Sterba
605ed50b8c 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>
2016-10-03 15:07:21 +02:00
David Sterba
8d8de7c2e5 btrfs-progs: tests: add script to scan results for some known runtime errors
Signed-off-by: David Sterba <dsterba@suse.com>
2016-10-03 15:07:21 +02:00
David Sterba
5a38a52194 btrfs-progs: tests: iterate over fuzzed images and test various tools
Signed-off-by: David Sterba <dsterba@suse.com>
2016-10-03 15:07:21 +02:00
Domagoj Tršan
ff9ee51677 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>
2016-10-03 11:35:50 +02:00
Lakshmipathi.G
b56fe16922 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>
2016-10-03 11:35:49 +02:00
David Sterba
2a9daceb07 btrfs-progs: mkfs: remove useless helper
Signed-off-by: David Sterba <dsterba@suse.com>
2016-10-03 11:33:15 +02:00
David Sterba
34673ebeb0 btrfs-progs: use PATH_MAX in cmd_inspect_logical_resolve
Signed-off-by: David Sterba <dsterba@suse.com>
2016-10-03 11:33:15 +02:00
David Sterba
91435117d7 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>
2016-10-03 11:33:15 +02:00
David Sterba
890f4a61d7 btrfs-progs: cleanup, kill trivial btrfs_key_type helper
Signed-off-by: David Sterba <dsterba@suse.com>
2016-10-03 11:33:15 +02:00
David Sterba
555743075b btrfs-progs: cleanup, kill trivial btrfs_set_key_type helper
Signed-off-by: David Sterba <dsterba@suse.com>
2016-10-03 11:33:15 +02:00
David Sterba
ea84d54121 btrfs-progs: improve error handling in clone_inode_rec
Cleanup the rb_tree.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-10-03 11:33:15 +02:00
David Sterba
7e955fc856 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>
2016-10-03 11:33:15 +02:00
David Sterba
c7a1f66a20 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>
2016-10-03 11:33:15 +02:00
David Sterba
a4e59b6776 btrfs-progs: image: switch to common message helpers
Signed-off-by: David Sterba <dsterba@suse.com>
2016-10-03 11:33:15 +02:00
David Sterba
6733181501 btrfs-progs: convert: improve error handling in do_rollback
Handle transaction errors.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-10-03 11:33:15 +02:00
David Sterba
1497a772c3 btrfs-progs: check: improve error handling in add_extent_rec_nolookup
Signed-off-by: David Sterba <dsterba@suse.com>
2016-10-03 11:33:15 +02:00
David Sterba
257f697962 btrfs-progs: check: handle errors returned by add_extent_rec_nolookup
Signed-off-by: David Sterba <dsterba@suse.com>
2016-10-03 11:33:15 +02:00
David Sterba
1ed3426d3f btrfs-progs: use standard allocation functions in non-kenrel code
Signed-off-by: David Sterba <dsterba@suse.com>
2016-10-03 11:33:15 +02:00
David Sterba
b80a4641e5 btrfs-progs: improve error handling in btrfs_add_to_fsid
Signed-off-by: David Sterba <dsterba@suse.com>
2016-10-03 11:33:15 +02:00
David Sterba
7b83595dbd btrfs-progs: corrupt-block: improved error handling in corrupt_item_nocow
Signed-off-by: David Sterba <dsterba@suse.com>
2016-10-03 11:33:15 +02:00
David Sterba
689b6249f3 btrfs-progs: dump-super: switch to common message helpers
Signed-off-by: David Sterba <dsterba@suse.com>
2016-10-03 11:33:15 +02:00
David Sterba
df36cbdad2 btrfs-progs: improve error handling in btrfs_alloc_data_chunk
Signed-off-by: David Sterba <dsterba@suse.com>
2016-10-03 11:33:15 +02:00
David Sterba
1424a9b4d9 btrfs-progs: remove redundant check in btrfs_add_to_fsid
The callers do the sanity checks.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-10-03 11:33:15 +02:00
David Sterba
ee3dfeaab2 btrfs-progs: prop: simplify help printing code
Remove a trivial helper.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-10-03 11:33:14 +02:00
David Sterba
acf978a2d4 btrfs-progs: tree-stats: switch to common message helpers
Signed-off-by: David Sterba <dsterba@suse.com>
2016-10-03 11:33:14 +02:00
David Sterba
4a16608150 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>
2016-10-03 11:33:14 +02:00
David Sterba
44af5de2f3 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>
2016-10-03 11:33:04 +02:00
David Sterba
939bc6323b btrfs-progs: inspect: improved error handling
Two remaining BUG_ON, be more specific what's wrong.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-09-21 14:12:38 +02:00
David Sterba
ad44d1eb17 btrfs-progs: improved error handling in btrfs_print_tree
Signed-off-by: David Sterba <dsterba@suse.com>
2016-09-21 14:12:38 +02:00
David Sterba
26fbf0546d btrfs-progs: qgroup: switch to common message helpers
Signed-off-by: David Sterba <dsterba@suse.com>
2016-09-21 14:12:38 +02:00
David Sterba
c027c13531 btrfs-progs: remove trivial helpers for filtering functions
Signed-off-by: David Sterba <dsterba@suse.com>
2016-09-21 14:12:38 +02:00
David Sterba
8a167ec579 btrfs-progs: catch invalid flags in open_ctree_fd
Signed-off-by: David Sterba <dsterba@suse.com>
2016-09-21 14:12:38 +02:00
David Sterba
93a34924e1 btrfs-progs: convert: improve error handling in create_image_file_range
Signed-off-by: David Sterba <dsterba@suse.com>
2016-09-21 14:12:38 +02:00
David Sterba
030fa48b55 btrfs-progs: mkfs: handle block ordering errors in make_btrfs
Signed-off-by: David Sterba <dsterba@suse.com>
2016-09-21 14:12:38 +02:00
David Sterba
b83e93e65d 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>
2016-09-21 14:12:38 +02:00
David Sterba
1620e2a042 btrfs-progs: switch column values to asserts
This is checking correct usage, not runtime errors.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-09-21 14:12:38 +02:00
David Sterba
40ca1d513d btrfs-progs: check: improved error handling in calc_extent_flag
All callers handle errors.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-09-21 14:12:38 +02:00
David Sterba
28fdd0d2ae btrfs-progs: receive: improved error handling in process_snapshot
Signed-off-by: David Sterba <dsterba@suse.com>
2016-09-21 14:12:38 +02:00
David Sterba
1ef93ea863 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>
2016-09-21 14:12:38 +02:00
David Sterba
b318553f33 btrfs-progs: mkfs: check for sane sectorsize earlier
Signed-off-by: David Sterba <dsterba@suse.com>
2016-09-21 14:12:38 +02:00
David Sterba
976f6adfb5 btrfs-progs: more verbose error handling in creation helpers
Signed-off-by: David Sterba <dsterba@suse.com>
2016-09-21 14:12:38 +02:00
David Sterba
2d7c6dc931 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>
2016-09-21 14:12:38 +02:00
David Sterba
41fe00e1eb btrfs-progs: dump-tree: improved error handling in cmd_inspect_dump_tree
Signed-off-by: David Sterba <dsterba@suse.com>
2016-09-21 14:12:38 +02:00
David Sterba
04b3bf1779 btrfs-progs: dump-tree: improved error handling in print_extents
Signed-off-by: David Sterba <dsterba@suse.com>
2016-09-21 14:12:30 +02:00
David Sterba
7febbc9efe btrfs-progs: fi usage: improved error handling in load_device_info
Signed-off-by: David Sterba <dsterba@suse.com>
2016-09-21 14:12:10 +02:00