Commit Graph

2702 Commits (72e2a08a5c6d5f12be273e286e3355496e4a2f08)
 

Author SHA1 Message Date
David Sterba 40dc7c504c btrfs-progs: docs: man5, add space_cache=v2
Signed-off-by: David Sterba <dsterba@suse.com>
2016-03-17 14:49:32 +01:00
David Sterba 974d2ed564 btrfs-progs: tests: add 013-subvolume-sync-crash
Test for "btrfs-progs: subvol sync: fix memory corruption, undersized
array", a lot of deleted subvolumes in the 'subvol sync' will not fit
into the array, should result in a glibc report.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-03-17 14:22:43 +01:00
David Sterba cdd1bae403 btrfs-progs: subvol sync: fix memory corruption, undersized array
The subvol sync command crashed randomly at the end with

*** glibc detected *** btrfs: double free or corruption (out): 0x00000000006ab040 ***

This is caused by running out of the ids array in case there are more
than 128 subvolumes. The array is increased in steps but does not
account the size of the item, so there was room for 1024 / 8 = 128
subvolume ids.

Fixes: c9f885ec89 ("btrfs-progs: subvol: let sync check only current deletions")
Signed-off-by: David Sterba <dsterba@suse.com>
2016-03-17 11:41:18 +01:00
David Sterba aa9c695f65
Btrfs progs v4.5-rc1
Signed-off-by: David Sterba <dsterba@suse.com>
2016-03-16 19:07:12 +01:00
David Sterba c58e4d40bf btrfs-progs: docs: fi defrag, make some paragraphs more visible
Signed-off-by: David Sterba <dsterba@suse.com>
2016-03-16 19:03:05 +01:00
David Sterba ded784f416 btrfs-progs: mkfs: also parse raid0 profile case-insensitive
Signed-off-by: David Sterba <dsterba@suse.com>
2016-03-16 17:41:16 +01:00
Liu Bo cc25de4aa7 btrfs-progs: btrfs-debugfs: fetch block group information
This aims to decide whether a balance can reduce the number of
data block groups and if it is, this shows the '-dvrange' block
group's objectid.

Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2016-03-16 10:33:11 +01:00
Satoru Takeuchi c742debab1 btrfs-progs: fix a regression that "property" with -t option doesn't work
"property" is considered as working without any options
from the following commit.

commit 176aeca9a148 ("btrfs-progs: add getopt stubs where needed")

However, we can pass -t option to this command.

* actual result

  ==================================================
  $ ./btrfs prop list -t f /btrfs
  btrfs property list: invalid option -- 't'
  usage: btrfs property list [-t <type>] <object>

      Lists available properties with their descriptions for the given object.

      Please see the help of 'btrfs property get' for a description of
      objects and object types.

  ==================================================

* expected result

  ==================================================
  $ ./btrfs prop list -t f /btrfs
  label               Set/get label of device.
  ==================================================

Signed-off-by: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com
Signed-off-by: David Sterba <dsterba@suse.com>
2016-03-16 10:19:42 +01:00
Satoru Takeuchi 4b80569b58 btrfs-progs: Describe optarg of -m option in the manpage of receive
Signed-off-by: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2016-03-16 10:16:20 +01:00
David Sterba 4685a56081 btrfs-progs: fi du: make the output more aligned
Signed-off-by: David Sterba <dsterba@suse.com>
2016-03-15 19:00:57 +01:00
David Sterba b44d130828 btrfs-progs: fi du: update help text
Move the command-specific options to the beginning, add missing long
option.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-03-15 18:25:05 +01:00
David Sterba fabe745d3b btrfs-progs: docs: add filesystem du
Signed-off-by: David Sterba <dsterba@suse.com>
2016-03-15 18:25:05 +01:00
David Sterba 80414d6939 btrfs-progs: remove btrfs-show-super manual page and point to inspect-internal
Signed-off-by: David Sterba <dsterba@suse.com>
2016-03-15 17:27:34 +01:00
David Sterba 7aedf5067b btrfs-progs: docs: update dump-super
Signed-off-by: David Sterba <dsterba@suse.com>
2016-03-15 17:16:00 +01:00
David Sterba 029b2433eb btrfs-progs: docs: rename and move dump-super
The command name is 'dump-super', move the section to it's alphabetical
order.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-03-15 16:44:55 +01:00
David Sterba 17c7df6fed btrfs-progs: dump-super: add more long options
Signed-off-by: David Sterba <dsterba@suse.com>
2016-03-15 16:41:06 +01:00
David Sterba a54ef26e51 btrfs-progs: dump-super: switch to getopt_long
Signed-off-by: David Sterba <dsterba@suse.com>
2016-03-15 16:32:39 +01:00
David Sterba 3299da86fe btrfs-progs: fix resource leak during device scanning
The dev info is leaked each time we find a known filesystem.

