[PATCH] Btrfs: fix use-after-free when cloning a trailing file hole

2014-06-29 Thread Filipe David Borba Manana
The transaction handle was being used after being freed. Cc: Chris Mason c...@fb.com Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- fs/btrfs/ioctl.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index 02dc64b

[PATCH v2] Btrfs: fix use-after-free when cloning a trailing file hole

2014-06-29 Thread Filipe David Borba Manana
The transaction handle was being used after being freed. Cc: Chris Mason c...@fb.com Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- V2: Removed file extent item argument to clone_update_extent_map() for more clarity. fs/btrfs/ioctl.c | 20 +--- 1 file

[PATCH] Btrfs: atomically set inode-i_flags in btrfs_update_iflags

2014-06-25 Thread Filipe David Borba Manana
, respectively. Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- fs/btrfs/ioctl.c | 17 ++--- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index 6ea1546..02dc64b 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c

[PATCH v2] Btrfs: fix crash when starting transaction

2014-06-24 Thread Filipe David Borba Manana
f1 48 c7 c2 51 13 36 a0 48 89 fe 31 c0 48 c7 c7 d0 43 36 a0 48 89 e5 e8 6d b5 32 e1 0f 0b 0f 1f 44 00 00 55 b9 11 00 00 00 48 89 e5 41 55 49 89 f5 [25405.18] RIP [a03570ca] assfail.constprop.88+0x1e/0x20 [btrfs] Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- V2

[PATCH] Btrfs: assert send doesn't attempt to start transactions

2014-06-24 Thread Filipe David Borba Manana
: Btrfs: fix crash when starting transaction Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- fs/btrfs/transaction.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c index 614eac3..47870ca 100644 --- a/fs

[PATCH] Btrfs: implement support for fallocate collapse range

2014-06-23 Thread Filipe David Borba Manana
This implements fallocate's FALLOC_FL_COLLAPSE_RANGE operation for BTRFS. This fallocate operation was introduced in the linux kernel version 3.15. Existing tests in xfstests already test this operation explicitly and implicitly via fsstress. Signed-off-by: Filipe David Borba Manana fdman

[PATCH] generic/017: skip invalid block sizes for btrfs

2014-06-23 Thread Filipe David Borba Manana
David Borba Manana fdman...@gmail.com --- tests/generic/017 | 8 1 file changed, 8 insertions(+) diff --git a/tests/generic/017 b/tests/generic/017 index 13b7254..6495be5 100755 --- a/tests/generic/017 +++ b/tests/generic/017 @@ -51,6 +51,14 @@ BLOCKS=10240 for (( BSIZE = 1024; BSIZE

[PATCH 2/6 v5] Btrfs: send, implement total data size command to allow for progress estimation

2014-06-23 Thread Filipe David Borba Manana
About to receive 9571342213 bytes Subvolume /mnt/sdc//snap_incr, 6557345221 / 9571342213 bytes received, 68.51%, 51.04MB/s Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- V2: A v2 stream is now only produced if the send ioctl caller passes in one of the new flags

[PATCH 3/6 v5] Btrfs: send, use fallocate command to punch holes

2014-06-23 Thread Filipe David Borba Manana
Instead of sending a write command with a data buffer filled with 0 value bytes, use the fallocate command, introduced in the send stream version 2, to tell the receiver to punch a file hole using the fallocate system call. Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- V2: A v2

[PATCH 4/6 v5] Btrfs: send, use fallocate command to allocate extents

2014-06-23 Thread Filipe David Borba Manana
-allocation and hole punching. Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- V2: Added new send ioctl flag BTRFS_SEND_FLAG_SUPPORT_FALLOCATE. A version 2 stream is now only produced is the ioctl caller specifies at least one of the new send flags

[PATCH 1/6 v5] Btrfs: send, bump stream version

2014-06-23 Thread Filipe David Borba Manana
. Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- V2: A v2 stream is now only produced if the send ioctl caller passes in one of the new flags (BTRFS_SEND_FLAG_CALCULATE_DATA_SIZE | BTRFS_SEND_FLAG_SUPPORT_FALLOCATE) to avoid breaking old clients. V3: Removed

[PATCH 5/6 v5] Btrfs: add missing cleanup on sysfs init failure

2014-06-23 Thread Filipe David Borba Manana
] [8104a32c] warn_slowpath_common+0x8c/0xc0 [ 2246.451325] [8104a416] warn_slowpath_fmt+0x46/0x50 [ 2246.451328] [81367dc5] ? strlcat+0x65/0x90 () Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- V1..V4: There's no v1, v2, v3 and v4. Bumped directly

[PATCH 6/6 v5] Btrfs: add send_stream_version attribute to sysfs

2014-06-23 Thread Filipe David Borba Manana
So that applications can find out what's the highest send stream version supported/implemented by the running kernel: $ cat /sys/fs/btrfs/send/stream_version 2 Signed-off-by: Filipe David Borba Manana fdman...@gmail.com Reviewed-by: David Sterba dste...@suse.cz --- V1..V4: There's no v1

[PATCH] Btrfs: fix crash when starting transaction

2014-06-23 Thread Filipe David Borba Manana
f1 48 c7 c2 51 13 36 a0 48 89 fe 31 c0 48 c7 c7 d0 43 36 a0 48 89 e5 e8 6d b5 32 e1 0f 0b 0f 1f 44 00 00 55 b9 11 00 00 00 48 89 e5 41 55 49 89 f5 [25405.18] RIP [a03570ca] assfail.constprop.88+0x1e/0x20 [btrfs] Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- fs

[PATCH] Btrfs: remove unused wait queue in struct extent_buffer

2014-06-16 Thread Filipe David Borba Manana
The lock_wq wait queue is not used anywhere, therefore just remove it. On a x86_64 system, this reduced sizeof(struct extent_buffer) from 320 bytes down to 296 bytes, which means a 4Kb page can now be used for 13 extent buffers instead of 12. Signed-off-by: Filipe David Borba Manana fdman

[PATCH] Btrfs: fix qgroups sanity test crash or hang

2014-06-11 Thread Filipe David Borba Manana
] [810d91cc] load_module+0x1cdc/0x2630 (...) Therefore initialize the extent buffer as an empty leaf (level 0). Issue easy to reproduce when btrfs is built as a module via: $ for ((i = 1; i = 100; i++)); do rmmod btrfs; modprobe btrfs; done Signed-off-by: Filipe David Borba Manana

