Commit Graph

1714 Commits (39568fa417ceee3133a8cadae0bd1527adf61221)
 

Author SHA1 Message Date
Qu Wenruo 39568fa417 btrfs-progs: Doc: Add explain on 'source' and 'target' for btrfs-image.
Add explain on 'source' and 'target', which is somewhat confusing for
users who want to restore dumped image.

Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
[reworded texts]
Signed-off-by: David Sterba <dsterba@suse.cz>
2015-01-21 17:23:23 +01:00
Qu Wenruo 751fe9b916 btrfs-progs: Cleanup, use bitshift instead of immediate number in btrfs_open_ctree_flags.
Change the immediate number in btrfs_open_ctree_flags to bit shift.

Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
2015-01-21 17:07:35 +01:00
Fan Chengniang f66d17814b btrfs-progs: btrfstune: force to set seeding flags
Now we can use -f with -S option when setting seeding flags or clearing
seeding flags

Reported-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>
Signed-off-by: Fan Chengniang <fancn.fnst@cn.fujitsu.com>
[updated docs]
Signed-off-by: David Sterba <dsterba@suse.cz>
2015-01-19 19:19:14 +01:00
David Sterba 188e79e2fc btrfs-progs: tests, use non-interactive sudo helper
Sudo may not be configured to run without user prompt, in that case the
tests would be stuck.

Reported-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
2015-01-19 19:09:28 +01:00
David Sterba e1ee8b2a0f btrfs-progs: fix check of running scrub
Scrub on multiple devices may report wrong status if scrub finishes
early on one of them.

Reported-by: Sandy McArthur Jr <sandymac@gmail.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
2015-01-19 18:53:41 +01:00
David Sterba 2b7cdab425 btrfs-progs: make getopt tables static const
Signed-off-by: David Sterba <dsterba@suse.cz>
2015-01-19 13:44:49 +01:00
David Sterba ecbf1339a6 btrfs-progs: cleanup, move getop long options close to their use
Move long_option defintions just before getopt_long everywhere.

Signed-off-by: David Sterba <dsterba@suse.cz>
2015-01-19 13:30:06 +01:00
David Sterba ca7b429f26 btrfs-progs: tests, adjust alignment of the pretty command name
Signed-off-by: David Sterba <dsterba@suse.cz>
2015-01-14 18:34:18 +01:00
David Sterba 8fa12c10e7 btrfs-progs: tests, use the root helper in 012
We need it to mount/umount, to traverse lost+found and stat the results.

Signed-off-by: David Sterba <dsterba@suse.cz>
2015-01-14 18:34:18 +01:00
David Sterba 522e13d6d9 btrfs-progs: tests, add support for running commands under root
Most of the checks run fine without root, but some of them may need to
do a mount test or access the data. Add the support to selectively run
commands under root, hardcoded to sudo for now.

Signed-off-by: David Sterba <dsterba@suse.cz>
2015-01-14 18:34:18 +01:00
Qu Wenruo e6bc739148 btrfs-progs: Move extent tree rebuild test to its dir
Move extent tree rebuild teset to its dir.

Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
2015-01-14 18:34:18 +01:00
Qu Wenruo 21afe4a316 btrfs-progs: Move leaf-corruption no extent data case and add verification script
Move leaf-corruption type no extent data case to its dir, and add
verification script in test.sh

The verification script is based on manual btrfs-debug-tree check.

The image can also be reused to other leaf-corruption type, like
corrupted leaf contains regular file extent data case.

Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
2015-01-14 18:34:18 +01:00
Qu Wenruo a65701b88e btrfs-progs: Move bad root items test cases to its corresponding dir
Now 006-bad-root-items has two cases, one for default case, and one for
skinny metadata case.

Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
2015-01-14 18:34:18 +01:00
Qu Wenruo ebe2f5cac3 btrfs-progs: Move btrfs-image dump to corresponding dir
Move these obvious btrfs-image to its corresponding dir to use the new
infrastructure.

Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
2015-01-14 18:34:18 +01:00
Qu Wenruo 5287625fcf btrfs-progs: New btrfsck test infrastructure
Change the old btrfsck test infrastructure (btrfs-image dump or xz raw
dump) to the new test infrastructure.

1) Test case layout
The new infrastructure is dir based, each dir is one test type, and can
contain multiple images/scripts for different corner cases.
So layout will be the following:
btrfs-progs
	|-tests
	    |-fsck-tests
		|-001-SOME-CORRUPT-TYPE
			|-IMAGE-FOR-CASE1
			|-IMAGE-FOR-CASE2

