Commit Graph

1687 Commits (74f7b51c749d32f7001faa9492f42c99e42c3b37)
 

Author SHA1 Message Date
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
David Sterba 786aa4fa74 btrfs-progs: doc filesystem, cleanups for wiki conversion
Remove trailing space, add line break before NOTE.

Signed-off-by: David Sterba <dsterba@suse.cz>
2015-01-03 02:30:37 +01:00
David Sterba e516e4fd77 btrfs-progs: doc balance, cleanups for wiki conversion
Signed-off-by: David Sterba <dsterba@suse.cz>
2015-01-03 02:30:37 +01:00
David Sterba b63fe003fe btrfs-progs: doc mkfs, cleanups for wiki conversion
- remove trailing whitespace
- use +mono+ formatting for command line example

Signed-off-by: David Sterba <dsterba@suse.cz>
2015-01-03 02:30:37 +01:00
David Sterba 1dbcb0f80c btrfs-progs: doc mkfs, mark leafsize deprecated
Signed-off-by: David Sterba <dsterba@suse.cz>
2015-01-03 02:30:37 +01:00
Tsutomu Itoh 15541064ed btrfs-progs: doc: fix incorrect format of 'l' option in mkfs.btrfs
The format of 'l' option in mkfs.btrfs.txt is wrong.
And, when the head of the character string is 65536, the following warning
is displayed.

    $ make
    Making all in Documentation
        [ASCII]  mkfs.btrfs.xml
    asciidoc: WARNING: mkfs.btrfs.xml.tmp1: line 67: list item index: expected 1 got 65536
        [XMLTO]  mkfs.btrfs.8
        [GZ]     mkfs.btrfs.8.gz
    rm mkfs.btrfs.8 mkfs.btrfs.xml

So, fix it.

Signed-off-by: Tsutomu Itoh <t-itoh@jp.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
2015-01-03 02:30:37 +01:00
David Sterba 18bf3f15a3 btrfs-progs: doc filesystem, add unit suffixes to option descriptions
Reported-by: Chris Murphy <lists@colorremedies.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
2015-01-03 02:30:36 +01:00
David Sterba b4d03be635 btrfs-progs: doc filesystem, fix quoting of size suffixes
Escape the first quote of two to cancel effects of ordinary '...' .

Reported-by: Chris Murphy <lists@colorremedies.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
2015-01-03 02:30:36 +01:00
David Sterba 186ec29394
Btrfs progs v3.18
Signed-off-by: David Sterba <dsterba@suse.cz>
2014-12-30 17:23:12 +01:00
David Sterba f8a24717b1 btrfs-progs: fix minor leak of dev_info in btrfs_scan_kernel
Resolves-coverity-id: 1127098
Signed-off-by: David Sterba <dsterba@suse.cz>
2014-12-30 15:48:55 +01:00
David Sterba 08dfef4fbd btrfs-progs: fix overflow check in btrfs_insert_inode_ref
Resolves-coverity-id: 1260247
Signed-off-by: David Sterba <dsterba@suse.cz>
2014-12-30 15:48:55 +01:00
David Sterba 01a9f4308b btrfs-progs: check, missing parens around compound block in find_normal_file_extent
Resolves-coverity-id: 1260248
Signed-off-by: David Sterba <dsterba@suse.cz>
2014-12-30 15:48:55 +01:00
David Sterba 8499af3484 btrfs-progs: fi show, don't leak canonical path
Resolves-coverity-id: 1260252
Signed-off-by: David Sterba <dsterba@suse.cz>
2014-12-30 15:48:54 +01:00
David Sterba 0665aaf5a3 btrfs-progs: check, fix path leak in error branch
Resolves-coverity-id: 1260250
Signed-off-by: David Sterba <dsterba@suse.cz>
2014-12-30 15:48:54 +01:00
Gui Hecheng d4ef1a06f8 btrfs-progs: Documentation: add T/P/E description for resize cmd
Signed-off-by: Gui Hecheng <guihc.fnst@cn.fujitsu.com>
Reviewed-by: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
2014-12-30 15:48:54 +01:00
Gui Hecheng 1bad43fbe0 btrfs-progs: refine btrfs-debug-tree error prompt when a mount point given
Now, if exec:
	# btrfs-debug-tree <mount_point>
it echos:
	: Superblock bytenr is larger than device size

But it is quite misleading, because it is a valid btrfs.
In this case, we should tell the developer to provide a block device.

After apply:
	: '<mount_point>' is not a block device