[PATCH v2] Btrfs: fix qgroups sanity test crash or hang

2014-06-11 Thread Filipe David Borba Manana
] [810d91cc] load_module+0x1cdc/0x2630 (...) Therefore initialize the extent buffer as an empty leaf (level 0). Issue easy to reproduce when btrfs is built as a module via: $ for ((i = 1; i = 100; i++)); do rmmod btrfs; modprobe btrfs; done Signed-off-by: Filipe David Borba Manana

[PATCH v6] xfstests: add test for btrfs cloning with file holes

2014-06-10 Thread Filipe David Borba Manana
to deal with holes when NO_HOLES feature is enabled Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- V2: Increased test coverage by testing the cases where a hole overlaps the start and end of the cloning range. V3: Test the case where the cloning range includes an hole at the end

[PATCH v3] xfstests: add test for btrfs clone + fsync durability

2014-06-10 Thread Filipe David Borba Manana
to detect that file data has been changed and must be persisted to the log. This issue is fixed by the following linux kernel btrfs patch: Btrfs: make fsync work after cloning into a file Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- V2: Test small files too, consisting

[PATCH] Btrfs: fix RCU correctness warning when running sanity tests

2014-06-10 Thread Filipe David Borba Manana
] SyS_finit_module+0x8e/0x90 [ 3197.218168] [81698212] system_call_fastpath+0x16/0x1b Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- fs/btrfs/tests/btrfs-tests.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/fs/btrfs/tests/btrfs-tests.c b/fs/btrfs

[PATCH v2] Btrfs: fix RCU correctness warning when running sanity tests

2014-06-10 Thread Filipe David Borba Manana
] SyS_finit_module+0x8e/0x90 [ 3197.218168] [81698212] system_call_fastpath+0x16/0x1b Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- V2: Added missing rcu read unlock if a retry is needed. fs/btrfs/tests/btrfs-tests.c | 12 +++- 1 file changed, 7 insertions(+), 5

[PATCH] Btrfs: ensure btrfs_prev_leaf doesn't miss 1 item

2014-06-09 Thread Filipe David Borba Manana
as the only element of a leaf (big fat item). Therefore account for these 2 cases, so that our callers (like btrfs_previous_item) don't miss an existing item with a key matching the previous key we computed above. Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- fs/btrfs/ctree.c | 12

[PATCH v4] Btrfs: make fsync work after cloning into a file

2014-06-08 Thread Filipe David Borba Manana
) was a NOOP, since it relies on the existence of extent maps in the modified list of the inode's extent map tree, which was empty. Therefore add new extent maps to reflect the target clone range. A test case for xfstests follows. Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- V2