2) Test case image types
Only 2 types for test case images.
a) btrfs-image dump
   This one is the simplest case, one only needs to add the image to
   corresponding dir.

b) custom script
   This one is for all the resting cases which can't fit btrfs-image,
   like csum error or script can generate the image (this reduces the
   size obviously and good for review)
   The old binary dump also belongs to this type, so need to add script
   to extract them.

Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
2015-01-14 18:34:17 +01:00
Gui Hecheng 3d47cc9ae1 btrfs-progs: remove uneccessary subvol name check for subvol deletion
When we want to delete a subvol, we first check to see whether it is
a subvolume or not. After the check, we are sure that it is a valid
subvol, don't have to check its name.

Signed-off-by: Gui Hecheng <guihc.fnst@cn.fujitsu.com>
[removed unused variable 'len']
Signed-off-by: David Sterba <dsterba@suse.cz>
2015-01-14 18:34:04 +01:00
Fan Chengniang 6eafa191c0 btrfs-progs: btrfstune: fix multiple options error
when we use multiple options, error return status will be override by the
last option status.

example: btrfstune -S 1 -r /dev/loop0

when -S option fails and -r option succeeds, return value is 0, rather than
1, where 1 is the right return status.

Reported-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>
Signed-off-by: Fan Chengniang <fancn.fnst@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
2015-01-14 16:51:16 +01:00
Fan Chengniang 27ceeed1a7 btrfs-progs: add missing options to qgroup limit
btrfs qgroup limit has two options -c and -e,. They were forgotten to add
to manpage.

Signed-off-by: Fan Chengniang <fancn.fnst@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
2015-01-14 16:32:49 +01:00
Qu Wenruo e015a83e6d btrfs-progs: Fix wrong return value when executing 'fi show' on umounted device.
When executing 'btrfs fi show' on unmounted device, even no problem
happens, the return value is still 1 not 0.

The problem lies in search_umounted_fs_uuids(), where when it finds the
given uuid, it should return 1, but later uuid copy overwrites the return
value, causing it always return 0 under that case.

Fix it by pass found as pointer, and return value only indicates
whether anything wrong happens, whether found or not is stored in the
new parameter.

Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
2015-01-14 15:15:06 +01:00
Merlijn Wajer 54498f9a14 btrfs-progs: restore backtrace functionality on glibc
Originally broke in commit c2691f807d

__glibc__ should have been __GLIBC__

We also include features.h ; although most includes (at least stdlib.h)
typically already include it -- at least on glibc, where it matters.

Signed-off-by: Merlijn Wajer <merlijn@wizzup.org>
Reported-by: Josef Bacik <jbacik@fb.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
2015-01-14 15:12:05 +01:00
Martin Volf 3b7a87d795 btrfs-progs: Remove redundant short description from cmd_snapshot_usage
cmd_snapshot_usage in cmds-subvolume.c contains the short description
twice. Remove the first one.

Signed-off-by: Martin Volf <martin.volf.42@gmail.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
2015-01-14 02:20:26 +01:00
David Sterba 0173148050
Btrfs progs v3.18.1
Signed-off-by: David Sterba <dsterba@suse.cz>
2015-01-09 19:22:29 +01:00
Qu Wenruo e960b3f057 btrfs-progs: Don't increase error count if the inode can be repaired.
The original check_inode_recs() will return -1 if found any error in a
inode_record. This is OK for original design since there is almost
nothing can repair at that time.

However more and more error from nlink mismatch to missing inode item
can be repaired in try_repair_inode(), check_inode_recs() should not
increase the error count if the inode can be repair.

With this patch, repair function for leaf-corruption will not return
error if all corruption inode can be recovered.

Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Reviewed-by: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
2015-01-09 19:09:47 +01:00
Fan Chengniang 228a7b3e17 btrfs-progs: fix some format errors in doc
Signed-off-by: Fan Chengniang <fancn.fnst@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
2015-01-09 19:05:40 +01:00
Tsutomu Itoh 1f54bff885 btrfs-progs: doc: fix format of btrfs-replace
Current 'man btrfs-replace' is as follows:

========================================================================
...
...
           -f
               force using and overwriting <targetdev> even if it looks like
               containing a valid btrfs filesystem.

               A valid filesystem is assumed if a btrfs superblock is found
               which contains a correct checksum. Devices which are currently
               mounted are never allowed to be used as the <targetdev>. -B::::
               no background replace.
