Commit Graph

3057 Commits (e58cc23823f5f253e0ca09c8458b3708994c344a)
 

Author SHA1 Message Date
David Sterba 3fe243296d 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>
2016-11-09 13:47:28 +01:00
David Sterba f2744dbc93 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>
2016-11-09 13:47:28 +01:00
Qu Wenruo 4dc315e68a 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>
2016-11-09 13:47:28 +01:00
Roman Lebedev 324566bd1a 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>
2016-11-09 13:47:26 +01:00
David Sterba 365c2de3bc btrfs-progs: convert: switch more messages to common helpers
Signed-off-by: David Sterba <dsterba@suse.com>
2016-11-09 13:13:52 +01:00
Tsutomu Itoh 6d4fb3dcc1 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>
2016-11-09 13:13:47 +01:00
Qu Wenruo cf5a680b82 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>
2016-11-09 13:13:41 +01:00
David Sterba c8d1c4c792 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>
2016-11-09 13:13:37 +01:00
Qu Wenruo 40de2f6279 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>
2016-11-09 13:12:49 +01:00
Qu Wenruo eb8a61b235 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>
2016-11-09 13:12:47 +01:00
David Sterba 08d31c1c7c
Btrfs progs v4.8.2
Signed-off-by: David Sterba <dsterba@suse.com>
2016-10-26 19:43:34 +02:00
David Sterba 2690dc5640 btrfs-progs: update CHANGES for v4.8.2
Signed-off-by: David Sterba <dsterba@suse.com>
2016-10-25 14:31:44 +02:00
Goldwyn Rodrigues a7ec18a864 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>
2016-10-25 14:31:06 +02:00
Qu Wenruo ffb1b847bd 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>
2016-10-25 14:31:06 +02:00
David Sterba b2fbfc8cdd 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>
2016-10-25 14:28:36 +02:00
Lu Fengqi 36d02f3eb8 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>
2016-10-25 14:28:36 +02:00
Tsutomu Itoh 876db7f50c 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>
2016-10-25 14:28:36 +02:00
David Sterba a0fabf5f1d btrfs-progs: dump-tree: fix crash on unrecognized tree id
Signed-off-by: David Sterba <dsterba@suse.com>
2016-10-25 14:28:36 +02:00
Karel Zak dcc3df7e6d 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>
2016-10-25 14:28:36 +02:00
David Sterba cf8fd1a708 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>
2016-10-25 14:28:36 +02:00
David Sterba 508000138c btrfs-progs: mkfs: detect version of running kernel
Use the uname syscall and parse the string.

Signed-off-by: David Sterba <dsterba@suse.com>
2016-10-25 14:28:36 +02:00
Qu Wenruo 4d958295d2 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>
2016-10-25 14:28:25 +02:00
Qu Wenruo fd48a96b9a 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>
2016-10-24 15:03:20 +02:00
Qu Wenruo 112514568f 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>
2016-10-24 15:03:12 +02:00
Qu Wenruo 9119319ef9 btrfs-progs: test: Add test image for btrfsck qgroup rescan detection
Fixed by commit 7c646c538e 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>
2016-10-24 15:03:04 +02:00
Qu Wenruo d94816cbde 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>
2016-10-24 15:02:45 +02:00
Tsutomu Itoh c9ec835ae1 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>
2016-10-24 14:58:19 +02:00
Qu Wenruo 8c663f9f36 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>
2016-10-24 14:58:15 +02:00
Qu Wenruo 8570a0c3a4 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>
2016-10-24 14:58:07 +02:00
Qu Wenruo 5bd4016363 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>
2016-10-24 14:58:02 +02:00
Qu Wenruo e93f3e7ded 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>
2016-10-24 14:57:55 +02:00
Lakshmipathi.G 0ec02b118d 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>
2016-10-24 14:57:51 +02:00
Lakshmipathi.G 1df01f8427 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>
2016-10-24 14:57:46 +02:00
David Sterba e0c979343d 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>
2016-10-24 14:57:32 +02:00
David Sterba 6f306e8d62 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>
2016-10-24 14:57:19 +02:00
David Sterba 32a168684e 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>
2016-10-24 14:57:02 +02:00
David Sterba bbda9a2892 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>
2016-10-24 14:56:40 +02:00
David Sterba d8d0a60406
Btrfs progs v4.8.1
Signed-off-by: David Sterba <dsterba@suse.com>
2016-10-12 15:20:29 +02:00
David Sterba 483d0a55cb btrfs-progs: update CHANGES for v4.8.1
Signed-off-by: David Sterba <dsterba@suse.com>
2016-10-12 15:19:50 +02:00
David Sterba 5aade6f9c3 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>
2016-10-10 10:11:31 +02:00
David Sterba 805ac27248 btrfs-progs: fix printf format of sizeof on 32bit build
Signed-off-by: David Sterba <dsterba@suse.com>
2016-10-10 09:46:54 +02:00
David Sterba ba253d4ea5 btrfs-progs: tests: add script to help build coverage
Signed-off-by: David Sterba <dsterba@suse.com>
2016-10-10 09:46:51 +02:00
Qu Wenruo bb5bcb8a4a 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>
2016-10-10 09:46:42 +02:00
David Sterba 01ddfdbbcb btrfs-progs: build: add explicit option separator to rm commands
Signed-off-by: David Sterba <dsterba@suse.com>
2016-10-10 09:46:24 +02:00
David Sterba 81f4d96f3d
Btrfs progs v4.8
Signed-off-by: David Sterba <dsterba@suse.com>
2016-10-05 12:47:51 +02:00
David Sterba 5a8f85d837 btrfs-progs: update CHANGES for v4.8
Signed-off-by: David Sterba <dsterba@suse.com>
2016-10-05 12:42:20 +02:00
David Sterba 64b195d34f 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>
2016-10-05 12:39:01 +02:00
David Sterba a288d6dafc 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>
2016-10-05 12:39:01 +02:00
David Sterba c8d9f05cec 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>
2016-10-05 12:39:01 +02:00
David Sterba eae42a1fe4 btrfs-progs: build: add alias for check tests
$ make test-check"

Signed-off-by: David Sterba <dsterba@suse.com>
2016-10-05 12:39:01 +02:00