[PATCH v5] Btrfs: make fsync work after cloning into a file

2014-06-08 Thread Filipe David Borba Manana
) was a NOOP, since it relies on the existence of extent maps in the modified list of the inode's extent map tree, which was empty. Therefore add new extent maps to reflect the target clone range. A test case for xfstests follows. Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- V2

[PATCH v2] xfstests: add test for btrfs clone + fsync durability

2014-06-08 Thread Filipe David Borba Manana
to detect that file data has been changed and must be persisted to the log. This issue is fixed by the following linux kernel btrfs patch: Btrfs: make fsync work after cloning into a file Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- V2: Test small files too, consisting

[PATCH v3] Btrfs: make fsync work after cloning into a file

2014-06-06 Thread Filipe David Borba Manana
) was a NOOP, since it relies on the existence of extent maps in the modified list of the inode's extent map tree, which was empty. Therefore add new extent maps to reflect the target clone range. A test case for xfstests follows. Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- V2

[PATCH 3/3] Btrfs: don't release invalid page in btrfs_page_exists_in_range()

2014-06-05 Thread Filipe David Borba Manana
shouldn't. Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- fs/btrfs/inode.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index f265f41..477e64a 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -6776,6 +6776,7 @@ bool

[PATCH 1/3] Btrfs: make sure we retry if we couldn't get the page

2014-06-05 Thread Filipe David Borba Manana
get didn't succeed. This could also make us return true when we shouldn't. Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- fs/btrfs/inode.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 38d1e7b..cdbd20e 100644

[PATCH 2/3] Btrfs: make sure we retry if page is a retriable exception

2014-06-05 Thread Filipe David Borba Manana
call page_cache_release after exiting the loop, which isn't correct because page doesn't point to a valid page, and possibly return true from the function when we shouldn't. Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- fs/btrfs/inode.c | 4 +++- 1 file changed, 3 insertions(+), 1

[PATCH] Btrfs: make fsync work after cloning into a file

2014-06-05 Thread Filipe David Borba Manana
) was a NOOP, since it relies on the existence of extent maps in the modified list of the inode's extent map tree, which was empty. Therefore add new extent maps to reflect the target clone range. A test case for xfstests follows. Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- fs

[PATCH] xfstests: add test for btrfs clone + fsync durability

2014-06-05 Thread Filipe David Borba Manana
to detect that file data has been changed and must be persisted to the log. This issue is fixed by the following linux kernel btrfs patch: Btrfs: make fsync work after cloning into a file Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- tests/btrfs/056 | 134

[PATCH] Btrfs: update commit root on snapshot creation after orphan cleanup

2014-06-03 Thread Filipe David Borba Manana
-by: Filipe David Borba Manana fdman...@gmail.com --- fs/btrfs/ioctl.c | 29 + 1 file changed, 29 insertions(+) diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index 95194a9..6680ad9 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c @@ -712,6 +712,35 @@ static int

[PATCH v5] xfstests: add test for btrfs cloning with file holes

2014-06-03 Thread Filipe David Borba Manana
to deal with holes when NO_HOLES feature is enabled Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- V2: Increased test coverage by testing the cases where a hole overlaps the start and end of the cloning range. V3: Test the case where the cloning range includes an hole at the end

[PATCH v2] xfstests: add test for btrfs cloning with file holes

2014-05-31 Thread Filipe David Borba Manana
to deal with holes when NO_HOLES feature is enabled Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- V2: Increased test coverage by testing the cases where a hole overlaps the start and end of the cloning range. tests/btrfs/055 | 112

[PATCH v2] Btrfs: fix clone to deal with holes when NO_HOLES feature is enabled

2014-05-31 Thread Filipe David Borba Manana
. Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- V2: Deal with holes at the boundaries of the cloning range and that either overlap the boundary completely or partially. Test case for xfstests updated too to test these 2 cases. fs/btrfs/ioctl.c | 54

[PATCH v3] Btrfs: fix clone to deal with holes when NO_HOLES feature is enabled

2014-05-31 Thread Filipe David Borba Manana
. Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- V2: Deal with holes at the boundaries of the cloning range and that either overlap the boundary completely or partially. Test case for xfstests updated too to test these 2 cases. V3: Deal with the case where the cloning range

[PATCH v3] xfstests: add test for btrfs cloning with file holes

2014-05-31 Thread Filipe David Borba Manana
to deal with holes when NO_HOLES feature is enabled Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- V2: Increased test coverage by testing the cases where a hole overlaps the start and end of the cloning range. V3: Test the case where the cloning range includes an hole at the end

