David Sterba [Mon, 31 Oct 2016 10:32:12 +0000 (11:32 +0100)]
btrfs-progs: list: switch to common message helpers
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Mon, 31 Oct 2016 10:17:02 +0000 (11:17 +0100)]
btrfs-progs: list: rename some helpers
Using _volume_ is confusing, it's for subvolumes.
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Mon, 31 Oct 2016 10:11:50 +0000 (11:11 +0100)]
btrfs-progs: use enum for list layout type
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Mon, 31 Oct 2016 10:08:06 +0000 (11:08 +0100)]
btrfs-progs: list: constify prefix arugment
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Mon, 31 Oct 2016 09:59:08 +0000 (10:59 +0100)]
btrfs-progs: use symbolic tree name when searching
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Mon, 31 Oct 2016 09:52:26 +0000 (10:52 +0100)]
btrfs-progs: remove leading underscores from several helper
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Mon, 31 Oct 2016 09:51:52 +0000 (10:51 +0100)]
btrfs-progs: opencode trivial helper __free_all_subvolumn
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Mon, 31 Oct 2016 09:38:31 +0000 (10:38 +0100)]
btrfs-progs: use existing rootid resolving helper in btrfs_list_get_path_rootid
The utils helper is not verbose in case of an error, for now the helper
used for subvolume listing will print the error message but not
duplicate the ioctl anymore.
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Mon, 31 Oct 2016 09:34:37 +0000 (10:34 +0100)]
btrfs-progs: rename lookup_ino_rootid
It does not resolve the inode number but path where fd has been opened.
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Mon, 31 Oct 2016 09:29:12 +0000 (10:29 +0100)]
btrfs-progs: remove unused function btrfs_get_path_rootid
Last user replaced with a more appropriate helper.
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Mon, 31 Oct 2016 09:27:25 +0000 (10:27 +0100)]
btrfs-progs: qgroups show: handle errors when resolving root id
If btrfs_get_path_rootid fails, prints an error message but continues.
Replace with a helper that returns an error.
Signed-off-by: David Sterba <dsterba@suse.com>
Qu Wenruo [Tue, 1 Nov 2016 08:01:46 +0000 (16:01 +0800)]
btrfs-progs: remove send-test tool
Since new "receive --dump" has better output and structure, it's time
to remove old and function-weak send-test tool.
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Roman Lebedev [Mon, 31 Oct 2016 09:08:46 +0000 (10:08 +0100)]
btrfs-progs: Add travis CI build support
Automated build checks for the devel branch and integration to coverity,
using travis.org. Roman's initial .yml version has been adjusted for
btrfs-progs needs.
Author: Roman Lebedev <lebedev.ri@gmail.com>
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Fri, 28 Oct 2016 16:34:03 +0000 (18:34 +0200)]
btrfs-progs: convert: switch more messages to common helpers
Signed-off-by: David Sterba <dsterba@suse.com>
Tsutomu Itoh [Wed, 19 Oct 2016 02:35:03 +0000 (11:35 +0900)]
btrfs-progs: send: fix handling of multiple snapshots (-p option)
We cannot send multiple snapshots at once by -p option.
[before]
# btrfs send -f /tmp/data0 -p Snap0 Snap[12]
At subvol Snap1
At subvol Snap2
ERROR: parent determination failed for 0
#
[after]
# btrfs send -f /tmp/data0 -p Snap0 Snap[12]
At subvol Snap1
At subvol Snap2
#
Signed-off-by: Tsutomu Itoh <t-itoh@jp.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Qu Wenruo [Thu, 27 Oct 2016 02:32:48 +0000 (10:32 +0800)]
btrfs-progs: Ignore clang complete file
While most guys are using ctags and cscope with vim, new completion tool
like vim-clang_completion is gaining its popularity, due to its compiler
level accuracy simpleness to use.
Since ctags and cscope are already in .gitignore, I see no reason to
reject .clang_complete.
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Wed, 26 Oct 2016 14:41:32 +0000 (16:41 +0200)]
btrfs-progs: tests: switch to dump- commands from inspect
The dump-super and debug-tree commands are replacements for the
standalone tools.
Signed-off-by: David Sterba <dsterba@suse.com>
Qu Wenruo [Thu, 13 Oct 2016 09:22:27 +0000 (17:22 +0800)]
btrfs-progs: fsck-tests: Check if clear space cache works
Add test case to check the basic function of --clear-space-cache.
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Qu Wenruo [Thu, 13 Oct 2016 09:22:26 +0000 (17:22 +0800)]
btrfs-progs: check: add support to clear v1 free space cache
Kernel clear_cache mount option will only rebuild free space cache if
the used space of that chunk has changed.
So it won't ensure any corrupted free space cache get cleared.
So add a new option "--clear-space-cache v1|v2" to btrfsck, to
completely wipe out free space cache.
So kernel won't complain again.
Reported-by: Ivan P <chrnosphered@gmail.com>
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
[ adjusted error messages, doc wording changes ]
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Wed, 26 Oct 2016 17:43:34 +0000 (19:43 +0200)]
Btrfs progs v4.8.2
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Mon, 24 Oct 2016 13:40:37 +0000 (15:40 +0200)]
btrfs-progs: update CHANGES for v4.8.2
Signed-off-by: David Sterba <dsterba@suse.com>
Goldwyn Rodrigues [Mon, 24 Oct 2016 15:18:14 +0000 (10:18 -0500)]
btrfs-progs: check: release path after usage
While performing an fsck, an assertion failure occurs because of reusing path in a loop.
ctree.c:1112: btrfs_search_slot: Warning: assertion `p->nodes[0] != NULL` failed, value 0
Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Qu Wenruo [Mon, 24 Oct 2016 07:22:33 +0000 (15:22 +0800)]
btrfs-progs: Fix wrong tree block alignment for unalianged block group
Commit
854437ca(btrfs-progs: extent-tree: avoid allocating tree block
that crosses stripe boundary) introduces check for logical bytenr not
crossing stripe boundary.
However that check is not completely correct.
It only checks if the logical bytenr and length agaist absolute logical
offset.
That's to say, it only check if a tree block lies in 64K logical stripe.
But in fact, it's possible a block group starts at bytenr unaligned with
64K, just like the following case.
Then btrfsck will give false alert.
0 32K 64K 96K 128K 160K ...
|--------------- Block group A ---------------------
|<-----TB 32K------>|
|/Scrub stripe unit/|
| WRONG UNIT |
In that case, TB(tree block) at bytenr 32K in fact fits into the kernel
scrub stripe unit.
But doesn't fit into the pure logical 64K stripe.
Fix check_crossing_stripes() to compare bytenr to block group start, not
to absolute logical bytenr.
Reported-by: Jussi Kansanen <jussi.kansanen@gmail.com>
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Mon, 24 Oct 2016 12:46:26 +0000 (14:46 +0200)]
btrfs-progs: ioctl: fix build failure if BUILD_ASSERT is not defined
The build fails if ioctl.h is included without kerncompat.h which
defines BUILD_ASSERT, as reported. The proposed patches add kerncompat.h
but I don't want to pull that header via ioctl.h, so the fix will
provide an empty macro instead.
Reported-by: Eric Sandeen <sandeen@redhat.com>
Reported-by: Sergei Trofimovich <slyfox@gentoo.org>
Reported-by: Mikhail Pukhlikov <cynede@gentoo.org>
Signed-off-by: David Sterba <dsterba@suse.com>
Lu Fengqi [Fri, 15 Jul 2016 03:00:28 +0000 (11:00 +0800)]
btrfs-progs: move btrfs_extref_hash() to hash.h
Move btrfs_extref_hash() from inode-item.c to hash.h,
so that the function can be called elsewhere.
Signed-off-by: Lu Fengqi <lufq.fnst@cn.fujitsu.com>
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Tsutomu Itoh [Wed, 19 Oct 2016 03:45:57 +0000 (12:45 +0900)]
btrfs-progs: send: remove unnecessary code
Some unnecessary codes are deleted.
- the setting of subvol is duplicated
- read only check was already done by the previous loop
Signed-off-by: Tsutomu Itoh <t-itoh@jp.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Wed, 19 Oct 2016 10:38:10 +0000 (12:38 +0200)]
btrfs-progs: dump-tree: fix crash on unrecognized tree id
Signed-off-by: David Sterba <dsterba@suse.com>
Karel Zak [Tue, 11 Nov 2014 11:35:58 +0000 (12:35 +0100)]
btrfs-progs: rename btrfs_scan_lblkid() to btrfs_scan_devices()
It seems like bad idea to use a library name (lblkid) within generic
function name. The currently used scanning library is implementation
detail and this detail should be hidden for rest of the code.
Signed-off-by: Karel Zak <kzak@redhat.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
David Sterba [Fri, 14 Oct 2016 16:39:40 +0000 (18:39 +0200)]
btrfs-progs: build: detect fiemap shared flag but don't fail build
The FIEMAP_EXTENT_SHARED fiemap flag was introduced in 2.6.33. If the
headers do not provide the definition, the build will fail. The support
of the fiemap sharing depends on the running kernel. There are still
systems with 2.6.32 kernel headers but running newer versions.
To support such environment, don't fail build, provide own defintion of
the structure and detect if there's an old kernel in use in the relevant
command (btrfs fi du).
Reported-by: Abhay Sachan <lkp.abhay@gmail.com>
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Tue, 9 Feb 2016 23:23:29 +0000 (00:23 +0100)]
btrfs-progs: mkfs: detect version of running kernel
Use the uname syscall and parse the string.
Signed-off-by: David Sterba <dsterba@suse.com>
Qu Wenruo [Tue, 25 Oct 2016 02:11:04 +0000 (10:11 +0800)]
btrfs-progs: volumes: Remove BUG_ON in raid56 write routine
Remove various BUG_ON in raid56 write routine, including:
1) Memory allocation error
Old codes allocates memory when code needs new memory in a loop, and
catch the error using BUG_ON().
New codes allocates memory in a allocation loop first, if any failure
is caught, freeing already allocated memories then throw -ENOMEM.
2) Write error
Change BUG_ON() to correct return value.
3) Validation check
Same as write error.
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Qu Wenruo [Fri, 30 Sep 2016 05:04:54 +0000 (13:04 +0800)]
btrfs-progs: rename raid6.c to raid56.c
This allows us to put raid5 codes into that file other than creating a
new raid5.c.
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Qu Wenruo [Fri, 7 Oct 2016 07:23:00 +0000 (15:23 +0800)]
btrfs-progs: test: Add image for quota verify stack overflow
For image with tree reloc tree, if its height is over level 2, the root
node's backref will point to itself. It's valid for kernel, but quota
verify code can't handle it and cause a infinite call, overflowing the
stack.
Add minimal image to reproduce the bug, as regression test.
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
[ minor cleanups in test.sh ]
Signed-off-by: David Sterba <dsterba@suse.com>
Qu Wenruo [Fri, 7 Oct 2016 07:22:59 +0000 (15:22 +0800)]
btrfs-progs: test: Add test image for btrfsck qgroup rescan detection
Fixed by commit
7c646c538e74 btrfs-progs: qgroup: Fix regression leads
to corrupted qgroup status.
Add minimal test image for that fix.
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
[ minor cleanups in test.sh ]
Signed-off-by: David Sterba <dsterba@suse.com>
Qu Wenruo [Thu, 6 Oct 2016 09:13:32 +0000 (17:13 +0800)]
btrfs-progs: Fix stack overflow for checking qgroup on tree reloc tree
For tree reloc tree whose level is >= 2, the root node's parent will
point to itself.
In this case it will make btrfsck overflow its stack and cause segfault.
While for tree reloc tree, it doesn't affect qgroup and kernel can
handle it well.
So add tree reloc tree check for qgroup-verify.c and fix the bug.
Test case will follow soon after I make a minimal image for it.
Current xz ziped image is still over 10M for a 512M fs.
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Tsutomu Itoh [Wed, 5 Oct 2016 08:07:48 +0000 (17:07 +0900)]
btrfs-progs: image: fix compiler warning
In v4.8-rc1, gcc 5.3.1 gives following warning. Fixed it.
[CC] btrfs-image.o
btrfs-image.c: In function 'flush_pending':
btrfs-image.c:708:17: warning: 'start' may be used uninitialized in this function [-Wmaybe-uninitialized]
header->bytenr = cpu_to_le64(start);
^
btrfs-image.c:927:6: note: 'start' was declared here
u64 start;
^
Signed-off-by: Tsutomu Itoh <t-itoh@jp.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Qu Wenruo [Mon, 10 Oct 2016 03:00:13 +0000 (11:00 +0800)]
btrfs-progs: convert-test: Add test case for common inode flags
Add a new test case to check if btrfs-convert copies common inode flags
like append(a), immutable(i).
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
[ minor fixes ]
Signed-off-by: David Sterba <dsterba@suse.com>
Qu Wenruo [Mon, 10 Oct 2016 02:30:34 +0000 (10:30 +0800)]
btrfs-progs: convert: Convert ext inode flags to btrfs inode flags
Before this patch, btrfs-convert never copy ext* inode flags to
corresponding btrfs inode flags.
This makes common flags like APPEND/SYNC/SYNCDIR/IMMUTABLE not copied to
btrfs inode.
This patch introduces ext2_convert_inode_flags() function to handle the
convert, so btrfs-convert can copy as many inode flags as possible.
Reported-by: Lakshmipathi.G <lakshmipathi.g@gmail.com>
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Qu Wenruo [Mon, 10 Oct 2016 02:12:22 +0000 (10:12 +0800)]
btrfs-progs: Make btrfs-debug-tree print all readable strings for inode flags
Before this patch, only 3 inode flags have readable string: NODATACOW,
NODATASUM, READONLY.
This patch will output all readable strings for remaining inode flags,
making debug-tree tool more handy.
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
[ minor adjustments ]
Signed-off-by: David Sterba <dsterba@suse.com>
Qu Wenruo [Mon, 10 Oct 2016 01:47:39 +0000 (09:47 +0800)]
btrfs-progs: Copy btrfs inode flags from kernel header
Btrfs-progs header lacks quite a lot inode flags.
Copy them from kernel for later use.
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Lakshmipathi.G [Sun, 9 Oct 2016 15:08:12 +0000 (17:08 +0200)]
btrfs-progs: Add fast,slow symlinks, fifo types to convert test
Signed-off-by: Lakshmipathi.G <Lakshmipathi.G@giis.co.in>
[ fix root helper use in fast_symlink ]
Signed-off-by: David Sterba <dsterba@suse.com>
Lakshmipathi.G [Mon, 10 Oct 2016 12:04:55 +0000 (14:04 +0200)]
btrfs-progs: btrfs-debugfs: cleanup unused variables reported by pylint
Signed-off-by: Lakshmipathi.G <Lakshmipathi.G@giis.co.in>
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Fri, 7 Oct 2016 09:55:50 +0000 (11:55 +0200)]
btrfs-progs: test: add default ioctl-test build
Add another target that'll use default compiler options, eg. if we don't
know the bitness of the architecture or gcc does not recognize the
-m32/-m64 options.
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Thu, 6 Oct 2016 11:40:24 +0000 (13:40 +0200)]
btrfs-progs: tests: make the ioctl-test actually useful
Enhance the test to verify ioctl uniqueness, compare the defined values
against the hardcoded expected values, and take care of the 32bit/64bit
compatibility workarounds.
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Thu, 6 Oct 2016 11:11:17 +0000 (13:11 +0200)]
btrfs-progs: ioctl: add 64bit compat for SEND
The ioctl value of SEND will be different on 32bit userspace and 64bit
kernel due to different pointer type width, that unfortunatelly made it
into the structure definition.
To maintain backward compatibility, we must do it in the 64bit->32bit
way, because we don't have the kernel side workardound like
SET_RECEIVED_SUBVOL has. Changing value of SEND would then break
existing users of the raw ioctl.
The compatibility structure and ioctl should not be used, exists for
documentation, and testing.
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Thu, 6 Oct 2016 11:06:18 +0000 (13:06 +0200)]
btrfs-progs: ioctl: add 32bit compat for SET_RECEIVED_SUBVOL
The ioctl value of SET_RECEIVED_SUBVOL will be different on 32bit
userspace and 64bit kernel. This is transparently handled on the kernel
side. We now define the same structure so we can verify the ioctl value.
The defined structure and ioctl should not be used. It is exists only
for testing purposes, documenting the mess and as a warning for the
future.
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Wed, 12 Oct 2016 13:20:29 +0000 (15:20 +0200)]
Btrfs progs v4.8.1
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Fri, 7 Oct 2016 12:23:35 +0000 (14:23 +0200)]
btrfs-progs: update CHANGES for v4.8.1
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Mon, 10 Oct 2016 07:59:18 +0000 (09:59 +0200)]
btrfs-progs: ioctl: make build-time structure size checks optional
Temporarily make the build checks optional. The structure sizes could
change on arches due to alignment requirements or padding inserted into
the structures. We need more extensive tests to make sure we'd not break
ioctls.
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Thu, 6 Oct 2016 16:04:51 +0000 (18:04 +0200)]
btrfs-progs: fix printf format of sizeof on 32bit build
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Thu, 6 Oct 2016 15:35:33 +0000 (17:35 +0200)]
btrfs-progs: tests: add script to help build coverage
Signed-off-by: David Sterba <dsterba@suse.com>
Qu Wenruo [Thu, 6 Oct 2016 08:47:19 +0000 (16:47 +0800)]
btrfs-progs: Fix warning_trace compile error if backtrace is disabled
If we disable backtrace, btrfs-progs can't be compiled since we don't
have warning_trace defined.
Fix by move it out of #ifndef BTRFS_DISABLE_BACKTRACE block.
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
[ move warning_trace to the right place ]
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Thu, 6 Oct 2016 10:56:02 +0000 (12:56 +0200)]
btrfs-progs: build: add explicit option separator to rm commands
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Wed, 5 Oct 2016 10:47:51 +0000 (12:47 +0200)]
Btrfs progs v4.8
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Thu, 28 Jul 2016 12:18:59 +0000 (14:18 +0200)]
btrfs-progs: update CHANGES for v4.8
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Tue, 4 Oct 2016 22:01:31 +0000 (00:01 +0200)]
btrfs-progs: add build-time checks for size of ioctl structures
All structures that become part of ioctl definition must never change
size. Add the build time checks for that.
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Tue, 4 Oct 2016 21:00:20 +0000 (23:00 +0200)]
btrfs-progs: mkfs: fix warning for printf format on 32bit
Compiler complains about nlink_t and %ld format on 32bit build. Add
typecast and fix the format.
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Tue, 4 Oct 2016 20:14:12 +0000 (22:14 +0200)]
btrfs-progs: kerncompat: add build-time assertion support
Macro to verify compile-time conditions, like sie of structures or
types.
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Tue, 4 Oct 2016 17:09:23 +0000 (19:09 +0200)]
btrfs-progs: build: add alias for check tests
$ make test-check"
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Tue, 4 Oct 2016 17:02:37 +0000 (19:02 +0200)]
btrfs-progs: kerncompat: call abort at the end of assert_trace
The assert* helpers should not exit normally, mimick the behaviour of
the std library assert.
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Tue, 4 Oct 2016 16:55:09 +0000 (18:55 +0200)]
btrfs-progs: kerncompat: make WARN_ON more verbose
Curretnly WARN_ON would crash but that's not it's purpose. Add helper
that prints the warning, optionally with trace.
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Tue, 4 Oct 2016 16:53:38 +0000 (18:53 +0200)]
btrfs-progs: tests: teach run_mayfail about sigabrt
Mayfail helper should stop when we encoutner an abort.
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Tue, 4 Oct 2016 16:12:30 +0000 (18:12 +0200)]
btrfs-progs: dump-super: print chunks after validation
The fuzz test 005-simple-dump-super hits a crash, because we print the
chunks too early.
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Tue, 4 Oct 2016 14:24:00 +0000 (16:24 +0200)]
btrfs-progs: convert: add new callback to check state
Make the hardcoded ext2 call to a generic per-fs callback.
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Tue, 4 Oct 2016 13:34:16 +0000 (15:34 +0200)]
btrfs-progs: rename __setup_root and change to return void
Exported function should use a prefix.
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Mon, 3 Oct 2016 15:55:49 +0000 (17:55 +0200)]
btrfs-progs: tests: don't treat segfault as ignorable error
Some fuzzed images cause various tools to crash but the mayfail helper
would not recognize that. We don't mind if the utility failes but it
must not crash.
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Mon, 3 Oct 2016 15:54:05 +0000 (17:54 +0200)]
btrfs-progs: tests: split test 004 to separate tests
Makes testing specific tool easier.
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Mon, 3 Oct 2016 14:48:53 +0000 (16:48 +0200)]
btrfs-progs: don't access freed memory in btrfs_close_devices
Caught by ASAN, as we don't access fs_devices directly, there's no null
deref but 0x30 is still wrong.
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Mon, 3 Oct 2016 13:49:45 +0000 (15:49 +0200)]
btrfs-progs: chunk-recover: handle duplicate cache entries
Triggered by fuzzed image bko-155621-bad-block-group-offset.raw .
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Mon, 3 Oct 2016 13:41:25 +0000 (15:41 +0200)]
btrfs-progs: print value when assertion fails
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Mon, 3 Oct 2016 13:13:50 +0000 (15:13 +0200)]
btrfs-progs: image: drop useless bug_on
The callers touch 'target', no point checking it inside restore_metadump
again.
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Mon, 3 Oct 2016 13:11:13 +0000 (15:11 +0200)]
btrfs-progs: image: return negativer error from all paths in mdrestore_init
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Mon, 3 Oct 2016 12:52:30 +0000 (14:52 +0200)]
btrfs-progs: image: catch zero length extents, avoid endless loop
If an extent is found to have length 0, we'd loop endlessly in
copy_from_extent_tree. Reproduced by fuzzed image
bko-166361-blocksize-zero.raw within test 002-simple-image .
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Fri, 30 Sep 2016 16:59:44 +0000 (18:59 +0200)]
btrfs-progs: tests: add fuzzed image with bad parent refs, qgroup-verify
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Fri, 30 Sep 2016 16:51:46 +0000 (18:51 +0200)]
btrfs-progs: check: better error handling in find_parent_roots
Fix use-before-sanity-check leading to undefined behaviour and handle
errors more gracefully.
Reported-by: Lukas Lueg <lukas.lueg@gmail.com>
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=156811
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Fri, 30 Sep 2016 14:23:05 +0000 (16:23 +0200)]
btrfs-progs: tests: add fuzzed images with bad blocksize/lengh of eb
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Fri, 30 Sep 2016 14:19:20 +0000 (16:19 +0200)]
btrfs-progs: more sanity checks in read_tree_block_fs_info
If blocksize is 0, it passes the IS_ALIGNED check but fails later as the
length of ebs will be zero.
Reported-by: Lukas Lueg <lukas.lueg@gmail.com>
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=169311
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Fri, 30 Sep 2016 11:00:24 +0000 (13:00 +0200)]
btrfs-progs: btrfstune: use common message helpers
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Fri, 30 Sep 2016 11:00:24 +0000 (13:00 +0200)]
btrfs-progs: image: use common message helpers
Usage errors are turned to normal errors.
Signed-off-by: David Sterba <dsterba@suse.com>
Qu Wenruo [Wed, 28 Sep 2016 08:30:04 +0000 (16:30 +0800)]
btrfs-progs: Remove unnecessary parameter to clear_extent_uptodate
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Qu Wenruo [Wed, 7 Sep 2016 02:54:19 +0000 (10:54 +0800)]
btrfs-progs: qgroup: Fix regression leads to corrupted qgroup status
Commit
93dabf211d74daf6e3de642bdd887a90a00f7b49
Author: Mark Fasheh <mfasheh@suse.de>
Date: Fri Jun 17 13:37:48 2016 -0700
btrfs-progs: check: verify qgroups above level 0
This commit introduced a new regression which corrupts
read_qgroup_status, since it iterate leaf with manually specified slot,
not correct path->slot[0].
This leads to wrong slot[0] and read_qgroup_status() will read out wrong
flags, leading to regression.
Fix read_qgroup_status() by using eb and slot instread of wrong path
strucutre.
Reported-by: Tsutomu Itoh <t-itoh@jp.fujitsu.com>
Cc: Mark Fasheh <mfasheh@suse.de>
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Thu, 29 Sep 2016 13:12:35 +0000 (15:12 +0200)]
btrfs-progs: constify string arguments where appropriate
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Thu, 29 Sep 2016 15:25:46 +0000 (17:25 +0200)]
btrfs-progs: don't write to optarg in btrfs_qgroup_parse_sort_string
Dup the string that gets passed to strtok so we don't destroy callers
buffer.
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Thu, 29 Sep 2016 15:04:59 +0000 (17:04 +0200)]
btrfs-progs: remove stray function declaration
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Tue, 27 Sep 2016 12:48:39 +0000 (14:48 +0200)]
btrfs-progs: restore: update help text
Make it clear that --xattr restores the xattrs. Fix some whitespace
damage and add an enum for the long-only option.
Signed-off-by: David Sterba <dsterba@suse.com>
Qu Wenruo [Tue, 20 Sep 2016 02:19:02 +0000 (10:19 +0800)]
btrfs-progs: super-recover: Reuse btrfs_read_dev_super function
We have enhanced super block validation check in disk_io.c, while
super-recover doesn't use that function and use a custom one.
That is duplicated, so reuse btrfs_read_dev_super to handle it, which
not only enhanced super check, but also reduce the code length.
Reported-by: hawken <hawken@thehawken.org>
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Qu Wenruo [Mon, 26 Sep 2016 04:54:26 +0000 (12:54 +0800)]
btrfs-progs: Return more meaningful value for btrfs_read_deve_super
btrfs_read_dev_super() only returns 0 or -1, which doesn't really help,
caller won't know if it's caused by bad superblock or superblock out of
range.
Return -errno if pread64() return -1, and return -EOF if none or part of
the super is read out, and return what check_super() returned.
So caller can get -EIO to catch real corrupted super blocks.
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Nicholas D Steeves [Sun, 25 Sep 2016 01:26:41 +0000 (21:26 -0400)]
btrfs-progs: fix user-facing typos in docs and help strings
Signed-off-by: Nicholas D Steeves <nsteeves@gmail.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Adam Borowski [Fri, 23 Sep 2016 21:51:57 +0000 (23:51 +0200)]
btrfs-progs: docs: document exit codes from scrub
Signed-off-by: Adam Borowski <kilobyte@angband.pl>
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Fri, 23 Sep 2016 14:09:33 +0000 (16:09 +0200)]
btrfs-progs: move 3rd party kernel library modules to own directory
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Fri, 23 Sep 2016 14:06:57 +0000 (16:06 +0200)]
btrfs-progs: build: add basic support for subdirectory build
Add explicit target file names and set the top source directory.
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Fri, 23 Sep 2016 13:51:28 +0000 (15:51 +0200)]
btrfs-progs: tests: add script to scan results for some known runtime errors
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Fri, 23 Sep 2016 13:38:04 +0000 (15:38 +0200)]
btrfs-progs: tests: iterate over fuzzed images and test various tools
Signed-off-by: David Sterba <dsterba@suse.com>
Domagoj Tršan [Sat, 17 Sep 2016 23:10:23 +0000 (00:10 +0100)]
btrfs-progs: change btrfs_csum_final result param type to u8
Signed-off-by: Domagoj Tršan <domagoj.trsan@gmail.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Lakshmipathi.G [Thu, 15 Sep 2016 12:08:52 +0000 (14:08 +0200)]
btrfs-progs: convert: check source file system state
Signed-off-by: Lakshmipathi.G <Lakshmipathi.G@giis.co.in>
[ add doc note ]
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Tue, 13 Sep 2016 10:27:45 +0000 (12:27 +0200)]
btrfs-progs: mkfs: remove useless helper
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Tue, 13 Sep 2016 10:13:44 +0000 (12:13 +0200)]
btrfs-progs: use PATH_MAX in cmd_inspect_logical_resolve
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Tue, 13 Sep 2016 10:03:04 +0000 (12:03 +0200)]
btrfs-progs: remove unused variable in add_inode_items
It hasn't been used since the first commit.
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Tue, 13 Sep 2016 10:00:17 +0000 (12:00 +0200)]
btrfs-progs: cleanup, kill trivial btrfs_key_type helper
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba [Tue, 13 Sep 2016 09:58:21 +0000 (11:58 +0200)]
btrfs-progs: cleanup, kill trivial btrfs_set_key_type helper
Signed-off-by: David Sterba <dsterba@suse.com>