...
...
========================================================================

The format of 'B' option is wrong. So, fix it.

Signed-off-by: Tsutomu Itoh <t-itoh@jp.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
2015-01-09 18:50:15 +01:00
Qu Wenruo 56eecbe0fe btrfs-progs: Fix a copy-n-paste bug in btrfs_read_fs_root().
Introduced in commit 96ec888aad ("btrfs-progs: add quota group
verify code").

Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Reviewed-by: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
2015-01-09 18:49:44 +01:00
Qu Wenruo dbed21e7c2 btrfs-progs: Fix a buffer overflow causing segfault in fstests/btrfs/069
The newly introduced search_chunk_tree_for_fs_info() won't count devid 0
in fi_arg->num_devices, which will cause buffer overflow since later
get_device_info() will fill di_args with devid.

This can be trigger by fstests/btrfs/069 and any operations needs to
iterate over all the devices like 'fi show' or 'dev stat' while
replacing.

The fix is do an extra probe specifically for devid 0 after
search_chunk_tree_for_fs_info() and change num_devices if needed.

Reported-by: Tsutomu Itoh <t-itoh@jp.fujitsu.com>
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: Gui Hecheng <guihc.fnst@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
2015-01-09 18:46:16 +01:00
Peter Wu 74f7b51c74 btrfs-progs: Documentation: fix broken conversion
Fixes various formatting issues:

Fixes quoting issues in various manpages. Before/After excerpts for
mkfs.btrfs(8), btrfs-qgroup(8):

    mkfs.btrfs [-A|--alloc-start '<alloc-start>']
    mkfs.btrfs [-A|--alloc-start <alloc-start>]
    id 0/<subvolume id>''
    id 0/<subvolume id>
    If multiple '<attr>'s is given, use comma to separate.
    If multiple <attr>s is given, use comma to separate.

The one that is most apparent is the removal of text in
btrfs-subvolume(8) and others. Before/After:

    list [options] [-G <value>] [-C <value>] [--sort=rootid,gen,ogen,path] <path>
    list [options] [-G [+|-]<value>] [-C [+|-]<value>] [--sort=rootid,gen,ogen,path] <path>
    create [-i <qgroupid>] <name>
    create [-i <qgroupid>] [<dest>]<name>

This happens because `<foo>` was replaced by `'<foo>'` in the sed
expression, which is then treated as a constrained quote. As a result,
the `[...]` before the string gets interpreted as "quoted text
attributes".

In this patch, the sed expression is dropped and asciidoc is configured
to recognize `<...>` as a unconstrained quoted string (such that
`<attr>s` is correctly emphasized) and to avoid adding quotes in
contexts where it is not needed.

A remaining problem is that some texts (the one between brackets) do not
add the emphasis for `<...>`. While this could be solved by replacing
`[` and `]` with `&#91;` and `&#93;` using sed, it introduces formatting
problems in btrfs-zero-log(8) because the context is ignored.

Signed-off-by: Peter Wu <peter@lekensteyn.nl>
Signed-off-by: David Sterba <dsterba@suse.cz>
2015-01-09 18:36:50 +01:00
Qu Wenruo 0da591ddf2 btrfs-progs: Fix a extent buffer leak in count_csum_range().
The commit f495a2ac66 ("btrfs-progs: fsck: remove unfriendly BUG_ON()
for searching tree failure") is causing tons of extent buffer leak if some
csum mismatches in btrfsck.

This is caused by a misplaced btrfs_release_path(), fix it.

Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Reviewed-by: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
2015-01-09 18:34:39 +01:00
Qu Wenruo 73cc83d08e btrfs-progs: Allow debug-tree to be executed on regular file.
The commit 1bad43fbe0 ("btrfs-progs: refine btrfs-debug-tree error
prompt when a mount point given")
add judgement on btrfs-debug-tree to restrict only block device to be
executed on, but the command can also be used on regular file, so add
regular file support for the judgement.

Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
2015-01-09 18:34:10 +01:00
David Sterba 1f7ea87871 btrfs-progs: convert, handle pwrite error in do_rollback
Resolves-coverity-id: 1242984
Signed-off-by: David Sterba <dsterba@suse.cz>
2015-01-06 18:56:01 +01:00
David Sterba fe283a4fc3 btrfs-progs: handle orphan creation error in btrfs_unlink
The error handling is simple and just returns an error upward, no
cleanup.

Resolves-coverity-id: 1260251
Signed-off-by: David Sterba <dsterba@suse.cz>
2015-01-06 18:46:03 +01:00
David Sterba 70607997ee btrfs-progs: fix leak of path in reset_balance
A path may leak after an unlikely error condition.

Resolves-coverity-id: 1199474
Signed-off-by: David Sterba <dsterba@suse.cz>
2015-01-03 03:33:31 +01:00
David Sterba 9623d5549e btrfs-progs: safely copy path in btrfs_scan_lblkid
We should terminate the string, let's use the wrapper.

Resolves-coverity-id: 1127097
Signed-off-by: David Sterba <dsterba@suse.cz>
2015-01-03 03:24:10 +01:00
David Sterba cff33e7ebc btrfs-progs: cleanup whitespace in is_same_blk_file
Signed-off-by: David Sterba <dsterba@suse.cz>
2015-01-03 03:22:20 +01:00
David Sterba 190e916dfc btrfs-progs: use strncpy in is_same_blk_file
Although we're getting strings from the caller, let's be safe.

Resolves-coverity-id: 1199475
Signed-off-by: David Sterba <dsterba@suse.cz>
2015-01-03 03:22:19 +01:00
David Sterba fd1e9ad6a8 btrfs-progs: check, handle error in fix_key_order
In case the buffer is corrupted and the for loop does not happen, we'd
return garbage. The caller retunrs -EIO in case of any corruption, use
that value in fix_key_order.

Resolves-coverity-id: 1246944
Signed-off-by: David Sterba <dsterba@suse.cz>
2015-01-03 02:47:32 +01:00
David Sterba de5c542275 btrfs-progs: doc subvolume, sort subcommands alphabetically
Signed-off-by: David Sterba <dsterba@suse.cz>
2015-01-03 02:30:39 +01:00
David Sterba 037532d05c btrfs-progs: doc scrub, sort subcommands alphabetically
Signed-off-by: David Sterba <dsterba@suse.cz>
2015-01-03 02:30:39 +01:00
David Sterba 33623a95c9 btrfs-progs: doc replace, sort subcommands alphabetically
Signed-off-by: David Sterba <dsterba@suse.cz>
2015-01-03 02:30:38 +01:00
David Sterba b7453a4dca btrfs-progs: doc quota, sort subcommands alphabetically
Signed-off-by: David Sterba <dsterba@suse.cz>
2015-01-03 02:30:38 +01:00
David Sterba b07e5ca68e btrfs-progs: doc qgroup, sort subcommands alphabetically
Signed-off-by: David Sterba <dsterba@suse.cz>
2015-01-03 02:30:38 +01:00
David Sterba 9599de3922 btrfs-progs: doc property, sort subcommands alphabetically
Signed-off-by: David Sterba <dsterba@suse.cz>
2015-01-03 02:30:38 +01:00
David Sterba 5eb6956baf btrfs-progs: doc inspect-internal, sort subcommands alphabetically
Signed-off-by: David Sterba <dsterba@suse.cz>
2015-01-03 02:30:38 +01:00
David Sterba 3ce03e3bf7 btrfs-progs: doc device, sort subcommands alphabetically
Signed-off-by: David Sterba <dsterba@suse.cz>
2015-01-03 02:30:38 +01:00
David Sterba 38ce4bef83 btrfs-progs: doc, undocument old balance syntax
Standalone balance subcommand has been around since 3.3.

Signed-off-by: David Sterba <dsterba@suse.cz>
2015-01-03 02:30:38 +01:00
David Sterba 963f2c0a47 btrfs-progs: doc balance, sort subcommands alphabetically
Signed-off-by: David Sterba <dsterba@suse.cz>
2015-01-03 02:30:38 +01:00
David Sterba 9c46986700 btrfs-progs: doc filesystem, sort subcommands alphabetically
Signed-off-by: David Sterba <dsterba@suse.cz>
2015-01-03 02:30:37 +01:00
David Sterba 3bf2e2e867 btrfs-progs: doc btrfs, sort subcommands alphabetically
Signed-off-by: David Sterba <dsterba@suse.cz>
2015-01-03 02:30:37 +01:00
David Sterba c0da6346c6 btrfs-progs: doc restore, cleanups for wiki conversion
Properly format the patch regex and add a line break.

Signed-off-by: David Sterba <dsterba@suse.cz>
2015-01-03 02:30:37 +01:00