[PATCH v4] Btrfs: fix clone to deal with holes when NO_HOLES feature is enabled

2014-05-31 Thread Filipe David Borba Manana
, the holes were created at the destination. A test case for xfstests follows. Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- V2: Deal with holes at the boundaries of the cloning range and that either overlap the boundary completely or partially. Test case for xfstests

[PATCH] Btrfs: avoid visiting all extent items when cloning a range

2014-05-30 Thread Filipe David Borba Manana
) for inodes that have a large number of file extent items in the btree. Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- fs/btrfs/ioctl.c | 23 --- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index 603c036

[PATCH] Btrfs: ioctl, don't re-lock extent range when not necessary

2014-05-30 Thread Filipe David Borba Manana
in the inode's io tree. Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- fs/btrfs/ioctl.c | 9 +++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index 38f2169..603c036 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c @@ -2700,10

[PATCH] Btrfs: fix clone to deal with holes when NO_HOLES feature is enabled

2014-05-30 Thread Filipe David Borba Manana
. Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- fs/btrfs/ioctl.c | 17 +++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index ecf56af..bf34b7a 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c @@ -3009,6 +3009,7

[PATCH v3] Btrfs: avoid visiting all extent items when cloning a range

2014-05-30 Thread Filipe David Borba Manana
) for inodes that have a large number of file extent items in the btree. Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- V2: Leave the loop as soon as we process the last extent, to avoid one extra and unnecessary btree search. V3: Removed unintentional and unrelated change from v2

[PATCH] Btrfs: fix transaction leak during fsync call

2014-05-29 Thread Filipe David Borba Manana
for all ordered extents to complete anyway. Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- fs/btrfs/file.c | 6 -- 1 file changed, 6 deletions(-) diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index 8accf94..e0be468 100644 --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c

[PATCH v2] Btrfs: fix transaction leak during fsync call

2014-05-29 Thread Filipe David Borba Manana
would return without commiting or ending the transaction. Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- V2: Leave the call to btrfs_wait_ordered_range(), it's needed if the fs is mounted with -o no_flushoncommit. fs/btrfs/file.c | 4 +++- 1 file changed, 3 insertions(+), 1

[PATCH 2/2 v3] xfstests: add test for btrfs ioctl clone operation

2014-05-24 Thread Filipe David Borba Manana
This is a test to verify that the btrfs ioctl clone operation is able to clone extents of a file to different positions of the file, that is, the source and target files are the same. Existing tests only cover the case where the source and target files are different. Signed-off-by: Filipe David

[PATCH v2] xfstests: add test for btrfs send with large xattrs