Resolves-coverity-id: 1127098
Signed-off-by: David Sterba <dsterba@suse.com>
2016-03-15 10:28:14 +01:00
David Sterba 3bb71d27ac btrfs-progs: utils: switch more error messages to common helpers
Functions relatd to device changes/status/open, mount checks.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-03-14 14:38:16 +01:00
David Sterba 230bb91aa8 btrfs-progs: improve error messages after failed wiping
Signed-off-by: David Sterba <dsterba@suse.com>
2016-03-14 14:18:32 +01:00
Anand Jain 2490de5da5 btrfs-progs: Introduce device delete by devid
This patch introduces new option <devid> for the command

  btrfs device delete <device_path|devid>[..]  <mnt>

In a user reported issue on a 3-disk-RAID1, one disk failed with its
SB unreadable. Now with this patch user will have a choice to delete
the device using devid.

The other method we could do, is to match the input device_path
to the available device_paths with in the kernel. But that won't
work in all the cases, like what if user provided mapper path
when the path within the kernel is a non-mapper path.

This patch depends on the below kernel patch for the new feature to work,
however it will fail-back to the old interface for the kernel without the
patch

  Btrfs: Introduce device delete by devid

Signed-off-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2016-03-14 14:11:33 +01:00
David Sterba 5f17513313 btrfs-progs: docs: fix more typos and spelling errors
With help of ispell.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-03-14 14:11:31 +01:00
Alexander Fougner 1086629272 btrfs-progs: docs: fix spelling errors
Signed-off-by: Alexander Fougner <fougner89@gmail.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2016-03-14 13:44:17 +01:00
Satoru Takeuchi fc4c784b65 btrfs-progs: Avoid interpreting options after "--" when getting unit mode
* actual result

  ======================================
  # ./btrfs device usage -- -m /btrfs

  /dev/sdf1, ID: 1
     Device size:          95367.41MiB
     Data,single:          2056.00MiB
     Metadata,DUP:         2048.00MiB
     System,DUP:             16.00MiB
     Unallocated:          91247.41MiB
  ======================================

* expected result

  ======================================
  # ./btrfs device usage -- -m /btrfs

  ERROR: can't access '-m': No such file or directory
  ======================================

Signed-off-by: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2016-03-14 13:42:47 +01:00
Satoru Takeuchi 1a521af045 btrfs-progs: Fix a regression that btrfs filesystem label doesn't work
The number of arguments which is allowed to pass became wrong
from the following commit.

commit 176aeca9a148c5e29de0 ("btrfs-progs: add getopt stubs where needed")

* actual result

  ===========================================================
  # ./btrfs prop get /btrfs label
  label=foo
  # ./btrfs fi label /btrfs
  btrfs filesystem label: too few arguments
  usage: btrfs filesystem label [<device>|<mount_point>] [<newlabel>]

      Get or change the label of a filesystem

      With one argument, get the label of filesystem on <device>.
      If <newlabel> is passed, set the filesystem label to <newlabel>.

  # ./btrfs fi label /btrfs bar
  foo
  # ./btrfs prop get /btrfs label
  label=foo
  ===========================================================