Signed-off-by: Gui Hecheng <guihc.fnst@cn.fujitsu.com>
Reviewed-by: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
2014-12-29 18:10:59 +01:00
Gui Hecheng 280434ebde btrfs-progs: move check_arg_type() to util.c
The check_arg_type() function does quite generic thing, move it to
utils.c.

Signed-off-by: Gui Hecheng <guihc.fnst@cn.fujitsu.com>
Reviewed-by: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
2014-12-29 18:10:58 +01:00
Justin Maggard 7d83db5bae btrfs-progs: Fix btrfs fi show by uuid and label
Commit 8be2fff (btrfs-progs: apply realpath for btrfs fi
show when mount point is given) changed the behavior of
btrfs fi show to return an error if the call to realpath()
failed.  This broke the ability to specify a filesystem by
uuid or label.

So let's not consider a failed call to realpath() as an
error.  If the user really specified a bad device, just
return nothing like we did before.

Signed-off-by: Justin Maggard <jmaggard10@gmail.com>
Reviewed-by: Gui Hecheng <guihc.fnst@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
2014-12-29 17:13:58 +01:00
Qu Wenruo 0f38766b8f btrfs-progs: Fix a bug in reset_nlink() which may deletes the recovered file
In reset_nlink(), we believe rec->found_link as accurate number of the
valid links. However it only records the number of found DIR_ITEM, so we
can't use it as reliable value.

Before this patch, in some case, leaf corruption recovery will believe
there is a valid backref but don't add_link() since it can't find any
valid one and don't put it into the lost+found dir.
So the recovered inode will be considered as an orphan item without
orphan item and repair_inode_orphan_item() will add orphan item for it,
causing all the filename/filetype we recovered being a waste of time.

Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
2014-12-29 17:13:41 +01:00
Satoru Takeuchi 44d3ee3e1f btrfs-progs fix wrong memory free on check_is_root
When "/" is Btrfs, "btrfs property <subcommand> /" regards it
as non-root by mistake.

check_is_root() regards @object as a file system root if
the following two conditions are satisfied.

 a) Both @object and its parent directory are Btrfs object
    (file system root, subvolume, inode, and device
    used for Btrfs).
 b) fsid of the above mentioned two objects are different.

It doesn't work if @object is "/" because, in this case,
fsid of "/" and its parent (it's also "/"), are the same.

* Test environment

Two Btrfs file system (not subvolume) "/" and "/home/sat/mnt".

* How to reproduce

Submit "btrfs prop get" against the above mentioned file systems.

* Test Result

** Actual result (without my patch)

==========================
ro=false
label=                 # label is displayed because it's a file system root
ro=false               # label is not displayed even if it's a file system root
==========================
** Expected result (with my patch)

==========================
ro=false
label=
ro=false
label=foo            # label is displayed
===========================

Signed-off-by: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com>
Reported-by: Naohiro Aota <naota@elisp.net>
Reviewed-by: Gui Hecheng <guihc.fnst@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
2014-12-22 18:34:23 +01:00
David Sterba fb7ddc498f btrfs-progs: let btrfs_free_path accept NULL
Same in kernel and matches semantics of free().

Resolves-Coverity-CID: 1054881
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
2014-12-19 18:04:28 +01:00
David Sterba c4ca5c5f3f btrfs-progs: check allocation result in add_clone_source
Resolves-Coverity-CID: 1054894
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
2014-12-19 18:04:25 +01:00
David Sterba 34350d11c1 btrfs-progs: check result of first_cache_extent
If the tree's empty, we'll get NULL and dereference it.

Resolves-Coverity-CID: 1248828
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
2014-12-19 18:04:23 +01:00
David Sterba db0981936c btrfs-progs: fragments, close output file on error
Resolves-Coverity-CID: 1258794
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
2014-12-19 18:04:21 +01:00
David Sterba fbd8e04f4b btrfs-progs: corrupt block, add break after option U
Resolves-Coverity-CID: 1258793
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
2014-12-19 18:04:18 +01:00
David Sterba 814857f9e1 btrfs-progs: corrupt block, add missing break to option I
Using -I would imply -d.

Resolves-Coverity-CID: 1258792
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
2014-12-19 18:04:15 +01:00
David Sterba 3f22699030 btrfs-progs: move contents of math.h to utils.h and delete
Signed-off-by: David Sterba <dsterba@suse.cz>
2014-12-19 15:31:00 +01:00
Satoru Takeuchi 0e4e1b1ed9 btrfs-progs: cleanup: avoid to use literal for getopt val
Signed-off-by: David Sterba <dsterba@suse.cz>
2014-12-19 15:07:02 +01:00