[PATCH] Btrfs: fix memory corruption on failure to submit bio for direct IO

2015-06-30 Thread fdmanana
From: Filipe Manana If we fail to submit a bio for a direct IO request, we were grabbing the corresponding ordered extent and decrementing its reference count twice, once for our lookup reference and once for the ordered tree reference. This was a problem because it caused the ordered extent to b

Re: [PATCH 1/2] Btrfs: fix hang when failing to submit bio of directIO

2015-06-30 Thread Filipe David Manana
On Wed, Jun 17, 2015 at 9:59 AM, Liu Bo wrote: > The hang is uncoverd by generic/019. > > btrfs_endio_direct_write() skips the "finish_ordered_fn" part when it hits > an error, thus those added ordered extents will never get processed, which > block processes that waiting for them via btrfs_start_

Re: [PATCH 2/2] Btrfs: fix warning of bytes_may_use

2015-06-30 Thread Filipe David Manana
On Wed, Jun 17, 2015 at 9:59 AM, Liu Bo wrote: > While running generic/019, dmesg got several warnings from > btrfs_free_reserved_data_space(). > > Test generic/019 produces some disk failures so sumbit dio will get errors, > in which case, btrfs_direct_IO() goes to the error handling and free > b

Re: [PATCH 2/2] [btrfs] btrfs_rename(): don't ignore btrfs_end_transaction() return

2015-06-30 Thread Filipe David Manana
On Tue, Jun 30, 2015 at 5:15 AM, Davide C. C. Italiano wrote: > From: Davide Italiano > > btrfs_end_transaction() can return an error -- this happens, e.g. > if it tries to commit and the transaction was aborted in the meanhwile. > Swallowing the error is wrong, so explicitly return it. > > Signe

Re: [PATCH 1/2] [btrfs] btrfs_rename: abort transaction in case of error.

2015-06-30 Thread Filipe David Manana
On Tue, Jun 30, 2015 at 5:17 AM, Davide Italiano wrote: > On Mon, Jun 29, 2015 at 4:59 AM, Filipe David Manana > wrote: >> On Sun, Jun 28, 2015 at 10:47 PM, Davide C. C. Italiano >> wrote: >>> From: Davide Italiano >>> >>> btrfs_insert_inode_ref() may fail and we want to make sure >>> the tran

btrfs-progs 4.1 failed to compile on CentOS 6.x

2015-06-30 Thread Amr El-Sharnoby
Hi, Compilation of btrfs-progs 4.1 failed on CentOS 6.6 with latest updated packages with the folllowing error, In file included from cmds-inspect.c:28: send-utils.h:97: error: wrong number of arguments specified for ‘deprecated’ attribute send-utils.h:99: error: wrong number of arguments specified

Re: WARNING: at /fs/btrfs/extent-tree.c:4029 btrfs_free_reserved_data_space

2015-06-30 Thread David Weber
Lutz Vieweg 5t9.de> writes: > > On 06/29/2015 11:35 AM, David Weber wrote: > > we are testing Btrfs as a kvm storage system with > > "defaults,space_cache,nodatacow" mount options and regular snapshots. > > That sounds brave - even with "nodatacow" it appeared to me > that using btrfs with ofte

Re: btrfs-progs 4.1 failed to compile on CentOS 6.x

2015-06-30 Thread David Sterba
On Tue, Jun 30, 2015 at 11:59:50AM +0300, Amr El-Sharnoby wrote: > Compilation of btrfs-progs 4.1 failed on CentOS 6.6 with latest > updated packages with the folllowing error, > In file included from cmds-inspect.c:28: > send-utils.h:97: error: wrong number of arguments specified for > ‘deprecated

Re: btrfs-progs 4.1 failed to compile on CentOS 6.x

2015-06-30 Thread Amr El-Sharnoby
rpm -q gcc gcc-4.4.7-11.el6.x86_64 It's the latest available. -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html

Re: btrfs-progs 4.1 failed to compile on CentOS 6.x