2014-05-24 Thread Filipe David Borba Manana
btrfs patch: Btrfs: send, use the right limits for xattr names and values Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- V2: Updated second invocation of btrfs send to be incremental. This way we test both a full send (snapshot 1) and an incremental send (differences

[PATCH] Btrfs: send, don't error in the presence of subvols/snapshots

2014-05-24 Thread Filipe David Borba Manana
subvolume create /mnt/testdir btrfs subvolume snapshot -r /mnt /mnt/mysnap2 btrfs send -p /mnt/mysnap1 /mnt/mysnap2 -f /tmp/send.data A test case for xfstests follows. Reported-by: Robert White rwh...@pobox.com Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- fs/btrfs

[PATCH] Btrfs: set dead flag on the right root when destroying snapshot

2014-05-24 Thread Filipe David Borba Manana
for xfstests follows. Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- fs/btrfs/ioctl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index 362720a..482cad5 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c @@ -2314,7

[PATCH v2] Btrfs: set dead flag on the right root when destroying snapshot

2014-05-24 Thread Filipe David Borba Manana
for xfstests follows. Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- V2: Add missing replacements of 'root' with 'dest'. fs/btrfs/ioctl.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index 362720a..38f2169

[PATCH] xfstests: test for btrfs send when nested subvols/snapshots exist

2014-05-24 Thread Filipe David Borba Manana
: Btrfs: send, don't error in the presence of subvols/snapshots Btrfs: set dead flag on the right root when destroying snapshot Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- tests/btrfs/054 | 109 tests/btrfs/054.out

[PATCH v2] Btrfs: send, don't error in the presence of subvols/snapshots

2014-05-24 Thread Filipe David Borba Manana
subvolume create /mnt/testdir btrfs subvolume snapshot -r /mnt /mnt/mysnap2 btrfs send -p /mnt/mysnap1 /mnt/mysnap2 -f /tmp/send.data A test case for xfstests follows. Reported-by: Robert White rwh...@pobox.com Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- V2: Simpler

[PATCH 2/2 v2] xfstests: add test for btrfs ioctl clone operation

2014-05-23 Thread Filipe David Borba Manana
This is a test to verify that the btrfs ioctl clone operation is able to clone extents of a file to different positions of the file, that is, the source and target files are the same. Existing tests only cover the case where the source and target files are different. Signed-off-by: Filipe David

[PATCH] Btrfs-progs: debug-tree, add option to dump a single tree

2014-05-23 Thread Filipe David Borba Manana
. Example: btrfs-debug-tree -t 257 /dev/sdc Will only dump the tree of the first snapshot or subvolume that was created. Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- btrfs-debug-tree.c | 12 ++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/btrfs-debug

[PATCH] Btrfs-progs: receive, allow to continue after errors happen

2014-05-23 Thread Filipe David Borba Manana
processing the send stream. Regardless of its value, errors are always printed to stderr when they happen, just like before this change. Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- Documentation/btrfs-receive.txt | 3 +++ cmds-receive.c | 24

[PATCH] xfstests: add test for btrfs send with large xattrs

2014-05-23 Thread Filipe David Borba Manana
btrfs patch: Btrfs: send, use the right limits for xattr names and values Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- tests/btrfs/053 | 108 tests/btrfs/053.out | 1 + tests/btrfs/group | 1 + 3 files changed

[PATCH] Btrfs: send, use the right limits for xattr names and values

2014-05-23 Thread Filipe David Borba Manana
specific maximum name and value lengths, which depend on the leaf size, therefore use these limits to be able to send xattrs with sizes larger than PATH_MAX. A test case for xfstests follows. Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- fs/btrfs/send.c | 30

[PATCH 1/2] xfstests: add helper require function _require_btrfs_cloner

2014-05-22 Thread Filipe David Borba Manana
So that the same check (btrfs cloner program presence) can be reused by other tests. Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- common/rc | 7 +++ tests/btrfs/035 | 4 +--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/common/rc b/common/rc index

[PATCH v3] Btrfs: ensure readers see new data after a clone operation

2014-05-22 Thread Filipe David Borba Manana
; pthread_mutex_unlock(mutex); return ret; } Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- V2: Protect against ongoing writes by locking the target range in the io tree and wait for any existing ordered extents for that range to finish before starting the clone operation. V3

[PATCH 2/2] xfstests: add test for btrfs ioctl clone operation

2014-05-22 Thread Filipe David Borba Manana
This is a test to verify that the btrfs ioctl clone operation is able to clone extents of a file to different positions of the file, that is, the source and target files are the same. Existing tests only cover the case where the source and target files are different. Signed-off-by: Filipe David

[PATCH] Btrfs: send, fix corrupted paths strings for long paths

2014-05-21 Thread Filipe David Borba Manana
/amaiAdvancedStreamingPlugin.txt btrfs subvolume snapshot -r /mnt /mnt/mysnap1 btrfs send /mnt/mysnap1 -f /tmp/1.snap A test for xfstests follows. Signed-off-by: Filipe David Borba Manana fdman...@gmail.com Cc: Marc Merlin m...@merlins.org --- fs/btrfs/send.c | 7 +-- 1 file changed, 5 insertions(+), 2

[PATCH] xfstests: add test for btrfs send with long paths

2014-05-21 Thread Filipe David Borba Manana
: Btrfs: send, fix corrupted path strings for long paths Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- tests/btrfs/051 | 85 + tests/btrfs/051.out | 1 + tests/btrfs/group | 1 + 3 files changed, 87 insertions(+) create

[PATCH v2] Btrfs: send, fix corrupted path strings for long paths

2014-05-21 Thread Filipe David Borba Manana
/amaiAdvancedStreamingPlugin.txt btrfs subvolume snapshot -r /mnt /mnt/mysnap1 btrfs send /mnt/mysnap1 -f /tmp/1.snap A test for xfstests follows. Signed-off-by: Filipe David Borba Manana fdman...@gmail.com Cc: Marc Merlin m...@merlins.org --- V2: Fix change title, paths to path. fs/btrfs/send.c | 7 +-- 1

[PATCH v2] Btrfs: ensure readers see new data after a clone operation

2014-05-19 Thread Filipe David Borba Manana
; pthread_mutex_unlock(mutex); return ret; } Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- V2: Protect against ongoing writes by locking the target range in the io tree and wait for any existing ordered extents for that range to finish before starting the clone operation

[PATCH] Btrfs: fix leak of block group cache objects

