Re: [PATCH v2 1/3] btrfs-progs: check: report more specific info about invalid location

2017-11-21 Thread Nikolay Borisov
On 22.11.2017 04:17, Su Yue wrote: > Previously, it was so useless to print message like > "invalid location %d". > > Let it print objectid and offset of dir_item too. > Debug is easier now. > > Suggested-by: Nikolay Borisov > Signed-off-by: Su Yue

Re: [PATCH 2/3] btrfs: update some code documentation

2017-11-21 Thread Nikolay Borisov
On 22.11.2017 00:20, Edmund Nadolski wrote: > > > On 11/21/2017 12:59 AM, Nikolay Borisov wrote: >> >> >> On 20.11.2017 22:24, Edmund Nadolski wrote: >>> Improve code documentation by adding/expanding comments in >>> several places. >>> >>> Signed-off-by: Edmund Nadolski

[PATCH] btrfs-progs: Allow to open filesystem with some broken tree roots

2017-11-21 Thread Gu Jinxiang
Repair the miss modify in commit 8698a2b9ba89 ("btrfs-progs: Allow inspect dump-tree to show specified tree block even some tree roots are corrupted") Due to above modify, the decompressed file of tests/fuzz-tests/images/bko-172811.raw.xz can not be open by btrfs-debug-tree, because the csum

[PATCH v2 1/3] btrfs-progs: check: report more specific info about invalid location

2017-11-21 Thread Su Yue
Previously, it was so useless to print message like "invalid location %d". Let it print objectid and offset of dir_item too. Debug is easier now. Suggested-by: Nikolay Borisov Signed-off-by: Su Yue --- changelog: v2: Print unknown location

Re: [PATCH 1/3] btrfs-progs: check: report more specific info about invalid location

2017-11-21 Thread Su Yue
On 11/21/2017 07:46 PM, Nikolay Borisov wrote: On 21.11.2017 12:15, Su Yue wrote: Previously, it was so useless to print message like "invalid location %d". Let it print objectid and offset of dir_item. Debug is easier now. Signed-off-by: Su Yue ---

[PATCH 3/7] Btrfs: retry write for non-raid56

2017-11-21 Thread Liu Bo
If the underlying protocal doesn't support retry and there are some transient errors happening somewhere in our IO stack, we'd like to give an extra chance for IO. In btrfs, read retry is handled in bio_readpage_error() with the retry unit being page size , for write retry however, we're going to

[PATCH 4/7] Btrfs: get rbio inside fail_bio_stripe

2017-11-21 Thread Liu Bo
Because rbio will be bio->private in any case, we can remove @rbio in arguments. Signed-off-by: Liu Bo --- fs/btrfs/raid56.c | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c index 24a6222..aa04e5b

[PATCH 2/7] Btrfs: add helper __btrfs_end_bio

2017-11-21 Thread Liu Bo
btrfs_end_bio() does two things, firstly it'd check and print errors from the underlying layers, secondly it'd check whether it's the last stripe for this IO (e.g. raid1 consists of two stripes for a single IO). Since I'd like to do retry on write errors before failing write IO, the above two

[PATCH 0/7] retry write on error

2017-11-21 Thread Liu Bo
If the underlying protocal doesn't support retry and there are some transient errors happening somewhere in our IO stack, we'd like to give an extra chance for IO. Or sometimes you see btrfs reporting 'wrr 1 flush 0 read 0 blabla' but the disk drive is 100% good, this retry may help a bit. In

[PATCH 7/7] Btrfs: retry the whole bio on write error

2017-11-21 Thread Liu Bo
Since we haven't included badblocks support in our retry path, instead of retry sector by sector only retry the whole bio to give it an extra chance. Signed-off-by: Liu Bo --- fs/btrfs/volumes.c | 72 ++ 1 file changed,

[PATCH 6/7] Btrfs: retry write for raid56