2015-06-30 Thread David Sterba
On Tue, Jun 30, 2015 at 03:43:49PM +0300, Amr El-Sharnoby wrote: > rpm -q gcc > gcc-4.4.7-11.el6.x86_64 > > It's the latest available. Ok, I'll drop the optional argument. Fixed in git and will be released in 4.1.1. -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the

Re: [PATCH] Btrfs-progs: add feature to get mininum size for resizing a fs/device

2015-06-30 Thread David Sterba
On Mon, Jun 29, 2015 at 05:15:12PM +0100, Filipe Manana wrote: > On Mon, Jun 29, 2015 at 4:42 PM, David Sterba wrote: > > On Wed, Jun 17, 2015 at 12:44:55PM +0100, fdman...@kernel.org wrote: > > The test fails after I do this before unmount: > > > > $SUDO_HELPER $TOP/btrfs balance start -mconvert=

Re: [PATCH] Btrfs-progs: add feature to get mininum size for resizing a fs/device

2015-06-30 Thread Filipe Manana
On Tue, Jun 30, 2015 at 4:14 PM, David Sterba wrote: > On Mon, Jun 29, 2015 at 05:15:12PM +0100, Filipe Manana wrote: >> On Mon, Jun 29, 2015 at 4:42 PM, David Sterba wrote: >> > On Wed, Jun 17, 2015 at 12:44:55PM +0100, fdman...@kernel.org wrote: >> > The test fails after I do this before unmoun

Re: [PATCH] Btrfs: add autodefrag inode flag

2015-06-30 Thread David Sterba
On Thu, Jun 18, 2015 at 07:10:47PM -0700, Omar Sandoval wrote: > In some cases, we may not want to enable automatic defragmentation for > the whole filesystem with the "autodefrag" mount option but we still > want to defragment specific files or directories. Add an inode flag > which allows us to d

Re: [PATCH] Btrfs: add autodefrag inode flag

2015-06-30 Thread Omar Sandoval
On 06/30/2015 09:18 AM, David Sterba wrote: > On Thu, Jun 18, 2015 at 07:10:47PM -0700, Omar Sandoval wrote: >> In some cases, we may not want to enable automatic defragmentation for >> the whole filesystem with the "autodefrag" mount option but we still >> want to defragment specific files or dire

[PATCH RESEND] Btrfs: add autodefrag inode flag

2015-06-30 Thread Omar Sandoval
In some cases, we may not want to enable automatic defragmentation for the whole filesystem with the "autodefrag" mount option but we still want to defragment specific files or directories. Add an inode flag which allows us to do specify that. Signed-off-by: Omar Sandoval --- Resending this becau

Re: [PATCH 2/2] btrfs-progs: Add repair function for I_ERR_FILE_WRONG_NBYTES.

2015-06-30 Thread David Sterba
On Fri, Jun 19, 2015 at 11:49:20AM +0800, Qu Wenruo wrote: > Some unknown kernel bug makes inode nbytes modification out of sync with > file extent update. > > But it's quite easy to fix in btrfs-progs anyway. > > So just fix it by adding a new function repair_inode_nbytes by using the > found_si

[PATCH 0/5] btrfs: dedupe fixes, features V5

2015-06-30 Thread Mark Fasheh
Hi Chris, The following patches are based on top of my patch titled "btrfs: Handle unaligned length in extent_same" which you have in your 'integration-4.2' branch: https://git.kernel.org/cgit/linux/kernel/git/mason/linux-btrfs.git/commit/?id=e1d227a42ea2b4664f94212bd1106b9a3413ffb8 The serie

[PATCH 4/5] btrfs: allow dedupe of same inode

2015-06-30 Thread Mark Fasheh
clone() supports cloning within an inode so extent-same can do the same now. This patch fixes up the locking in extent-same to know about the single-inode case. In addition to that, we add a check for overlapping ranges, which clone does not allow. Signed-off-by: Mark Fasheh Reviewed-by: David St

[PATCH 3/5] btrfs: fix clone / extent-same deadlocks