* expected result

  ===========================================================
  # ./btrfs prop get /btrfs label
  label=foo
  # ./btrfs fi label /btrfs
  foo
  # ./btrfs fi label /btrfs bar
  # ./btrfs prop get /btrfs label
  label=bar
  ===========================================================

Signed-off-by: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2016-03-14 13:42:47 +01:00
Wang Xiaoguang cfa4b5bc4d btrfs-progs: print-tree: show the compression method string
Signed-off-by: Wang Xiaoguang <wangxg.fnst@cn.fujitsu.com>
[ changed the format of unknown value ]
Signed-off-by: David Sterba <dsterba@suse.com>
2016-03-14 13:42:47 +01:00
Satoru Takeuchi 1ff2823225 btrfs-progs: Fix device scan to interpret its argument properly
Fix the following bug.

  ================================
  # btrfs device scan -- /dev/sdb
  ERROR: not a block device: --
  ================================

It should work as follow.

  ================================
  # ./btrfs device scan -- /dev/sdb
  Scanning for Btrfs filesystems in '/dev/sdb'
  ================================

Signed-off-by: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2016-03-14 13:42:47 +01:00
Yauhen Kharuzhy 3ee935e4dd btrfs-progs: Dont' stop scanning of devices at first failed device
When 'btrfs device scan' command is invoked, it scans all devices,
check them for btrfs superblock and add devices with btrfs to a list.

Next, each device from the list is passed to kernel where it is handled
in the btrfs_scan_one_device() function. This function can, for example,
return -EBUSY when device contains superblock matched to existing and
mounted filesystem (if this device was pulled out from RAID and
connected again after some time).

btrfs tool stops device scan if any device has been failed to add, so
other existing devices with (possibly) valid FS will never be reached.

Fix this by remove stopping at any failure in the btrfs_register_all_devices(),
just return error count. btrfs_scan_one_device() reports any kind of
error already.

Signed-off-by: Yauhen Kharuzhy <yauhen.kharuzhy@zavadatar.com>
[ initialize err to 0 ]
Signed-off-by: David Sterba <dsterba@suse.com>
2016-03-14 13:42:47 +01:00
David Sterba 83ad1dcbb0 btrfs-progs: remove btrfs-debug-tree manual page and point to inspect-internal
Signed-off-by: David Sterba <dsterba@suse.com>
2016-03-14 13:42:47 +01:00
David Sterba 69874af7b8 btrfs-progs: dump-tree: let --tree understand name of the tree
For practical purposes teach -t about the human readable names of the
trees in addition to the numerical id. The name syntax is flexible.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-03-14 13:42:47 +01:00
David Sterba 1538bc01ad btrfs-progs: docs: update dump-tree
Signed-off-by: David Sterba <dsterba@suse.com>
2016-03-14 13:42:47 +01:00
David Sterba 4088b770e1 btrfs-progs: dump-tree: print version information earlier
The version information could be useful addition to the dump, print it
before we attempt to open the filesystem.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-03-14 13:42:47 +01:00
David Sterba 078b4746cc btrfs-progs: dump-tree: print tree keys with -e
The incomplete tree description is printed with -e, glued to the leaf
information.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-03-14 13:42:47 +01:00
Satoru Takeuchi 142041bb03 btrfs-progs: Describe device scan -d is a deprecated option in manpage
It's already marked as deprecated in cmd_device_scan_usage().

commit 5444864e56 ("btrfs-progs: remove BTRFS_SCAN_PROC scan method")

Signed-off-by: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2016-03-14 13:42:47 +01:00
Feifei Xu b025392ffc btrfs-progs: Replace hardcoded PAGE_CACHE_SIZE with sectorsize.
PAGE_CACHE_SIZE is hardcoded to 4K in cmds-restore.c. Correct
value should be sector size. Fix this through replacing
hardcoded 4K to sectorsize.

Signed-off-by: Feifei Xu <xufeifei@linux.vnet.ibm.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2016-03-14 13:42:47 +01:00
David Sterba 378e12701a btrfs-progs: check: unify naming of long option values
We use GETOP_VAL_ .