2017-11-21 Thread Liu Bo
Retry writes on raid56's final full stripe writes in order to get over some transient errors in our IO stack. Signed-off-by: Liu Bo --- fs/btrfs/raid56.c | 42 -- 1 file changed, 40 insertions(+), 2 deletions(-) diff --git

[PATCH 5/7] Btrfs: add helper __raid_write_end_io

2017-11-21 Thread Liu Bo
We'd like to retry write on errors, so this splits raid_write_end_io() to two parts, a) checking errors and b) the rest in a helper __raid_write_end_io(). Signed-off-by: Liu Bo --- fs/btrfs/raid56.c | 23 ++- 1 file changed, 14 insertions(+), 9

[PATCH 1/7] Btrfs: keep a copy of bi_iter in btrfs_io_bio

2017-11-21 Thread Liu Bo
Before this, we only keep a copy of bi_iter for cloned bio so that we can iterate bvec in endio with bio_for_each_segment(), and we iterate normal bio with bio_for_each_segment_all(). However, in the following patches, I'd add retry on write errors where I'd like to process both cloned bio and

Re: [PATCH 2/2] btrfs: extent-tree: Ensure btrfs_trim_fs can trim the whole fs

2017-11-21 Thread Qu Wenruo
On 2017年11月21日 23:12, Filipe Manana wrote: > On Tue, Nov 21, 2017 at 7:21 AM, Qu Wenruo wrote: >> [BUG] >> fstrim on some btrfs only trims the unallocated space, not trimming any >> space in existing block groups. >> >> [CAUSE] >> fstrim_range passed in by default fstrim will be:

Re: quotas: failure on removing a file via SFTP/SSH

2017-11-21 Thread Qu Wenruo
On 2017年11月22日 05:00, ST wrote: > On Tue, 2017-11-21 at 11:33 -0700, Chris Murphy wrote: >> On Tue, Nov 21, 2017 at 8:29 AM, ST wrote: >>> I'm trying to use quotas for a simple chrooted sftp setup, limiting >>> space for each user's subvolume (now for testing to 1M).

Re: [PATCH v2] iomap: report collisions between directio and buffered writes to userspace

2017-11-21 Thread Darrick J. Wong
On Wed, Nov 22, 2017 at 09:28:06AM +1100, Dave Chinner wrote: > On Tue, Nov 21, 2017 at 04:52:53AM -0800, Matthew Wilcox wrote: > > On Tue, Nov 21, 2017 at 05:48:15PM +1100, Dave Chinner wrote: > > > On Mon, Nov 20, 2017 at 08:32:40PM -0800, Matthew Wilcox wrote: > > > > On Mon, Nov 20, 2017 at

Re: [PATCH 01/10] remove mapping from balance_dirty_pages*()

2017-11-21 Thread Andrew Morton
On Tue, 14 Nov 2017 16:56:47 -0500 Josef Bacik wrote: > From: Josef Bacik > > The only reason we pass in the mapping is to get the inode in order to see if > writeback cgroups is enabled, and even then it only checks the bdi and a super > block flag.

[PATCH v2] Btrfs: fix list_add corruption and soft lockups in fsync

2017-11-21 Thread Liu Bo
Xfstests btrfs/146 revealed this corruption, [ 58.138831] Buffer I/O error on dev dm-0, logical block 2621424, async page read [ 58.151233] BTRFS error (device sdf): bdev /dev/mapper/error-test errs: wr 1, rd 0, flush 0, corrupt 0, gen 0 [ 58.152403] list_add corruption. prev->next should

Re: Kernel 4.14 RAID5 multi disk array on bcache not mounting

2017-11-21 Thread Lionel Bouton
Le 21/11/2017 à 23:04, Andy Leadbetter a écrit : > I have a 4 disk array on top of 120GB bcache setup, arranged as follows [...] > Upgraded today to 4.14.1 from their PPA and the 4.14 and 4.14.1 have a nasty bug affecting bcache users. See for example :

Re: [PATCH v2] iomap: report collisions between directio and buffered writes to userspace