2015-06-30 Thread Mark Fasheh
Clone and extent same lock their source and target inodes in opposite order. In addition to this, the range locking in clone doesn't take ordering into account. Fix this by having clone use the same locking helpers as btrfs-extent-same. In addition, I do a small cleanup of the locking helpers, rem

[PATCH 2/5] btrfs: fix deadlock with extent-same and readpage

2015-06-30 Thread Mark Fasheh
->readpage() does page_lock() before extent_lock(), we do the opposite in extent-same. We want to reverse the order in btrfs_extent_same() but it's not quite straightforward since the page locks are taken inside btrfs_cmp_data(). So I split btrfs_cmp_data() into 3 parts with a small context struc

[PATCH 1/5] btrfs: pass unaligned length to btrfs_cmp_data()

2015-06-30 Thread Mark Fasheh
In the case that we dedupe the tail of a file, we might expand the dedupe len out to the end of our last block. We don't want to compare data past i_size however, so pass the original length to btrfs_cmp_data(). Signed-off-by: Mark Fasheh Reviewed-by: David Sterba --- fs/btrfs/ioctl.c | 3 ++-

[PATCH 5/5] btrfs: don't update mtime/ctime on deduped inodes

2015-06-30 Thread Mark Fasheh
One issue users have reported is that dedupe changes mtime on files, resulting in tools like rsync thinking that their contents have changed when in fact the data is exactly the same. We also skip the ctime update as no user-visible metadata changes here and we want dedupe to be transparent to the

Re: [PATCH RESEND] Btrfs: add autodefrag inode flag

2015-06-30 Thread Dave Chinner
On Tue, Jun 30, 2015 at 09:32:20AM -0700, Omar Sandoval wrote: > In some cases, we may not want to enable automatic defragmentation for > the whole filesystem with the "autodefrag" mount option but we still > want to defragment specific files or directories. Add an inode flag > which allows us to d

[PATCH v2] Btrfs: fix memory corruption on failure to submit bio for direct IO

2015-06-30 Thread fdmanana
From: Filipe Manana If we fail to submit a bio for a direct IO request, we were grabbing the corresponding ordered extent and decrementing its reference count twice, once for our lookup reference and once for the ordered tree reference. This was a problem because it caused the ordered extent to b

[GIT PULL] Btrfs bug fixes

2015-06-30 Thread fdmanana
From: Filipe Manana Hi Chris, Please consider the following changes (or a subset at your will in case they are too many or too large) for the kernel 4.2 release. All these patches have been available in the mailing list for at least 2 weeks. They are all bug fixes and deal with races, crashes,

Re: [PATCH] Btrfs: fix wrong check for btrfs_force_chunk_alloc()

2015-06-30 Thread Filipe David Manana
On Sun, Apr 12, 2015 at 7:35 AM, Wang Shilong wrote: > btrfs_force_chunk_alloc() return 1 for allocation chunk successfully. > This problem exists since commit c87f08ca4. > > With this patch, we might fix some enospc problems for balances. > > Signed-off-by: Wang Shilong Reviewed-by: Filipe Manan

[PATCH] btrfs-progs: doc: fix short explanation of restore in btrfs

2015-06-30 Thread Tsutomu Itoh
Short explanation of restore is wrong. Fix it. Signed-off-by: Tsutomu Itoh --- Documentation/btrfs.asciidoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/btrfs.asciidoc b/Documentation/btrfs.asciidoc index 1b3aa29..72d0e0a 100644 --- a/Documentation/btrfs.asci

Re: [PATCH] Btrfs: fix wrong check for btrfs_force_chunk_alloc()

2015-06-30 Thread Wang Shilong
> On Sun, Apr 12, 2015 at 7:35 AM, Wang Shilong > wrote: >> btrfs_force_chunk_alloc() return 1 for allocation chunk successfully. >> This problem exists since commit c87f08ca4. >> >> With this patch, we might fix some enospc problems for balances. >> >> Signed-off-by: Wang Shilong > Reviewed-by