Signed-off-by: David Sterba <dsterba@suse.com>
2016-03-14 13:42:47 +01:00
David Sterba 28d924290e btrfs-progs: docs: update check options
Signed-off-by: David Sterba <dsterba@suse.com>
2016-03-14 13:42:47 +01:00
David Sterba d3257893d5 btrfs-progs: check: drop short option for --chunk-tree
The need to specify the chunk root is not that common, we will reserve
the short option -c for later use.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-03-14 13:42:47 +01:00
Lu Fengqi 05640939ea btrfs-progs: Add new option for specify chunk root bytenr
Add new btrfsck option, '--chunk-root', to specify chunk root bytenr.
And allow open_ctree_fs_info() function accept chunk_root_bytenr to
override the bytenr in superblock. This will be mainly used when chunk
tree corruption.

Signed-off-by: Lu Fengqi <lufq.fnst@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2016-03-14 13:42:47 +01:00
Yauhen Kharuzhy da3ae9c69a btrfs-progs: fix broken 'device scan' arguments parsing
Commit 52179e4fea41e55f31c92cd033a0b53a5107b4f4 'btrfs-progs: unify argc
min/max checking' breaks 'btrfs device scan' command when no argument
was given. Fix this.

Signed-off-by: Yauhen Kharuzhy <yauhen.kharuzhy@zavadatar.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2016-03-14 13:42:47 +01:00
David Sterba d08c73d40c btrfs-progs: unify argc min/max checking, a few more
We don't want to modify argc.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-03-14 13:42:47 +01:00
Qu Wenruo af83da99d6 btrfs-progs: util: Fix a wrong unit of pretty_size
If parameter for pretty_size is smaller than default base(1024),
pretty_size() will output wrong unit.
For example, pretty_size(1008) will output '0.98B' not '1008B' or
'0.98KiB'.

The cause is, for default base and auto-detect unit, base will be 1024
but num_divs is still 0, last result will still be divided by base,
causing the bug.

Fix it by checking num_divs in default case, and if num_divs is 0,
change base to 1.

Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2016-03-14 13:42:47 +01:00
David Sterba 9f76654de8 btrfs-progs: tests: add image for bko#96971 (bad checksum type)
Signed-off-by: David Sterba <dsterba@suse.com>
2016-03-14 13:42:47 +01:00
Ondrej Kozina 5d23b6a7b0 btrfs-progs: libbtrfs: remove max/min macros from API
kerncompat.h header file is part of libbtrfs API. min/max macros cause
conflict while building projects dependant on libbtrfs. Moving those
macros to btrfs-progs internal header file fixes the conflict.

Signed-off-by: Ondrej Kozina <okozina@redhat.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2016-03-14 13:42:47 +01:00
Vytas Dauksa 1e8246a058 btrfs-progs: convert: document -O|--features flag
Copy-pasted description found at mkfs.btrfs. I did not bother with
feature list as it seemed to be incomplete.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-03-14 13:42:47 +01:00
David Sterba 5a3cbe16db btrfs-progs: don't print message for a missing device
The message

	"warning devid %llu not found already\n",

does not seem to be too useful, it appears during several commands and
sometimes repeatedly.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-03-14 13:42:47 +01:00
David Sterba 5851386ce2 btrfs-progs: restore: update error messages
Switch to common helpers, message wording changed.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-03-14 13:42:47 +01:00
David Sterba d66d44eacb btrfs-progs: switch more error messages to common helpers
Signed-off-by: David Sterba <dsterba@suse.com>
2016-03-14 13:42:47 +01:00
David Sterba 49fef369ff btrfs-progs: tests: fix misc/005-long-device-name-for-ssd
We use a device mapper device on top of a loop device, the change in
rotational status does not always propagate if change it at the loop
device sysfs node.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-03-14 13:42:47 +01:00
David Sterba 62830bcb23 btrfs-progs: inspect: remove unnecessary helpers
Signed-off-by: David Sterba <dsterba@suse.com>
2016-03-14 13:42:47 +01:00