2017-11-21 Thread Dave Chinner
On Tue, Nov 21, 2017 at 04:52:53AM -0800, Matthew Wilcox wrote: > On Tue, Nov 21, 2017 at 05:48:15PM +1100, Dave Chinner wrote: > > On Mon, Nov 20, 2017 at 08:32:40PM -0800, Matthew Wilcox wrote: > > > On Mon, Nov 20, 2017 at 05:37:53PM -0800, Darrick J. Wong wrote: > > > > On Tue, Nov 21, 2017 at

Re: [PATCH 2/3] btrfs: update some code documentation

2017-11-21 Thread Edmund Nadolski
On 11/21/2017 12:59 AM, Nikolay Borisov wrote: > > > On 20.11.2017 22:24, Edmund Nadolski wrote: >> Improve code documentation by adding/expanding comments in >> several places. >> >> Signed-off-by: Edmund Nadolski >> --- >> fs/btrfs/ctree.c| 31

Kernel 4.14 RAID5 multi disk array on bcache not mounting

2017-11-21 Thread Andy Leadbetter
I have a 4 disk array on top of 120GB bcache setup, arranged as follows dev/sda1: UUID="42AE-12E3" TYPE="vfat" PARTLABEL="EFI System" PARTUUID="d337c56a-fb0f-4e87-8d5f-a89122c81167" /dev/sda2: UUID="06e3ce52-f34a-409a-a143-3c04f1d334ff" TYPE="ext4" PARTLABEL="Linux filesystem"

Re: [PATCH] btrfs: handle errors while updating refcounts in update_ref_for_cow

2017-11-21 Thread Edmund Nadolski
On 11/21/2017 11:58 AM, je...@suse.com wrote: > From: Jeff Mahoney > > Since commit fb235dc06fa (btrfs: qgroup: Move half of the qgroup > accounting time out of commit trans) the assumption that > btrfs_add_delayed_{data,tree}_ref can only return 0 or -ENOMEM has > been false.

[PATCH v3] iomap: report collisions between directio and buffered writes to userspace

2017-11-21 Thread Darrick J. Wong
From: Darrick J. Wong If two programs simultaneously try to write to the same part of a file via direct IO and buffered IO, there's a chance that the post-diowrite pagecache invalidation will fail on the dirty page. When this happens, the dio write succeeded, which

[PATCH] btrfs: handle errors while updating refcounts in update_ref_for_cow

2017-11-21 Thread jeffm
From: Jeff Mahoney Since commit fb235dc06fa (btrfs: qgroup: Move half of the qgroup accounting time out of commit trans) the assumption that btrfs_add_delayed_{data,tree}_ref can only return 0 or -ENOMEM has been false. The qgroup operations call into btrfs_search_slot and

Re: [PATCH v2] iomap: report collisions between directio and buffered writes to userspace

2017-11-21 Thread Darrick J. Wong
On Tue, Nov 21, 2017 at 09:23:47AM -0800, Matthew Wilcox wrote: > On Tue, Nov 21, 2017 at 09:27:49AM +1100, Dave Chinner wrote: > > On Mon, Nov 20, 2017 at 01:51:00PM -0800, Matthew Wilcox wrote: > > > If you want an example of it in use, I'm pretty happy with this patch > > > that switches the

Re: quotas: failure on removing a file via SFTP/SSH

2017-11-21 Thread Chris Murphy
On Tue, Nov 21, 2017 at 8:29 AM, ST wrote: >> >>> I'm trying to use quotas for a simple chrooted sftp setup, limiting >> >>> space for each user's subvolume (now for testing to 1M). >> >>> >> >>> I tried to hit the limit by uploading files and once it comes to the >> >>> limit I

Re: [PATCH v2] iomap: report collisions between directio and buffered writes to userspace

2017-11-21 Thread Matthew Wilcox
On Tue, Nov 21, 2017 at 09:27:49AM +1100, Dave Chinner wrote: > On Mon, Nov 20, 2017 at 01:51:00PM -0800, Matthew Wilcox wrote: > > If you want an example of it in use, I'm pretty happy with this patch > > that switches the brd driver entirely from the radix tree API to the > > xarray API: > > >

