[PATCH] btrfs-progs: Fix data race in btrfs-convert.

2017-07-12 Thread Adam Buchbinder
/convert/source-ext2.c:853 in ext2_copy_inodes Signed-off-by: Adam Buchbinder --- convert/main.c| 12 ++-- convert/source-ext2.c | 3 +++ convert/source-fs.h | 3 +++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/convert/main.c b/convert/main.c index c56382e

[PATCH] btrfs-progs: Use '-t btrfs' mount option in tests.

2017-07-12 Thread Adam Buchbinder
Without it, mount (at least from util-linux 2.20.1) tries (and fails) to mount some filesystems as NTFS. Signed-off-by: Adam Buchbinder --- tests/common | 2 +- tests/fsck-tests/012-leaf-corruption/test.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions

[PATCH] btrfs-progs: Fix data races in btrfs-image.

2017-07-12 Thread Adam Buchbinder
age/main.c:2534 #3 main btrfs-progs/image/main.c:2859 SUMMARY: ThreadSanitizer: data race btrfs-progs/image/main.c:1931 in add_cluster Signed-off-by: Adam Buchbinder --- image/main.c | 16 +--- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/image/main.c b/image/ma

[PATCH] btrfs-progs: Enable ThreadSanitizer, using D=tsan.

2017-07-12 Thread Adam Buchbinder
Tested with clang-3.9. Signed-off-by: Adam Buchbinder --- Makefile | 6 ++ 1 file changed, 6 insertions(+) diff --git a/Makefile b/Makefile index 81598df..8948301 100644 --- a/Makefile +++ b/Makefile @@ -17,6 +17,7 @@ # abort - call abort() on first error (dumps core

[PATCH] btrfs-progs: Tighten integer types in print-tree.

2017-07-10 Thread Adam Buchbinder
There are likely more places where the wrong size types are used, but these tripped Clang's warnings because they eventually get passed to printf. Signed-off-by: Adam Buchbinder --- print-tree.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/print-tree.c b/print-t

[PATCH] btrfs-progs: Fix missing internal deps in tests.

2017-07-10 Thread Adam Buchbinder
Doing a straight 'make test' would fail because some misc and fsck tests require particular tools to already be built. Add dependencies at the Makefile and shell-script level. Signed-off-by: Adam Buchbinder --- Makefile| 5 +++-- tests/fsck-tests.sh | 1 + tests/misc-te

[PATCH] btrfs: Fix misspellings in comments.

2016-03-04 Thread Adam Buchbinder
Signed-off-by: Adam Buchbinder --- fs/btrfs/check-integrity.c | 2 +- fs/btrfs/ctree.h | 10 +- fs/btrfs/dev-replace.c | 2 +- fs/btrfs/disk-io.c | 2 +- fs/btrfs/extent-tree.c | 2 +- fs/btrfs/extent_map.c | 4 ++-- fs/btrfs/file.c| 2

Re: [PATCH] Properly size the leafsize field in the mdrestore_struct struct.

2014-06-13 Thread Adam Buchbinder
tool which marks all uninstrumented libraries as good) is apparently not trivial to install. I may just build zlib.) But the point is, it would have been annoying and sad if this had been a false positive through and through, but I *did* find an actual issue here using MSan, even though MSan was point

[PATCH] Fix a use-after-free in the volumes code.

2014-06-13 Thread Adam Buchbinder
-io.c:1002 #4 __open_ctree_fd .../disk-io.c:1090 #5 open_ctree_fd .../disk-io.c:1191 #6 do_convert .../btrfs-convert.c:2256 #7 main .../btrfs-convert.c:2745 Signed-off-by: Adam Buchbinder --- volumes.c | 1 + volumes.h | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) di

[PATCH 2/2] Remove a leading '+'.

2014-06-13 Thread Adam Buchbinder
It was added in commit aab7f3ae3eb02fb7e8a6a31d7e2ada704a3dcd5e, most likely as a copy-pasteo. Signed-off-by: Adam Buchbinder --- btrfs-show-super.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/btrfs-show-super.c b/btrfs-show-super.c index f42cd15..ed0311f 100644 --- a

[PATCH 1/2] Remove extra 'const' modifiers; they don't do anything.

2014-06-13 Thread Adam Buchbinder
const pointers to const chars leads to a mismatch there. This was found with clang's duplicate-decl-specifier warning. Signed-off-by: Adam Buchbinder --- utils.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/utils.c b/utils.c index d29de94..91a7111 100644 --- a/uti

[PATCH] Fix undefined behavior in radix-tree.c.

2014-06-13 Thread Adam Buchbinder
hough the value is discarded in those cases, it's still undefined behavior; see the C99 standard, section 6.5.7, paragraph three: "If the value of the right operand is negative [...] the behavior is undefined." Signed-off-by: Adam Buchbinder --- radix-tree.c | 6 +++--- 1 fi

[PATCH] Properly size the leafsize field in the mdrestore_struct struct.

2014-06-12 Thread Adam Buchbinder
It's 32 bits as defined in ctree.h, but the struct had it as 64 bits. Found using MemorySanitizer. Signed-off-by: Adam Buchbinder --- btrfs-image.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/btrfs-image.c b/btrfs-image.c index cf1fe2d..98d765a 100644 --- a/

[PATCH] Use sparse files for filesystem conversion tests.

2014-06-12 Thread Adam Buchbinder
On my system, this brings the FS conversion test suite's runtime from over ten seconds down to under two. Thanks to Julien Muchembled for the suggestion. Signed-off-by: Adam Buchbinder --- tests/convert-tests.sh | 18 ++ 1 file changed, 10 insertions(+), 8 deletions(-)

[PATCH] Add some simple end-to-end tests for btrfs-convert.

2014-05-21 Thread Adam Buchbinder
These use the system's mke2fs, and don't require loop devices or root privileges. They don't pick up anything with the default flags right now, but they do pick up some sanitizer issues when the tools are compiled with any of -fsanitize={address,memory,thread}. Signed-off-by:

[PATCH] btrfs-image: Fix a data race in build_chunk_tree.

2014-05-18 Thread Adam Buchbinder
A mdrestore_struct was being written to without its mutex being held. This race was found with ThreadSanitizer; the relevant part of the report looks like this: WARNING: ThreadSanitizer: data race (pid=18828) Write of size 8 at 0x7fc3d088 by main thread: #0 build_chunk_tree .../btrfs-pro