David Sterba [Fri, 30 Oct 2015 14:34:55 +0000 (15:34 +0100)]
btrfs-progs: image: fix bogus check after cpu on-line detection
Comparing unsigned type for <= 0 does not make much sense, we should
really check the signed value returned by sysconf.
Resolves-coverity-id: 1324536
Signed-off-by: David Sterba <dsterba@suse.com>
Zhao Lei [Thu, 29 Oct 2015 09:31:48 +0000 (17:31 +0800)]
btrfs-progs: Avoid use pointer in handle_options
We use pointer of argc and argv in handle_options() because they
are necessary in very old code which are not exist now.
This patch move to use argc and argv directly in handle_options(),
alone with following update:
1: rename handle_options() to check_options()
to fit its function.
2: cleanup for condition in handle_options() to make line short.
Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Zhao Lei [Thu, 29 Oct 2015 09:31:46 +0000 (17:31 +0800)]
btrfs-progs: Fix uninitialized key.type for btrfs_find_free_objectid
To avoid using uninitialized value in btrfs_search_slot().
Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Zhao Lei [Thu, 29 Oct 2015 09:31:44 +0000 (17:31 +0800)]
btrfs-progs: Fix negative eb's ref_cnt in btrfs-calc-size
btrfs-calc-size show following warning:
# btrfs-calc-size /dev/sda6
Calculating size of root tree
...
extent_io.c:582: free_extent_buffer: Assertion `eb->refs < 0` failed.
./btrfs-calc-size[0x41d642]
./btrfs-calc-size(free_extent_buffer+0x70)[0x41e1c1]
./btrfs-calc-size(btrfs_free_fs_root+0x11)[0x40e1e8]
./btrfs-calc-size[0x40e215]
./btrfs-calc-size(rb_free_nodes+0x1d)[0x4326fe]
./btrfs-calc-size(close_ctree+0x3f3)[0x40f9ea]
./btrfs-calc-size(main+0x200)[0x431b4e]
/lib64/libc.so.6(__libc_start_main+0xf5)[0x3858621d65]
./btrfs-calc-size[0x407009]
Reason:
path in calc_root_size() is only used to save node data,
it don't hold ref_cnt for each eb in.
Using btrfs_free_path() to free path will reduce these eb
again, and cause many problems, as negative ref_cnt or
invalid memory access.
Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Zhao Lei [Thu, 29 Oct 2015 09:31:43 +0000 (17:31 +0800)]
btrfs-progs: fix floating point exception for btrfs-calc-size
Current code exit with floating point exception on a blank fs:
# btrfs-calc-size -b /dev/sda6
Calculating size of root tree
Total size: 16384
Inline data: 0
Total seeks: 0
Forward seeks: 0
Backward seeks: 0
Floating point exception
This patch add a condition check for above case.
Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Tue, 27 Oct 2015 16:17:47 +0000 (17:17 +0100)]
btrfs-progs: add initial tests/README
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Tue, 27 Oct 2015 15:30:22 +0000 (16:30 +0100)]
btrfs-progs: add an initial README
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Mon, 26 Oct 2015 19:02:22 +0000 (20:02 +0100)]
btrfs-progs: mkfs: remove stray message about forced mixed-bg
We no longer force mixed-bg mode since "Btrfs-progs: Do not force mixed
block group creation unless '-M' option is specified", the message is
not relevant anymore.
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Mon, 26 Oct 2015 18:54:57 +0000 (19:54 +0100)]
btrfs-progs: tests: add 003-mixed-with-wrong-nodesize
Mixed mode needs equal sectorsize and nodesize. This was fixed by
"Btrfs-progs: Prevent creation of filesystem with 'mixed bgs' and
having differing sectorsize and nodesize"
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Mon, 26 Oct 2015 18:51:10 +0000 (19:51 +0100)]
btrfs-progs: tests: do not log output of run_mayfail to terminal
No need to log expected failures to the terminal, the results file is
fine; pass the return value of the command.
Signed-off-by: David Sterba <dsterba@suse.com>
Chandan Rajendra [Wed, 14 Oct 2015 17:40:38 +0000 (23:10 +0530)]
Btrfs-progs: Prevent creation of filesystem with 'mixed bgs' and having differing sectorsize and nodesize.
mkfs.btrfs allows creation of Btrfs filesystem instances with mixed block
group feature enabled and having a sectorsize different from nodesize.
For e.g:
[root@localhost btrfs-progs]# mkfs.btrfs -f -M -s 4096 -n 16384 /dev/loop0
Forcing mixed metadata/data groups
btrfs-progs v3.19-rc2-404-gbbbd18e-dirty
See http://btrfs.wiki.kernel.org for more information.
Performing full device TRIM (4.00GiB) ...
Label: (null)
UUID:
c82b5720-6d88-4fa1-ac05-
d0d4cb797fd5
Node size: 16384
Sector size: 4096
Filesystem size: 4.00GiB
Block group profiles:
Data+Metadata: single 8.00MiB
System: single 4.00MiB
SSD detected: no
Incompat features: mixed-bg, extref, skinny-metadata
Number of devices: 1
Devices:
ID SIZE PATH
1 4.00GiB /dev/loop6
This commit fixes the issue by setting BTRFS_FEATURE_INCOMPAT_MIXED_GROUPS
feature bit before checking the validity of nodesize that was specified on the
command line.
Signed-off-by: Chandan Rajendra <chandan@linux.vnet.ibm.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Zhao Lei [Mon, 26 Oct 2015 10:28:22 +0000 (18:28 +0800)]
btrfs-progs: use system's default path for math.h
Line of
#include "math.h"
in extent-tree.c using quotas is historical reason, (we had custom
math.h before).
Use "<>" instead of quotes in this header file.
Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Zhao Lei [Mon, 26 Oct 2015 10:28:21 +0000 (18:28 +0800)]
btrfs-progs: Add missing close_ctree to btrfs-select-super.c
Add missing close_ctree() to btrfs-select-super.c to avoid memory leak.
Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Zhao Lei [Mon, 26 Oct 2015 10:28:20 +0000 (18:28 +0800)]
btrfs-progs: Add all missing btrfs_close_all_devices to standalone tools
This patch add all missing btrfs_close_all_devices() to standalone
tools in btrfs progs, to avoid memory leak.
Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Zhao Lei [Mon, 26 Oct 2015 10:28:19 +0000 (18:28 +0800)]
btrfs-progs: Remove all btrfs_close_all_devices in sub-command
Since we have btrfs_close_all_devices() in btrfs's main entrance,
it is not necessary to call btrfs_close_all_devices() separately
in each sub-command.
Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Zhao Lei [Mon, 26 Oct 2015 10:28:18 +0000 (18:28 +0800)]
btrfs-progs: btrfs: Add missing btrfs_close_all_devices for btrfs command
Adding a btrfs_close_all_devices() after command callback in btrfs.c
can force-close all opened device before program exit, to avoid memory leak
in all btrfs sub-command.
Suggested-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Mon, 26 Oct 2015 14:03:37 +0000 (15:03 +0100)]
btrfs-progs: tests: add support for command instrumentation
Add a way to wrap commands executed by the tests. This means the
common wrappers: run_check, run_check_stdout and run_mayfail , with the
exception of the use root_helper.
The contents of the shell variable INSTRUMENT are prepended to the
command, without quotes. Use with care.
Example: this has been tested with valgrind, the output goes to the
RESULTS file.
$ INSTRUMENT=valgrind make test-misc
Any use of root_helper/SUDO_HELPER will skip the instrumentation.
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Mon, 26 Oct 2015 13:36:47 +0000 (14:36 +0100)]
btrfs-progs: tests: 001-simple-unmounted: iterate over fuzzed images and run check
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Mon, 26 Oct 2015 13:35:34 +0000 (14:35 +0100)]
btrfs-progs: tests: add test driver for fuzzed images
Signed-off-by: David Sterba <dsterba@suse.com>
Anand Jain [Thu, 22 Oct 2015 03:58:05 +0000 (11:58 +0800)]
btrfs-progs: fix missing initialization of list head for dev_list
Signed-off-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Anand Jain [Thu, 22 Oct 2015 03:53:39 +0000 (11:53 +0800)]
btrfs-progs: fix uninitialized copy of btrfs_fs_devices list
Noticed that at print_one_uuid() some of the members of btrfs_fs_devices
contained some junk values. It took a while to dig this further, and found
that we make a local copy of the btrfs_fs_devices list at
search_umounted_fs_uuids() and wasn't initialized properly.
Fixed using using calloc instead of malloc.
Signed-off-by: Anand Jain <anand.jain@oracle.com>
[ switched to calloc ]
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Fri, 23 Oct 2015 09:34:50 +0000 (11:34 +0200)]
btrfs-progs: tests: do not run sudo helper tests if not necessary
We use setup_root_helper in some helpers to make sure that the sudo
helper is set up, and adding that to each test. Make the real test run
only once.
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Fri, 23 Oct 2015 09:25:55 +0000 (11:25 +0200)]
btrfs-progs: tests: set default test image size to 2G
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Fri, 23 Oct 2015 09:43:41 +0000 (11:43 +0200)]
btrfs-progs: tests: add 010-convert-delete-ext2-subvol
Testcase for "Btrfs-progs: fix btrfs-convert rollback to check
ROOT_BACKREF", make sure we don't try a rollback if the ext2_subvol is
half-deleted.
Signed-off-by: David Sterba <dsterba@suse.com>
Liu Bo [Sun, 18 Oct 2015 05:44:41 +0000 (13:44 +0800)]
Btrfs-progs: fix btrfs-convert rollback to check ROOT_BACKREF
Btrfs has changed to delete subvolume/snapshot asynchronously, which
means that after umount itself, if we've already deleted 'ext2_saved',
rollback can still be completed.
So this adds a check for ROOT_BACKREF before checking ROOT_ITEM since
ROOT_BACKREF is immediately not in the btree after
ioctl(BTRFS_IOC_SNAP_DESTROY) returns.
Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
Reviewed-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
[ updated error messages ]
Signed-off-by: David Sterba <dsterba@suse.com>
Eryu Guan [Mon, 19 Oct 2015 11:37:55 +0000 (19:37 +0800)]
btrfs-progs: mute coverity warnings about deadcode
Coverity reports execution cannot reach this statements. So put WARN_ON
in if-else conditions.
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Mon, 19 Oct 2015 16:12:35 +0000 (18:12 +0200)]
btrfs-progs: tests: add 002-no-force-mixed-on-small-volume
Verify that we do not force mixed block groups on small volumes anymore.
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Mon, 19 Oct 2015 15:29:14 +0000 (17:29 +0200)]
btrfs-progs: tests: add 001-basic-profiles mkfs tests
Basic test to cover block group profile combinations.
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Mon, 19 Oct 2015 15:27:55 +0000 (17:27 +0200)]
btrfs-progs: tests: add mkfs tests
Mkfs deserves it's own.
Signed-off-by: David Sterba <dsterba@suse.com>
Chandan Rajendra [Wed, 14 Oct 2015 17:39:37 +0000 (23:09 +0530)]
Btrfs-progs: Do not force mixed block group creation unless '-M' option is specified
When creating small Btrfs filesystem instances (i.e. filesystem size <= 1GiB),
mkfs.btrfs fails if both sectorsize and nodesize are specified on the command
line and sectorsize != nodesize, since mixed block groups involves both data
and metadata blocks sharing the same block group. This is an incorrect behavior
when '-M' option isn't specified on the command line.
This commit makes optional the creation of mixed block groups i.e. Mixed block
groups are created only when -M option is specified on the command line.
Since we now allow small filesystem instances with sectorsize != nodesize to
be created, we can end up in the following situation,
[root@localhost ~]# mkfs.btrfs -f -n 65536 /dev/loop0
btrfs-progs v3.19-rc2-405-g976307c
See http://btrfs.wiki.kernel.org for more information.
Performing full device TRIM (512.00MiB) ...
Label: (null)
UUID:
49fab72e-0c8b-466b-a3ca-
d1bfe56475f0
Node size: 65536
Sector size: 4096
Filesystem size: 512.00MiB
Block group profiles:
Data: single 8.00MiB
Metadata: DUP 40.00MiB
System: DUP 12.00MiB
SSD detected: no
Incompat features: extref, skinny-metadata
Number of devices: 1
Devices:
ID SIZE PATH
1 512.00MiB /dev/loop0
[root@localhost ~]# mount /dev/loop0 /mnt/
mount: mount /dev/loop0 on /mnt failed: No space left on device
The ENOSPC occurs during the creation of the UUID tree. This is because of
things like large metadata block size, DUP mode used for metadata and global
reservation consuming space. Also, large nodesize does not make sense on small
filesystems, hence this should not be an issue.
Signed-off-by: Chandan Rajendra <chandan@linux.vnet.ibm.com>
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Mon, 19 Oct 2015 14:31:14 +0000 (16:31 +0200)]
btrfs-progs: add helpers to print ranges
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Tue, 13 Oct 2015 14:34:33 +0000 (16:34 +0200)]
btrfs-progs: add helpers for parsing 32bit ranges
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Sun, 11 Oct 2015 22:29:31 +0000 (00:29 +0200)]
btrfs-progs: extend parse_range API to accept a relaxed range
In some cases we want to accept a range of type [a..a]. Add a new
function to do the 'a < b' check for the caller and use it.
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Fri, 16 Oct 2015 12:51:20 +0000 (14:51 +0200)]
btrfs-progs: do not modify the string in parse_range
It's passed as const but we modify it through 'dots'. This would break
parsing the string multiple times.
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Sun, 11 Oct 2015 22:16:18 +0000 (00:16 +0200)]
btrfs-progs: cleanup and comment parse_range
Simplify a check and unindent some code.
Signed-off-by: David Sterba <dsterba@suse.com>
Anand Jain [Sat, 10 Oct 2015 14:30:57 +0000 (22:30 +0800)]
btrfs-progs: device add: cleanup argument handling
This is needed by the patch which introduces new devid option for the
btrfs device delete.
Signed-off-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Anand Jain [Sat, 10 Oct 2015 14:30:56 +0000 (22:30 +0800)]
btrfs-progs: move is_numerical() helper to utils and rename
Signed-off-by: Anand Jain <anand.jain@oracle.com>
[ moved to util.c and renamed ]
Signed-off-by: David Sterba <dsterba@suse.com>
Eryu Guan [Mon, 19 Oct 2015 11:38:00 +0000 (19:38 +0800)]
btrfs-progs: return -ENOMEM properly in btrfs_read_block_groups()
Breaking from the while loop makes ret overwritten to zero, goto error
label directly and return -ENOMEM.
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Eryu Guan [Mon, 19 Oct 2015 11:37:59 +0000 (19:37 +0800)]
btrfs-progs: fix memory leak in cmd_qgroup_show()
filter_set and comparer_set should be freed on return.
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Eryu Guan [Mon, 19 Oct 2015 11:37:58 +0000 (19:37 +0800)]
btrfs-progs: remove identical branch in record_extent()
The same code is executed when the condition "ret" is true or false,
because the code in the if-then branch and after the if statement is
identical.
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Eryu Guan [Mon, 19 Oct 2015 11:37:57 +0000 (19:37 +0800)]
btrfs-progs: fix memory leak on error path
dev_scans and t_scans should be freed on malloc error.
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Eryu Guan [Mon, 19 Oct 2015 11:37:51 +0000 (19:37 +0800)]
btrfs-progs: save and return error number correctly in check_chunks_and_extents
The variable "err" is assigned to "ret" then "ret" gets overwritten by
check_extent_refs() before "ret" can be used. Reported by Coverity.
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Eryu Guan [Mon, 19 Oct 2015 11:37:50 +0000 (19:37 +0800)]
btrfs-progs: fix leak of "path" in btrfs_find_item() error paths
path needs to be freed before return.
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Zhao Lei [Mon, 12 Oct 2015 13:23:04 +0000 (21:23 +0800)]
btrfs-progs: fragments: use btrfs_open_dir for btrfs-fragments command
We can use btrfs_open_dir() to check whether target dir is
in btrfs's mount point before open, instead of checking it in
deeper code, and return fuzzy error message.
Before patch:
./btrfs-fragments -o 123 /mnt/tmp1
ERROR: can't perform the search
After patch:
# ./btrfs-fragments -o 123 /mnt/tmp1
ERROR: not a btrfs filesystem: /mnt/tmp1
Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Zhao Lei [Mon, 12 Oct 2015 13:23:03 +0000 (21:23 +0800)]
btrfs-progs: replace: use btrfs_open_dir for btrfs replace command
We can use btrfs_open_dir() to check whether target dir is
in btrfs's mount point before open, instead of checking it in
kernel space of ioctl, and return fuzzy error message.
Before patch:
# ./btrfs replace cancel /mnt/tmp1
ERROR: ioctl(DEV_REPLACE_CANCEL) failed on "/mnt/tmp1": Inappropriate ioctl for device
# ./btrfs replace status /mnt/tmp1
ERROR: ioctl(DEV_REPLACE_STATUS) failed on "/mnt/tmp1": Inappropriate ioctl for device
After patch:
# ./btrfs replace cancel /mnt/tmp1
ERROR: not a btrfs filesystem: /mnt/tmp1
# ./btrfs replace status /mnt/tmp1
ERROR: not a btrfs filesystem: /mnt/tmp1
Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Zhao Lei [Mon, 12 Oct 2015 13:23:02 +0000 (21:23 +0800)]
btrfs-progs: use btrfs_open_dir in open_path_or_dev_mnt
Use btrfs_open_dir() in open_path_or_dev_mnt() to make the function
return error when target is neither block device nor btrfs mount point.
Also add "verbose" argument to let function output common error
message instead of putting duplicated lines in caller.
Before patch:
# ./btrfs device stats /mnt/tmp1
ERROR: getting dev info for devstats failed: Inappropriate ioctl for device
# ./btrfs replace start /dev/vdd /dev/vde /mnt/tmp1
ERROR: ioctl(DEV_REPLACE_STATUS) failed on "/mnt/tmp1": Inappropriate ioctl for device
After patch:
# ./btrfs device stats /mnt/tmp1
ERROR: not a btrfs filesystem: /mnt/tmp1
# ./btrfs replace start /dev/vdd /dev/vde /mnt/tmp1
ERROR: not a btrfs filesystem: /mnt/tmp1
Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Zhao Lei [Mon, 12 Oct 2015 13:23:01 +0000 (21:23 +0800)]
btrfs-progs: quota: use btrfs_open_dir for btrfs quota command
We can use btrfs_open_dir() to check whether target dir is
in btrfs's mount point before open, instead of checking it in
kernel space of ioctl, and return fuzzy error message.
Before patch:
# ./btrfs quota enable /mnt/tmp1
ERROR: quota command failed: Inappropriate ioctl for device
# ./btrfs quota disable /mnt/tmp1
ERROR: quota command failed: Inappropriate ioctl for device
# ./btrfs quota rescan /mnt/tmp1
ERROR: quota rescan failed: Inappropriate ioctl for device
#
After patch:
# ./btrfs quota enable /mnt/tmp1
ERROR: not a btrfs filesystem: /mnt/tmp1
# ./btrfs quota disable /mnt/tmp1
ERROR: not a btrfs filesystem: /mnt/tmp1
# ./btrfs quota rescan /mnt/tmp1
ERROR: not a btrfs filesystem: /mnt/tmp1
#
Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Zhao Lei [Mon, 12 Oct 2015 13:23:00 +0000 (21:23 +0800)]
btrfs-progs: qgroup: use btrfs_open_dir for btrfs qgroup command
We can use btrfs_open_dir() to check whether target dir is
in btrfs's mount point before open, instead of checking it in
kernel space of ioctl, and return fuzzy error message.
Before patch:
# ./btrfs qgroup create 1/5 /mnt/tmp1
ERROR: unable to create quota group: Inappropriate ioctl for device
#
# ./btrfs qgroup assign 1/5 2/5 /mnt/tmp1
ERROR: unable to assign quota group: Inappropriate ioctl for device
#
# ./btrfs qgroup show /mnt/tmp1
ERROR: can't perform the search - Inappropriate ioctl for device
ERROR: can't list qgroups: Inappropriate ioctl for device
#
# ./btrfs qgroup limit 1G 1/5 /mnt/tmp1
ERROR: unable to limit requested quota group: Inappropriate ioctl for device
After patch:
# ./btrfs qgroup create 1/5 /mnt/tmp1
ERROR: not a btrfs filesystem: /mnt/tmp1
# ./btrfs qgroup assign 1/5 2/5 /mnt/tmp1
ERROR: not a btrfs filesystem: /mnt/tmp1
# ./btrfs qgroup show /mnt/tmp1
ERROR: not a btrfs filesystem: /mnt/tmp1
# ./btrfs qgroup limit 1G 1/5 /mnt/tmp1
ERROR: not a btrfs filesystem: /mnt/tmp1
Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Zhao Lei [Mon, 12 Oct 2015 13:22:59 +0000 (21:22 +0800)]
btrfs-progs: inspect: use btrfs_open_dir for btrfs inspect command
We can use btrfs_open_dir() to check whether target dir is
in btrfs's mount point before open, instead of checking it in
kernel space of ioctl, and return fuzzy error message.
Before patch:
# ./btrfs inspect-internal rootid /mnt/tmp1
ERROR: Failed to lookup root id - Inappropriate ioctl for device
btrfs inspect-internal rootid: rootid failed with ret=-1
# ./btrfs inspect-internal inode-resolve 256 /mnt/tmp1
ioctl ret=-1, error: Inappropriate ioctl for device
# ./btrfs inspect-internal min-dev-size /mnt/tmp1
Error invoking tree search ioctl: Inappropriate ioctl for device
After patch:
# ./btrfs inspect-internal rootid /mnt/tmp1
ERROR: not a btrfs filesystem: /mnt/tmp1
# ./btrfs inspect-internal inode-resolve 256 /mnt/tmp1
ERROR: not a btrfs filesystem: /mnt/tmp1
# ./btrfs inspect-internal min-dev-size /mnt/tmp1
ERROR: not a btrfs filesystem: /mnt/tmp1
Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Zhao Lei [Mon, 12 Oct 2015 13:22:58 +0000 (21:22 +0800)]
btrfs-progs: inspect: set return value of error case
In case of open_file_or_dir() failed, ret is not set to right value,
and the function will return unwanted value(ret of sprintf).
Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Zhao Lei [Mon, 12 Oct 2015 13:22:57 +0000 (21:22 +0800)]
btrfs-progs: inspect: Bypass unnecessary clean function in open_error
No need to cleanup fd in open_fail case, because it is not opened.
Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Zhao Lei [Mon, 12 Oct 2015 13:22:56 +0000 (21:22 +0800)]
btrfs-progs: balance: use btrfs_open_dir for btrfs balance command
We can use btrfs_open_dir() to check whether target dir is
in btrfs's mount point before open, instead of checking it in
kernel space of ioctl, and return fuzzy error message.
Before patch:
# btrfs balance start /mnt/tmp
ERROR: error during balancing '/mnt/tmp' - Inappropriate ioctl for device
There may be more info in syslog - try dmesg | tail
#
After patch:
# btrfs balance start /mnt/tmp
ERROR: not btrfs filesystem: /mnt/tmp
#
Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Zhao Lei [Mon, 12 Oct 2015 13:22:55 +0000 (21:22 +0800)]
btrfs-progs: filesystem: use btrfs_open_dir for btrfs filesystem command
We can use btrfs_open_dir() to check whether target dir is
in btrfs's mount point before open, instead of checking it in
kernel space of ioctl, and return fuzzy error message.
Before patch:
# (/mnt/tmp is not btrfs mountpoint)
#
# btrfs filesystem df /mnt/tmp
ERROR: couldn't get space info - Inappropriate ioctl for device
ERROR: get_df failed Inappropriate ioctl for device
#
After patch:
# ./btrfs filesystem df /mnt/tmp
ERROR: not btrfs filesystem: /mnt/tmp
#
Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Zhao Lei [Mon, 12 Oct 2015 13:22:54 +0000 (21:22 +0800)]
btrfs-progs: subvolume: use btrfs_open_dir for btrfs subvolume command
We can use btrfs_open_dir() to check whether target dir is
in btrfs's mount point before open, instead of checking it in
kernel space of ioctl, and return fuzzy error message.
Before patch:
# (/mnt/tmp is not btrfs mountpoint)
#
# btrfs subvolume create /mnt/tmp/123
Create subvolume '/mnt/tmp/123'
ERROR: cannot create subvolume - Inappropriate ioctl for device
#
After patch:
# btrfs subvolume create /mnt/tmp/123
ERROR: not btrfs filesystem: /mnt/tmp
#
Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Lakshmipathi.G [Wed, 7 Oct 2015 12:06:38 +0000 (17:36 +0530)]
btrfs-progs: print root item's last_snapshot value
Include last_snapshot value in print_root(). With btrfs-debug-tree, it
helps to identify whether its a snapshot-ed subvolume or not.
Signed-off-by: Lakshmipathi.G <Lakshmipathi.G@giis.co.in>
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Wed, 7 Oct 2015 12:36:34 +0000 (14:36 +0200)]
btrfs-progs: docs: add html build target
We can easily build the documentation in html format:
$ make html
in the Documentation directory.
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Wed, 7 Oct 2015 10:52:52 +0000 (12:52 +0200)]
btrfs-progs: build: make support for static checkers more generic
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Tue, 6 Oct 2015 14:50:08 +0000 (16:50 +0200)]
btrfs-progs: check: update help text
Add some missing options and add a high-level description.
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Tue, 6 Oct 2015 12:53:55 +0000 (14:53 +0200)]
btrfs-progs: a bit of makefile documentation
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Tue, 6 Oct 2015 12:40:07 +0000 (14:40 +0200)]
btrfs-progs: build: allow to build with various compiler warnings
Copied from linux kernel, 'make W=1' will build with various additional
warnings turned on. There are 3 levels, combinations are possible. The
build is quite noisy, not all warnings need to be fixed.
A specific warning can be turned on by 'make EXTRA_CFLAGS=-Wsomething'.
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Tue, 6 Oct 2015 12:16:39 +0000 (14:16 +0200)]
btrfs-progs: tests: print commands on terminal if requested
Set the variable TEST_LOG=tty (in the enviroment or as parameter to
make) to print commands executed by 'run_check' helpers to terminal (ie.
/dev/tty). This might be useful to see the test progress beside watching
the results file.
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Tue, 6 Oct 2015 11:11:09 +0000 (13:11 +0200)]
btrfs-progs: misc tests: add 009-subvolume-sync-must-wait
Test to verify that subovolume sync waits until the subvolume is
cleaned.
Signed-off-by: David Sterba <dsterba@suse.com>
Silvio Fricke [Tue, 29 Sep 2015 17:10:36 +0000 (19:10 +0200)]
btrfs-progs: use calloc instead of malloc+memset
This patch is generated from a coccinelle semantic patch:
identifier t;
expression e;
statement s;
@@
-t = malloc(e);
+t = calloc(1, e);
(
if (!t) s
|
if (t == NULL) s
|
)
-memset(t, 0, e);
Signed-off-by: Silvio Fricke <silvio.fricke@gmail.com>
[squashed patches into one]
Signed-off-by: David Sterba <dsterba@suse.com>
Zhao Lei [Mon, 28 Sep 2015 13:58:14 +0000 (21:58 +0800)]
btrfs-progs: use common warning/error for cmds-scrub.c
Use common warning/error functions in cmds-scrub.c, it can make
message format unified and make code simple.
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
[removed ending newlines from messages]
Signed-off-by: David Sterba <dsterba@suse.com>
Zhao Lei [Mon, 28 Sep 2015 13:58:13 +0000 (21:58 +0800)]
btrfs-progs: Introduce warning and error for common use
Current code use fprintf(stderr, "...") to output warnning and
error information.
The error message have different style, as:
# grep fprintf *.c
fprintf(stderr, "Open ctree failed\n");
fprintf(stderr, "%s: open ctree failed\n", __func__);
fprintf(stderr, "ERROR: cannot open ctree\n");
...
And sometimes, we forgot add tailed '\n', or use printf instead,
as in current code:
printf("warning, device %llu is missing\n",
This patch introduce warning() and error() as common function,
to make:
1: Each warning and error information have same format
2: Easy to search/change all error message
3: Easy to modify function's internal for debug or other requirement,
for example:
print function/linenumber in error()
dumpstack in error()
add some trace for some style of message
add support for -v, -vv, ...
support for locales
custom output functions
support some special device/tty
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
[print newline after the message]
Signed-off-by: David Sterba <dsterba@suse.com>
Silvio Fricke [Thu, 24 Sep 2015 06:13:05 +0000 (08:13 +0200)]
btrfs-progs: check: add progress indicator
Signed-off-by: Silvio Fricke <silvio.fricke@gmail.com>
[minor updates]
Signed-off-by: David Sterba <dsterba@suse.com>
Qu Wenruo [Wed, 13 May 2015 09:15:35 +0000 (17:15 +0800)]
btrfs-progs: add more superblock validation checks
Now btrfs-progs will have much more strict superblock checks based on
kernel superblock checks.
This should prevent crashes or invalid memory access on crafted or
fuzzed images.
Based on kernel commit
c926093ec516f5d316ecdf8c1be11f577ac71b85 .
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
[added reference to kernel and comments]
Signed-off-by: David Sterba <dsterba@suse.com>
Qu Wenruo [Wed, 13 May 2015 09:15:34 +0000 (17:15 +0800)]
btrfs-progs: Read the whole superblock instead of struct btrfs_super_block
Before the patch, btrfs-progs will only read sizeof(struct
btrfs_super_block) and restore it into super_copy.
This makes checksum check for superblock impossible. Change it to read
the whole superblock.
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Zhao Lei [Thu, 6 Aug 2015 03:05:55 +0000 (11:05 +0800)]
btrfs-progs: enhance error message with status from kernel and errno
Scrub output prints the following error message in my test:
ERROR: scrubbing /var/ltf/tester/scratch_mnt failed for device id 5 (Success)
It is caused by a broken kernel and fs, but the we need to avoid
printing both "error and success" on one line as above.
This patch modified above message to:
ERROR: scrubbing /var/ltf/tester/scratch_mnt failed for device id 5: ret=1, errno=0 (Success)
Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
[minor updates in formatting]
Signed-off-by: David Sterba <dsterba@suse.com>
Zhao Lei [Thu, 6 Aug 2015 03:05:54 +0000 (11:05 +0800)]
btrfs-progs: use switch instead of a series of ifs for output error message
Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Zhao Lei [Tue, 28 Jul 2015 02:28:13 +0000 (10:28 +0800)]
btrfs-progs: tests: Avoid printing useless warning in fsck tests
002-bad-transid outout 'transid verify failed' message in screen
which is just a warning in btrfs-image in normal condition of this
test.
This patch move above warning into $RESULTS, to:
1: Avoid trouble screen output
2: Let user known detail if other error happened in btrfs-image
Before patch:
# ./fsck-tests.sh
[TEST] 001-bad-file-extent-bytenr
[TEST] 002-bad-transid
parent transid verify failed on
29360128 wanted 9 found
755944791
parent transid verify failed on
29360128 wanted 9 found
755944791
Ignoring transid failure
[TEST] 003-shift-offsets
[TEST] 004-no-dir-index
...
After patch:
# ./fsck-tests.sh
[TEST] 001-bad-file-extent-bytenr
[TEST] 002-bad-transid
[TEST] 003-shift-offsets
[TEST] 004-no-dir-index
...
Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Qu Wenruo [Thu, 10 Sep 2015 02:34:14 +0000 (10:34 +0800)]
btrfs-progs: fsck: Add check for extent and parent chunk type
There is a bug in btrfs-convert in 4.1.2, even we don't allow mixed
block group for converted image, btrfs-convert will still create image
with data and metadata inside one chunk.
And further more, the chunk type is still DATA or METADATA, not
DATA|METADATA (not mixed).
So add btrfsck check for it right now.
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Zhao Lei [Wed, 23 Sep 2015 07:19:06 +0000 (15:19 +0800)]
btrfs-progs: tests: Introduce misc-tests/008-leaf-crossing-stripes
To check is btrfs-convert create bad filesystem with
leaf across stripes.
It is happened in progs version <=v4.1.2, and fixed by patch titled:
btrfs: convert: Avoid allocating metadata extent crossing stripe boundary
which was merged in v4.2.
Notice thar this testcase can not report error in old version of
btrfs-progs, because "btrfs check" can't check this type of error
in those version, but we have another testcase in fsck-tests, to
check is "btrfs check" support this check.
So, the above 2 testcase together can check leaf-crossing-stripes
bug in all versions.
Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
[renamed and other minor changes]
Signed-off-by: David Sterba <dsterba@suse.com>
Zhao Lei [Wed, 23 Sep 2015 07:19:05 +0000 (15:19 +0800)]
btrfs-progs: tests: Introduce fsck-tests/018-leaf-crossing-stripes
To test if fsck can check detec "leaf crossing stripes".
This function was introduced from patch titled:
btrfs-progs: fsck: Check if a metadata tree block crossing stripe boundary
Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
[renamed and other minor changes]
Signed-off-by: David Sterba <dsterba@suse.com>
Zhao Lei [Wed, 23 Sep 2015 07:19:04 +0000 (15:19 +0800)]
btrfs-progs: tests: Move extract_image out of check_all_images for common use
Move code for extract image file to a function from check_all_images()
for common use, so caller can use this function to extrace single
image file.
Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
[minor reformatting and updates]
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Mon, 19 Oct 2015 09:29:01 +0000 (11:29 +0200)]
Btrfs progs v4.2.3
Signed-off-by: David Sterba <dsterba@suse.com>
Vincent Stehlé [Thu, 8 Oct 2015 08:47:09 +0000 (10:47 +0200)]
btrfs-progs: restore: fix off-by-one len check
Fix a check of len versus PATH_MAX in function copy_symlink(), to
account for the terminating null byte.
Resolves-Coverity-CID: 1296749
Signed-off-by: Vincent Stehlé <vincent.stehle@freescale.com>
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Tue, 6 Oct 2015 09:32:16 +0000 (11:32 +0200)]
btrfs-progs: subvol sync: fix reversed condition
In my local change to
07cc891d1d9819d5cf0628af555e7727d289cf7b
("btrfs-progs: Simplify all-subvolumn-clean condition for
wait_for_subvolume_cleaning") that reversed the meaning of the variable
dirty -> clean, I made a mistake and broke 'subvol sync' that will not
wait as expected and ends prematurely. Zhao Lei's original patch worked.
CC: Zhao Lei <zhaolei@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Qu Wenruo [Tue, 9 Jun 2015 07:57:40 +0000 (15:57 +0800)]
btrfs-progs: convert: Print different error message if convert partly failed.
When testing under libguestfs, btrfs-convert will never succeed to fix
chunk map, and always fails.
But in that case, it's already a mountable btrfs.
So better to info user with different error message for that case.
The root cause of it is still under investigation.
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Anand Jain [Tue, 15 Sep 2015 08:46:23 +0000 (16:46 +0800)]
btrfs-progs: optimize not to scan repeated fsid mount points
fsid can be mounted multiple times, with different subvolid.
And we don't have to scan a mount point if we already have
that in the scanned list.
And thus nicely avoids the following warning with multiple
subvol mounts on older kernel like 2.6.32 where
BTRFS_IOC_GET_FSLABEL ioctl does not exist.
./btrfs fi show -m
Label: none uuid:
31845933-611e-422d-ae6f-
386e57ad81aa
Total devices 2 FS bytes used 172.00KiB
devid 1 size 3.00GiB used 642.38MiB path /dev/sdd
devid 2 size 3.00GiB used 622.38MiB path /dev/sde
warning, device 2 is missing
warning devid 2 not found already
warning, device 2 is missing
warning devid 2 not found already
Signed-off-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Mon, 5 Oct 2015 10:58:03 +0000 (12:58 +0200)]
Btrfs progs v4.2.2
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Fri, 2 Oct 2015 15:44:21 +0000 (17:44 +0200)]
btrfs-progs: fix error checking in load_device_info
load_device_info queries the FS_INFO ioctl and this may fail with EPERM
on older kernels. The check did not verify the ioctl return value and
incorrectly returned EPERM if it was previously stored in errno.
This fixes 'btrfs fi usage' that will print the overall summary for all
users (provided that the FS_INFO ioctl is already unprivileged).
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Fri, 2 Oct 2015 15:21:12 +0000 (17:21 +0200)]
btrfs-progs: fix double free during scanning
If there are different devices mounted to the same directory we can run
into double free issue in the scanning code and this can lead to a
crash. The dev_info_arg buffer allocation get_fs_info might be skipped,
eg. if the FS_INFO ioctl fails due to EPERM in older kernels. Reset the
pointer before each loop starts.
Signed-off-by: David Sterba <dsterba@suse.com>
Silvio Fricke [Tue, 29 Sep 2015 17:10:46 +0000 (19:10 +0200)]
btrfs-progs: check: fix memset range
Signed-off-by: Silvio Fricke <silvio.fricke@gmail.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Silvio Fricke [Thu, 24 Sep 2015 06:13:04 +0000 (08:13 +0200)]
btrfs-progs: tasks info->id is a pthread_t and should not set to -1
Signed-off-by: Silvio Fricke <silvio.fricke@gmail.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Zhao Lei [Mon, 27 Jul 2015 11:32:37 +0000 (19:32 +0800)]
btrfs-progs: Show detail error message when write sb failed in write_dev_supers()
fsck-tests.sh failed and show following message in my node:
# ./fsck-tests.sh
[TEST] 001-bad-file-extent-bytenr
disk-io.c:1444: write_dev_supers: Assertion `ret != BTRFS_SUPER_INFO_SIZE` failed.
/root/btrfsprogs/btrfs-image(write_all_supers+0x2d2)[0x41031c]
/root/btrfsprogs/btrfs-image(write_ctree_super+0xc5)[0x41042e]
/root/btrfsprogs/btrfs-image(btrfs_commit_transaction+0x208)[0x410976]
/root/btrfsprogs/btrfs-image[0x438780]
/root/btrfsprogs/btrfs-image(main+0x3d5)[0x438c5c]
/lib64/libc.so.6(__libc_start_main+0xfd)[0x335e01ecdd]
/root/btrfsprogs/btrfs-image[0x4074e9]
failed to restore image /root/btrfsprogs/tests/fsck-tests/001-bad-file-extent-bytenr/default_case.img
#
# cat fsck-tests-results.txt
=== Entering /root/btrfsprogs/tests/fsck-tests/001-bad-file-extent-bytenr
restoring image default_case.img
failed to restore image /root/btrfsprogs/tests/fsck-tests/001-bad-file-extent-bytenr/default_case.img
#
Reason:
I run above test in a NFS mountpoint, it don't have enouth space to write
all superblock to image file, and don't support sparse file.
So write_dev_supers() failed in writing sb and output above message.
It takes me quite of time to know what happened, we can save these time
by output exact information in write-sb-fail case.
After patch:
# ./fsck-tests.sh
[TEST] 001-bad-file-extent-bytenr
WARNING: Write sb failed: File too large
disk-io.c:1492: write_all_supers: Assertion `ret` failed.
...
#
Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Zhao Lei [Tue, 28 Jul 2015 07:53:58 +0000 (15:53 +0800)]
btrfs-progs: Increase running state's priority in stat output
Anthony Plack <anthony@plack.net> reported a output bug in maillist:
title: btrfs-progs SCRUB reporting aborted but still running - minor
btrfs scrub status report it was aborted but still runs to completion.
# btrfs scrub status /mnt/data
scrub status for
f591ac13-1a69-476d-bd30-
346f87a491da
scrub started at Mon Apr 27 06:48:44 2015 and was aborted after 1089 seconds
total bytes scrubbed: 1.02TiB with 0 errors
#
# btrfs scrub status /mnt/data
scrub status for
f591ac13-1a69-476d-bd30-
346f87a491da
scrub started at Mon Apr 27 06:48:44 2015 and was aborted after 1664 seconds
total bytes scrubbed: 1.53TiB with 0 errors
#
...
Reason:
When scrub multi-device simultaneously, if some device canceled,
and some device is still running, cancel state have higher priority to
be outputed in global report.
So we can see "scrub aborted" in status line, with running-time keeps
increased.
Fix:
We can increase running state's priority in output, if there is
some device in scrub state, we output running state instead of
cancelled state.
Reported-by: Anthony Plack <anthony@plack.net>
Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Anand Jain [Fri, 28 Aug 2015 14:11:30 +0000 (22:11 +0800)]
btrfs-progs: fix is_block_device() return checks
it was highlighted to me is_block_device(), returns
1 if the file is a block device,
< 0 in case of an error (eg: file not found)
0 otherwise
This patch makes proper return checks at all the places
where is_block_device() is used. Thanks to Goffredo.
Signed-off-by: Anand Jain <anand.jain@oracle.com>
Suggested-by: Goffredo Baroncelli <kreijack@inwind.it>
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Fri, 25 Sep 2015 15:59:43 +0000 (17:59 +0200)]
btrfs-progs: make sure that is_block_device will return only 0/1
The macro return nonzero, we'll test against 0/1 (or < 0).
Signed-off-by: David Sterba <dsterba@suse.com>
Qu Wenruo [Fri, 25 Sep 2015 16:15:44 +0000 (18:15 +0200)]
btrfs-progs: utils: Check nodesize against features
Check nodesize against features, not only sectorsize.
In fact, one of the btrfs-convert and mkfs differs in the nodesize
check.
This patch also provides the basis for later btrfs-convert fix.
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Anand Jain [Tue, 15 Sep 2015 08:46:22 +0000 (16:46 +0800)]
btrfs-progs: provide fail safe for BTRFS_IOC_GET_FSLABEL ioctl
Old kernels before 3.9 do not provide ioctl BTRFS_IOC_GET_FSLABEL.
So we need to provide a fail safe logic for btrfs-progs running
on those kernel.
In this patch when get_label_mounted() fails on the old kernel
it will fail back to the old method and uses get_label_unmounted(),
where it will read from the disk directly.
Signed-off-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Sun, 20 Sep 2015 12:50:06 +0000 (14:50 +0200)]
Btrfs progs v4.2.1
Signed-off-by: David Sterba <dsterba@suse.com>
Zhao Lei [Tue, 15 Sep 2015 09:22:17 +0000 (17:22 +0800)]
btrfs-progs: tests: Add '-o loop' to mount command line in convert-tests.sh
To fix following bug:
# ./convert-tests.sh
[TEST] ext2 4k nodesize, btrfs defaults
failed: mount /root/btrfsprogs/tests/test.img /root/btrfsprogs/tests/mnt
# tail convert-tests-results.txt
...
############### mount /root/btrfsprogs/tests/test.img /root/btrfsprogs/tests/mnt
mount: /root/btrfsprogs/tests/test.img is not a block device (maybe try `-o loop'?)
failed: mount /root/btrfsprogs/tests/test.img /root/btrfsprogs/tests/mnt
Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Mon, 14 Sep 2015 22:40:00 +0000 (00:40 +0200)]
btrfs-progs: docs: add option variants, defaults and versions to mount options
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Mon, 14 Sep 2015 21:42:29 +0000 (23:42 +0200)]
btrfs-progs: cleanup, update function definitions to be ANSI conformant
Sparse reports:
warning: non-ANSI function declaration of function
and we're using func(void) elsewhere.
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Mon, 14 Sep 2015 21:39:28 +0000 (23:39 +0200)]
btrfs-progs: cleanup, mark more functions static
Reported by sparse.
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Mon, 14 Sep 2015 21:27:19 +0000 (23:27 +0200)]
btrfs-progs: cleanup, make usage strings static
Reported by sparse.
Signed-off-by: David Sterba <dsterba@suse.com>
Omar Sandoval [Mon, 14 Sep 2015 06:08:22 +0000 (23:08 -0700)]
btrfs-progs: use calloc instead of malloc+memset for tree roots
Signed-off-by: Omar Sandoval <osandov@fb.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Zhao Lei [Wed, 9 Sep 2015 13:32:23 +0000 (21:32 +0800)]
btrfs-progs: image: close all_devices at the end
Devices opened by check_mounted() in main() should closed before
the exit of btrfs-image.
Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Zhao Lei [Wed, 9 Sep 2015 13:32:22 +0000 (21:32 +0800)]
btrfs-progs: image: don't create unused threads
In case of creating an image without compression, we don't need to
create unused threads.
Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>