Re: Read before you deploy btrfs + zstd

2017-11-21 Thread David Sterba
On Wed, Nov 15, 2017 at 08:09:15PM +, Nick Terrell wrote: > On 11/15/17, 6:41 AM, "David Sterba" wrote: > > The branch is now in a state that can be tested. Turns out the memory > > requirements are too much for grub, so the boot fails with "not enough > > memory". The

Re: quotas: failure on removing a file via SFTP/SSH

2017-11-21 Thread ST
> >>> I'm trying to use quotas for a simple chrooted sftp setup, limiting > >>> space for each user's subvolume (now for testing to 1M). > >>> > >>> I tried to hit the limit by uploading files and once it comes to the > >>> limit I face following problem: if I try to free space by removing a > >>>

Re: [PATCH 1/2] btrfs: Fix wild memory access in compression level parser

2017-11-21 Thread David Sterba
On Thu, Nov 16, 2017 at 08:49:47AM +0800, Qu Wenruo wrote: > > But we never set the level to 0 at the point the compression actually > > happens. See zlib.c:zlib_set_level, if level is 0 then the level > > passed to zlib is 3. Z_DEFAULT_COMPRESSION is upstream zlib level 6, > > which is slower, we

Re: [PATCH 2/2] btrfs: extent-tree: Ensure btrfs_trim_fs can trim the whole fs