2014-05-16 Thread Filipe David Borba Manana
] 0x Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- Note: this only affects Chris' integration branch. fs/btrfs/extent-tree.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index eb0760f..0bad610 100644 --- a/fs/btrfs/extent

[PATCH] Btrfs: send, fix incorrect ref access when using extrefs

2014-05-13 Thread Filipe David Borba Manana
btrfs subvolume snapshot -r /mnt /mnt/mysnap btrfs send /mnt/mysnap -f /tmp/mysnap.send Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- fs/btrfs/send.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c index 40f353f

[PATCH] xfstests: btrfs, add regression test for send with extrefs

2014-05-13 Thread Filipe David Borba Manana
behaviour such as producing a random/weird path string or a crash. This issue is fixed by the following linux kernel btrfs patch: Btrfs: send, fix incorrect ref access when using extrefs Cc: Josef Bacik jba...@fb.com Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- tests/btrfs

[PATCH v3] Btrfs: fix hang on error (such as ENOSPC) when writing extent pages

2014-05-09 Thread Filipe David Borba Manana
the caller (extent_write_cache_pages) processes all pages in the page vector even if an error happens only for some of them, so that ordered extents end up released. Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- V2: Grab error from `em` pointer if available, do the error check

[PATCH] Btrfs: fix hang on error (such as ENOSPC) when writing extent pages

2014-05-08 Thread Filipe David Borba Manana
\ -f sync=0 \ -f truncate=1 \ -f unlink=0 \ -f unresvsp=0 \ -f write=4 Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- fs/btrfs/extent_io.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/fs/btrfs

[PATCH v2] Btrfs: fix hang on error (such as ENOSPC) when writing extent pages

2014-05-08 Thread Filipe David Borba Manana
\ -f sync=0 \ -f truncate=1 \ -f unlink=0 \ -f unresvsp=0 \ -f write=4 Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- V2: Grab error from `em` pointer if available, do the error check and end_extent_writepage call

[PATCH] Btrfs-progs: check, fix csum check in the presence of non-inlined refs

2014-05-07 Thread Filipe David Borba Manana
for the csum item and exits with a status of 0. Also added missing btrfs_prev_leaf() return value checks, as we were ignoring errors and non-existence of left siblings completely. Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- cmds-check.c | 38 +++--- 1

[PATCH v2] Btrfs: fix leaf corruption caused by ENOSPC while hole punching

2014-04-29 Thread Filipe David Borba Manana
keep failing if they target the same file range. Cc: sta...@vger.kernel.org Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- V2: Updated commit message to mention difference between 3.14 kernels and older releases and cc'ed stable. Made the logic in __btrfs_drop_extents simpler

[PATCH v2] Btrfs: implement inode_operations callback tmpfile

2014-04-27 Thread Filipe David Borba Manana
This implements the tmpfile callback of struct inode_operations, introduced in the linux kernel 3.11, and implemented already by some filesystems. This callback is invoked by the VFS when the flag O_TMPFILE is passed to the open system call. Signed-off-by: Filipe David Borba Manana fdman

[PATCH] Btrfs: fix leaf corruption caused by ENOSPC while hole punching

2014-04-27 Thread Filipe David Borba Manana
://comments.gmane.org/gmane.comp.file-systems.btrfs/32938 Asking fill_holes() to create a 0 bytes wide file hole item also produced the first warning in the trace above, as we passed a range to btrfs_drop_extent_cache that has an end smaller (by -1) than its start. Signed-off-by: Filipe David Borba Manana

[PATCH] Btrfs: read inode size after acquiring the mutex when punching a hole

2014-04-25 Thread Filipe David Borba Manana
. Therefore fix it. Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- fs/btrfs/file.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index 23f6a9d..efaad37 100644 --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c @@ -2192,13 +2192,14

[PATCH] Btrfs: correctly set profile flags on seqlock retry

2014-04-24 Thread Filipe David Borba Manana
If we had to retry on the profiles seqlock (due to a concurrent write), we would set bits on the input flags that corresponded both to the current profile and to previous values of the profile. Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- fs/btrfs/extent-tree.c | 4 +++- 1

[PATCH] Btrfs: use correct key when repeating search for extent item

2014-04-24 Thread Filipe David Borba Manana
previously used the same key variable to peek at the previous item in the leaf, which has a different objectid. So just set the right objectid to avoid modifying/deleting a wrong item if we repeat the tree search. Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- fs/btrfs/extent-tree.c

[PATCH 1/6 v3] Btrfs: send, bump stream version