2017-11-21 Thread Filipe Manana
On Tue, Nov 21, 2017 at 7:21 AM, Qu Wenruo wrote: > [BUG] > fstrim on some btrfs only trims the unallocated space, not trimming any > space in existing block groups. > > [CAUSE] > fstrim_range passed in by default fstrim will be: > > range->start = 0 > range->len = fs_size (which

Btrfs progs release 4.14

2017-11-21 Thread David Sterba
Hi, btrfs-progs version 4.14 have been released. Changes: * build: libzstd now required by default * check: more lowmem mode repair enhancements * subvol set-default: also accept path * prop set: compression accepts no/none, same as "" * filesystem usage: enable for filesystem on top

Re: [PATCH] btrfs: Enhance btrfs_trim_fs function to handle error better

2017-11-21 Thread David Sterba
On Tue, Nov 21, 2017 at 09:07:01AM +0800, Qu Wenruo wrote: > On 2017年11月21日 01:51, David Sterba wrote: > > On Mon, Nov 20, 2017 at 01:56:51PM +0800, Qu Wenruo wrote: > >> Function btrfs_trim_fs() doesn't handle errors in a consistent way, if > >> error happens when trimming existing block groups,

Re: [PATCH] btrfs: extent-tree: Use round up to replace align macro

2017-11-21 Thread Qu Wenruo
On 2017年11月21日 21:36, David Sterba wrote: > On Tue, Nov 21, 2017 at 01:54:45PM +0800, Qu Wenruo wrote: >> To save reader seconds before checking if it's rounding up or down. > > Agreed, this is more clear. Please switch all instances of ALIGN to > round_up, there's not much point doing it file

Re: quotas: failure on removing a file via SFTP/SSH

2017-11-21 Thread Qu Wenruo
On 2017年11月21日 21:18, ST wrote: > > > > On Tue, 2017-11-21 at 20:28 +0800, Qu Wenruo wrote: >> >> On 2017年11月21日 20:08, ST wrote: >>> Hello, >>> >>> I'm trying to use quotas for a simple chrooted sftp setup, limiting >>> space for each user's subvolume (now for testing to 1M). >>> >>> I tried

Re: [PATCH] Btrfs: fix list_add corruption and soft lockups in fsync

2017-11-21 Thread David Sterba
On Mon, Nov 20, 2017 at 10:37:25AM -0700, Liu Bo wrote: > > > [1]: https://www.spinics.net/lists/linux-btrfs/msg65308.html > > > "btrfs list corruption and soft lockups while testing writeback error > > > handling" > > > > > > > Fixes: 8407f553268a4611f254 ("Btrfs: fix data corruption after

Re: [PATCH] btrfs: extent-tree: Use round up to replace align macro

2017-11-21 Thread David Sterba
On Tue, Nov 21, 2017 at 04:06:54PM +0800, Qu Wenruo wrote: > On 2017年11月21日 15:33, Nikolay Borisov wrote: > > On 21.11.2017 07:54, Qu Wenruo wrote: > >> @@ -2054,7 +2054,7 @@ static int btrfs_issue_discard(struct block_device > >> *bdev, u64 start, u64 len, > >> { > >>int j, ret = 0; > >>

Re: [PATCH] btrfs: extent-tree: Use round up to replace align macro

2017-11-21 Thread David Sterba
On Tue, Nov 21, 2017 at 01:54:45PM +0800, Qu Wenruo wrote: > To save reader seconds before checking if it's rounding up or down. Agreed, this is more clear. Please switch all instances of ALIGN to round_up, there's not much point doing it file by file. -- To unsubscribe from this list: send the

Re: [PATCH 0/3] btrfs: some code cleanup and documentation

2017-11-21 Thread David Sterba
On Mon, Nov 20, 2017 at 01:24:46PM -0700, Edmund Nadolski wrote: > This series adds a bit of code cleanup and some documentation in the > form of comments. No operational change. > > Edmund Nadolski (3): > btrfs: btrfs_inode_log_parent should use defined inode_only values. > btrfs: update

Re: [PATCH 2/3] btrfs: update some code documentation

2017-11-21 Thread David Sterba
On Mon, Nov 20, 2017 at 01:24:48PM -0700, Edmund Nadolski wrote: > +/* > + * Reserve some special-case values for the extent_map .start, .block_start, > + *: and .orig_start fields. I'm used to write the structure members as type::member, which resembles the C++ syntax. There are already a few

Re: quotas: failure on removing a file via SFTP/SSH

2017-11-21 Thread ST
On Tue, 2017-11-21 at 20:28 +0800, Qu Wenruo wrote: > > On 2017年11月21日 20:08, ST wrote: > > Hello, > > > > I'm trying to use quotas for a simple chrooted sftp setup, limiting > > space for each user's subvolume (now for testing to 1M). > > > > I tried to hit the limit by uploading files and

Re: quotas: failure on removing a file via SFTP/SSH

2017-11-21 Thread ST
I am on Debian 9 (stable), so kernel version is: uname -r 4.9.0-4-amd64 btrfs-tools (4.7.3-1) It might be related to the bug you have referred to (since once I hit the quota limit I tried then to add some small files to check whether quota works). However my main problem is - why I can't REMOVE

Re: [PATCH v2] iomap: report collisions between directio and buffered writes to userspace

2017-11-21 Thread Matthew Wilcox
On Tue, Nov 21, 2017 at 05:48:15PM +1100, Dave Chinner wrote: > On Mon, Nov 20, 2017 at 08:32:40PM -0800, Matthew Wilcox wrote: > > On Mon, Nov 20, 2017 at 05:37:53PM -0800, Darrick J. Wong wrote: > > > On Tue, Nov 21, 2017 at 09:27:49AM +1100, Dave Chinner wrote: > > > > First thing I noticed was

Re: quotas: failure on removing a file via SFTP/SSH

2017-11-21 Thread Qu Wenruo
On 2017年11月21日 20:08, ST wrote: > Hello, > > I'm trying to use quotas for a simple chrooted sftp setup, limiting > space for each user's subvolume (now for testing to 1M). > > I tried to hit the limit by uploading files and once it comes to the > limit I face following problem: if I try to

quotas: failure on removing a file via SFTP/SSH

2017-11-21 Thread ST
Hello, I'm trying to use quotas for a simple chrooted sftp setup, limiting space for each user's subvolume (now for testing to 1M). I tried to hit the limit by uploading files and once it comes to the limit I face following problem: if I try to free space by removing a file via Linux sftp client

Re: [PATCH 1/3] btrfs-progs: check: report more specific info about invalid location

2017-11-21 Thread Nikolay Borisov
On 21.11.2017 12:15, Su Yue wrote: > Previously, it was so useless to print message like > "invalid location %d". > > Let it print objectid and offset of dir_item. > Debug is easier now. > > Signed-off-by: Su Yue > --- > cmds-check.c | 4 ++-- > 1 file changed, 2

[PATCH 3/3] btrfs-progs: check: record last checked root_item in original mode

2017-11-21 Thread Su Yue
check_fs_roots() will check all fs trees again if fs_info->tree_root have been cowed. It is inefficient if there are many subvolumes in filesystem. And it also causes dead loop while repairing fuzz-tests/images/bko-161811.raw: = ERROR: DIR_ITEM[256 1167283096] name

[PATCH 2/3] btrfs-progs: check: do not reset ret after try_repair_inode

2017-11-21 Thread Su Yue
After failure of try_repair_inode(), the value @ret will be reseted anyway. Then counter @error won't be incremented. So do not reset @ret after try_repair_inode(). Signed-off-by: Su Yue --- cmds-check.c | 1 - 1 file changed, 1 deletion(-) diff --git a/cmds-check.c

[PATCH 1/3] btrfs-progs: check: report more specific info about invalid location

2017-11-21 Thread Su Yue
Previously, it was so useless to print message like "invalid location %d". Let it print objectid and offset of dir_item. Debug is easier now. Signed-off-by: Su Yue --- cmds-check.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmds-check.c

Re: [PATCH 1/3] btrfs: btrfs_inode_log_parent should use defined inode_only values.

2017-11-21 Thread Nikolay Borisov
On 20.11.2017 22:24, Edmund Nadolski wrote: > Replace hardcoded numeric argument values for inode_only with the > constants defined for that use. > > Signed-off-by: Edmund Nadolski Reviewed-by: Nikolay Borisov > --- > fs/btrfs/tree-log.c | 7 +++ >

Re: [PATCH 3/3] btrfs: remove dead code from btrfs_get_extent

2017-11-21 Thread Nikolay Borisov
On 20.11.2017 22:24, Edmund Nadolski wrote: > Due to new_inline logic, the create == 0 is always true at this > point in the code, so the create != 0 branch can be removed. > > Signed-off-by: Edmund Nadolski Reviewed-by: Nikolay Borisov > --- >

Re: [PATCH] btrfs: extent-tree: Use round up to replace align macro

2017-11-21 Thread Qu Wenruo
On 2017年11月21日 15:33, Nikolay Borisov wrote: > > > On 21.11.2017 07:54, Qu Wenruo wrote: >> To save reader seconds before checking if it's rounding up or down. >> >> Signed-off-by: Qu Wenruo >> --- >> fs/btrfs/extent-tree.c | 10 +- >> 1 file changed, 5 insertions(+),

Re: [PATCH 2/2] btrfs: extent-tree: Ensure btrfs_trim_fs can trim the whole fs

2017-11-21 Thread Qu Wenruo
On 2017年11月21日 15:41, Nikolay Borisov wrote: > > > On 21.11.2017 09:21, Qu Wenruo wrote: >> [BUG] >> fstrim on some btrfs only trims the unallocated space, not trimming any >> space in existing block groups. >> >> [CAUSE] >> fstrim_range passed in by default fstrim will be: >> >> range->start

Re: [PATCH 2/3] btrfs: update some code documentation

2017-11-21 Thread Nikolay Borisov
On 20.11.2017 22:24, Edmund Nadolski wrote: > Improve code documentation by adding/expanding comments in > several places. > > Signed-off-by: Edmund Nadolski > --- > fs/btrfs/ctree.c| 31 +++--- > fs/btrfs/ctree.h| 28