2014-04-20 Thread Filipe David Borba Manana
. Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- V2: A v2 stream is now only produced if the send ioctl caller passes in one of the new flags (BTRFS_SEND_FLAG_CALCULATE_DATA_SIZE | BTRFS_SEND_FLAG_SUPPORT_FALLOCATE) to avoid breaking old clients. V3: Removed

[PATCH 2/6 v3] Btrfs: send, implement total data size command to allow for progress estimation

2014-04-20 Thread Filipe David Borba Manana
About to receive 9571342213 bytes Subvolume /mnt/sdc//snap_incr, 6557345221 / 9571342213 bytes received, 68.51%, 51.04MB/s Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- V2: A v2 stream is now only produced if the send ioctl caller passes in one of the new flags

[PATCH 3/6 v4] Btrfs: send, use fallocate command to punch holes

2014-04-20 Thread Filipe David Borba Manana
Instead of sending a write command with a data buffer filled with 0 value bytes, use the fallocate command, introduced in the send stream version 2, to tell the receiver to punch a file hole using the fallocate system call. Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- V2: A v2

[PATCH 4/6 v4] Btrfs: send, use fallocate command to allocate extents

2014-04-20 Thread Filipe David Borba Manana
: [584..591]: 24712..24719 8 blocks 12: [592..2543]: 26192..28143 1952 blocks 13: [2544..17575]: hole 15032 blocks 14: [17576..21487]: 28144..32055 3912 blocks A test case for xfstests will follow. Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- V2: Added new

[PATCH 5/6] Btrfs: add missing cleanup on sysfs init failure

2014-04-20 Thread Filipe David Borba Manana
] [8104a32c] warn_slowpath_common+0x8c/0xc0 [ 2246.451325] [8104a416] warn_slowpath_fmt+0x46/0x50 [ 2246.451328] [81367dc5] ? strlcat+0x65/0x90 () Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- fs/btrfs/sysfs.c | 10 +- 1 file changed, 9

[PATCH 6/6] Btrfs: add send_stream_version attribute to sysfs

2014-04-20 Thread Filipe David Borba Manana
So that applications can find out what's the highest send stream version supported/implemented by the running kernel: $ cat /sys/fs/btrfs/send_stream_version 2 Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- fs/btrfs/send.h | 1 + fs/btrfs/sysfs.c | 36

[PATCH 1/4 v3] Btrfs-progs: send, bump stream version

2014-04-20 Thread Filipe David Borba Manana
) set inode otime. This is preparation work for subsequent changes that implement the new features. This doesn't break compatibility with older kernels or clients. In order to get a version 2 send stream, new flags must be passed to the send ioctl. Signed-off-by: Filipe David Borba Manana fdman

[PATCH 2/4 v4] Btrfs-progs: send, implement total data size callback and progress report

2014-04-20 Thread Filipe David Borba Manana
At the moment progress is only reported by btrfs-receive, but it is possible and simple to do it for btrfs-send too, so that we can get progress report when not piping btrfs-send output to btrfs-receive (directly to a file). Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- V2: Added new

[PATCH 3/4 v4] Btrfs-progs: send, implement fallocate command callback

2014-04-20 Thread Filipe David Borba Manana
or punch a file hole). Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- V2: Use the new send ioctl flag BTRFS_SEND_FLAG_SUPPORT_FALLOCATE if the user asks for it (-a command line option), which will make the kernel generate a version 2 send stream, so that old clients aren't

[PATCH v4] xfstests: btrfs, test send's ability to punch holes and prealloc extents

2014-04-20 Thread Filipe David Borba Manana
-off-by: Filipe David Borba Manana fdman...@gmail.com --- V2: Addressed Dave's comments, and updated btrfs send invocation, by specifying the new command line option (-a) that enables use of fallocate - added function _require_btrfs_send_fallocate_flag() to skip the test when an old

[PATCH 6/6 v2] Btrfs: add send_stream_version attribute to sysfs

2014-04-20 Thread Filipe David Borba Manana
So that applications can find out what's the highest send stream version supported/implemented by the running kernel: $ cat /sys/fs/btrfs/send/stream_version 2 Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- V2: Renamed /sys/fs/btrfs/send_stream_version to /sys/fs/btrfs

[PATCH] xfstests: btrfs/004, fix filefrag filter for files with 1 block only

2014-04-17 Thread Filipe David Borba Manana
: length: expected: flags: 0:0.. 0: 0.. 0: 1: unknown,delalloc,eof foobar: 1 extent found Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- tests/btrfs/004 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests

[PATCH] xfstests: btrfs/004, fix failure with inlined file extents

2014-04-17 Thread Filipe David Borba Manana
Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- tests/btrfs/004 | 34 +++--- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/tests/btrfs/004 b/tests/btrfs/004 index 670e1c2..1d5b816 100755 --- a/tests/btrfs/004 +++ b/tests/btrfs/004

[PATCH 1/4 v2] Btrfs: send, bump stream version

2014-04-16 Thread Filipe David Borba Manana
), meaning old clients are unaffected. Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- V2: A v2 stream is now only produced if the send ioctl caller passes in one of the new flags (BTRFS_SEND_FLAG_CALCULATE_DATA_SIZE | BTRFS_SEND_FLAG_SUPPORT_FALLOCATE) to avoid breaking old

[PATCH 3/4 v2] Btrfs: send, use fallocate command to punch holes

2014-04-16 Thread Filipe David Borba Manana
Instead of sending a write command with a data buffer filled with 0 value bytes, use the fallocate command, introduced in the send stream version 2, to tell the receiver to punch a file hole using the fallocate system call. Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- V2: A v2

[PATCH 4/4 v2] Btrfs: send, use fallocate command to allocate extents

2014-04-16 Thread Filipe David Borba Manana
: [584..591]: 24712..24719 8 blocks 12: [592..2543]: 26192..28143 1952 blocks 13: [2544..17575]: hole 15032 blocks 14: [17576..21487]: 28144..32055 3912 blocks A test case for xfstests will follow. Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- V2: A v2

[PATCH 1/4 v2] Btrfs-progs: send, bump stream version

2014-04-16 Thread Filipe David Borba Manana
David Borba Manana fdman...@gmail.com --- V2: Added new send ioctl flag BTRFS_SEND_FLAG_SUPPORT_FALLOCATE. A version 2 stream is now only produced is the ioctl caller specifies at least one of the new send flags (BTRFS_SEND_FLAG_SUPPORT_FALLOCATE or BTRFS_SEND_FLAG_CALCULATE_DATA_SIZE

[PATCH 2/4 v2] Btrfs-progs: send, implement total data size callback and progress report

2014-04-16 Thread Filipe David Borba Manana
-receive, but it is possible and simple to do it for btrfs-send too, so that we can get progress report when not piping btrfs-send output to btrfs-receive (directly to a file). Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- V2: Added new send ioctl flag

[PATCH 3/4 v2] Btrfs-progs: send, implement fallocate command callback

2014-04-16 Thread Filipe David Borba Manana
or punch a file hole). Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- V2: Use the new send ioctl flag BTRFS_SEND_FLAG_SUPPORT_FALLOCATE if the user asks for it (-a command line option), which will make the kernel generate a version 2 send stream, so that old clients aren't

[PATCH 2/4 v2] Btrfs: send, implement total data size command to allow for progress estimation

2014-04-16 Thread Filipe David Borba Manana
Subvolume /mnt/sdc//snap_incr, 6557345221 / 9571342213 bytes received, 68.51%, 51.04MB/s Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- V2: A v2 stream is now only produced if the send ioctl caller passes in one of the new flags (BTRFS_SEND_FLAG_CALCULATE_DATA_SIZE

[PATCH 4/4 v2] Btrfs-progs: add write and clone commands debug info to receive

2014-04-16 Thread Filipe David Borba Manana
When specifying -vv print information about received write and clone commands too, as we do this for other commands already and it's very useful for debugging and troubleshooting. Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- V2: Added new send ioctl flag

[PATCH v2] xfstests: btrfs, test send's ability to punch holes and prealloc extents

2014-04-16 Thread Filipe David Borba Manana
-off-by: Filipe David Borba Manana fdman...@gmail.com --- V2: Addressed Dave's comments, and updated btrfs send invocation, by specifying the new command line option (-a) that enables use of fallocate - added function _require_btrfs_send_fallocate_flag() to skip the test when an old

[PATCH v2] xfstests: btrfs, add test for btrfs properties

2014-04-16 Thread Filipe David Borba Manana
This test case verifies the btrfs properties feature, a new feature introduced in the linux kernel version 3.14. Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- V2: Addressed Dave's comments, removed function to check for existence of the btrfs-progs property command and use

[PATCH 3/4 v3] Btrfs: send, use fallocate command to punch holes

2014-04-16 Thread Filipe David Borba Manana
Instead of sending a write command with a data buffer filled with 0 value bytes, use the fallocate command, introduced in the send stream version 2, to tell the receiver to punch a file hole using the fallocate system call. Signed-off-by: Filipe David Borba Manana fdman...@gmail.com --- V2: A v2

  1   2   3   4   >