Re: [PATCH v4 2/3] btrfs: Refactor btrfs_check_super_valid()

2018-05-24 Thread Su Yue
On 05/25/2018 12:43 PM, Qu Wenruo wrote: > Refactor btrfs_check_super_valid() by the ways: > > 1) Rename it to btrfs_validate_mount_super() >Now it's more obvious when the function should be called. > > 2) Extract core check routine into __validate_super() >So later write time check

[PATCH v4 0/3] btrfs: Add write time super block validation

2018-05-24 Thread Qu Wenruo
This patchset can be fetched from github: https://github.com/adam900710/linux/tree/write_time_sb_check We have 2 reports about corrupted btrfs super block, which has some garbage in its super block, but otherwise it's completely fine and its csum even matches. This means we develop memory

[PATCH v4 3/3] btrfs: Do super block verification before writing it to disk

2018-05-24 Thread Qu Wenruo
There are already 2 reports about strangely corrupted super blocks, where csum still matches but extra garbage gets slipped into super block. The corruption would looks like: -- superblock: bytenr=65536, device=/dev/sdc1 - csum_type

[PATCH v4 1/3] btrfs: Move btrfs_check_super_valid() to avoid forward declaration

2018-05-24 Thread Qu Wenruo
Just move btrfs_check_super_valid() before its single caller to avoid forward declaration. Signed-off-by: Qu Wenruo --- fs/btrfs/disk-io.c | 299 ++--- 1 file changed, 149 insertions(+), 150 deletions(-) diff --git a/fs/btrfs/disk-io.c

[PATCH v4 2/3] btrfs: Refactor btrfs_check_super_valid()

2018-05-24 Thread Qu Wenruo
Refactor btrfs_check_super_valid() by the ways: 1) Rename it to btrfs_validate_mount_super() Now it's more obvious when the function should be called. 2) Extract core check routine into __validate_super() So later write time check can reuse it, and if needed, we could also use

[RESEND PATCH V5 10/33] btrfs: use segment_last_page to get bio's last page

2018-05-24 Thread Ming Lei
Preparing for supporting multipage bvec. Cc: Chris Mason Cc: Josef Bacik Cc: David Sterba Cc: linux-btrfs@vger.kernel.org Signed-off-by: Ming Lei --- fs/btrfs/compression.c | 5 - fs/btrfs/extent_io.c | 5 +++-- 2 files

Re: [PATCH v3 1/3] btrfs: Move btrfs_check_super_valid() to avoid forward declaration

2018-05-24 Thread Anand Jain
On 05/25/2018 10:59 AM, Qu Wenruo wrote: On 2018年05月25日 08:54, Qu Wenruo wrote: On 2018年05月25日 00:24, Anand Jain wrote: On misc-next this patch is causing regression, the seed sprout functionality test [1] (in the mailing list) fails.  [1]  [PATCH] fstests: btrfs: add seed sprout

[PATCH v4.1b 2/3] btrfs: balance: add args info during start and resume

2018-05-24 Thread Anand Jain
Balance arg info is an important information to be reviewed for the system audit. So this patch adds them to the kernel log. Example: ->btrfs bal start -f -mprofiles=raid1,convert=single,soft -dlimit=10..20,usage=50 /btrfs kernel: BTRFS info (device sdb): balance: start -f

[PATCH v4.1a 2/3] btrfs: balance: add args info during start and resume

2018-05-24 Thread Anand Jain
Balance arg info is an important information to be reviewed for the system audit. So this patch adds them to the kernel log. Example: ->btrfs bal start -f -mprofiles=raid1,convert=single,soft -dlimit=10..20,usage=50 /btrfs kernel: BTRFS info (device sdb): balance: start force

Re: [PATCH v4 2/3] btrfs: balance: add args info during start and resume

2018-05-24 Thread Anand Jain
On 05/24/2018 09:03 PM, David Sterba wrote: On Wed, May 23, 2018 at 02:35:07PM +0800, Anand Jain wrote: Balance arg info is an important information to be reviewed for the system audit. So this patch adds them to the kernel log. Example: ->btrfs bal start --full-balance -f

[josef-btrfs:blk-iolatency 5/13] mm/page_io.c:342:2: note: in expansion of macro 'if'

2018-05-24 Thread kbuild test robot
tree: https://git.kernel.org/pub/scm/linux/kernel/git/josef/btrfs-next.git blk-iolatency head: e4e4c15dbfeb48d4261b3746cd00e77b441be92b commit: 2598d1c2fa24725d77032c488db69ae4895666bd [5/13] swap,blkcg: issue swap io with the appropriate context config: x86_64-randconfig-s2-05250808

Re: [PATCH v3 1/3] btrfs: Move btrfs_check_super_valid() to avoid forward declaration

2018-05-24 Thread Qu Wenruo
On 2018年05月25日 08:54, Qu Wenruo wrote: > > > On 2018年05月25日 00:24, Anand Jain wrote: >> >> >> On misc-next this patch is causing regression, the seed sprout >> functionality test [1] (in the mailing list) fails. >> >>  [1] >>  [PATCH] fstests: btrfs: add seed sprout functionality test >> >>

[PATCH v4.1 1/3] btrfs: add helper function describe_block_group()

2018-05-24 Thread Anand Jain
Improve on describe_relocation() add a common helper function to describe the block groups. Signed-off-by: Anand Jain Reviewed-by: David Sterba --- v4->v4.1: Use strcpy(buf, "|NONE"); as in the original v3->v4: Just pass full flag name in the define

Re: [PATCH v4 1/3] btrfs: add helper function describe_block_group()

2018-05-24 Thread Anand Jain
On 05/24/2018 08:43 PM, David Sterba wrote: On Wed, May 23, 2018 at 02:35:06PM +0800, Anand Jain wrote: Improve on describe_relocation() add a common helper function to describe the block groups. Signed-off-by: Anand Jain --- v3->v4: Just pass full flag name in the

Re: [PATCH v3 1/3] btrfs: Move btrfs_check_super_valid() to avoid forward declaration

2018-05-24 Thread Qu Wenruo
On 2018年05月25日 00:24, Anand Jain wrote: > > > On misc-next this patch is causing regression, the seed sprout > functionality test [1] (in the mailing list) fails. > >  [1] >  [PATCH] fstests: btrfs: add seed sprout functionality test > > more below.. > > On 05/11/2018 01:35 PM, Qu Wenruo

Re: [PATCH V5 10/33] btrfs: use segment_last_page to get bio's last page

2018-05-24 Thread Ming Lei
On Thu, May 24, 2018 at 11:44:41PM +0200, David Sterba wrote: > On Thu, May 24, 2018 at 05:01:15PM +0800, Ming Lei wrote: > > Preparing for supporting multipage bvec. > > Could you please also CC the cover letter so we have a chance to learn > what multipage bvec means or what are the changes

[josef-btrfs:for-4.18/block 12/13] blk-iolatency.c:undefined reference to `__udivdi3'

2018-05-24 Thread kbuild test robot
tree: https://git.kernel.org/pub/scm/linux/kernel/git/josef/btrfs-next.git for-4.18/block head: 657e770d4d6e3b03c3d4b96e427b30d6f766e2e2 commit: 377f8e81c17e1e9a47ea5908b08a7a991a9faa6f [12/13] block: introduce blk-iolatency io controller config: i386-allmodconfig (attached as .config)

Re: [PATCH V5 10/33] btrfs: use segment_last_page to get bio's last page

2018-05-24 Thread David Sterba
On Thu, May 24, 2018 at 05:01:15PM +0800, Ming Lei wrote: > Preparing for supporting multipage bvec. Could you please also CC the cover letter so we have a chance to learn what multipage bvec means or what are the changes between the iterations? I found it in the archives, but a copy to

[RFC PATCH v4 3/6] Btrfs: push EXCL_OP set into btrfs_rm_device()

2018-05-24 Thread Omar Sandoval
From: Omar Sandoval btrfs_ioctl_rm_dev() and btrfs_ioctl_rm_dev_v2() both manipulate this bit. Let's move it into the common btrfs_rm_device(), which also makes the following change to deal with swap files easier. Signed-off-by: Omar Sandoval ---

[RFC PATCH v4 5/6] Btrfs: rename get_chunk_map() and make it non-static

2018-05-24 Thread Omar Sandoval
From: Omar Sandoval The Btrfs swap code is going to need it, so give it a btrfs_ prefix and make it non-static. Signed-off-by: Omar Sandoval --- fs/btrfs/volumes.c | 22 +++--- fs/btrfs/volumes.h | 2 ++ 2 files changed, 13 insertions(+), 11

[RFC PATCH v4 6/6] Btrfs: support swap files

2018-05-24 Thread Omar Sandoval
From: Omar Sandoval Implement the swap file a_ops on Btrfs. Activation needs to make sure that the file can be used as a swap file, which currently means it must be fully allocated as nocow with no compression on one device. It also sets up the swap extents directly with

[RFC PATCH v4 4/6] Btrfs: prevent ioctls from interfering with a swap file

2018-05-24 Thread Omar Sandoval
From: Omar Sandoval When a swap file is active, we must make sure that the extents of the file are not moved and that they don't become shared. That means that the following are not safe: - chattr +c (enable compression) - reflink - dedupe - snapshot - defrag - balance - device

[RFC PATCH v4 2/6] vfs: update swap_{,de}activate documentation

2018-05-24 Thread Omar Sandoval
From: Omar Sandoval The documentation for these functions is wrong in several ways: - swap_activate() is called with the inode locked - swap_activate() takes a swap_info_struct * and a sector_t * - swap_activate() can also return a positive number of extents it added itself -

[RFC PATCH v4 1/6] mm: split SWP_FILE into SWP_ACTIVATED and SWP_FS

2018-05-24 Thread Omar Sandoval
From: Omar Sandoval The SWP_FILE flag serves two purposes: to make swap_{read,write}page() go through the filesystem, and to make swapoff() call ->swap_deactivate(). For Btrfs, we want the latter but not the former, so split this flag into two. This makes us always call

[RFC PATCH v4 0/6] Btrfs: implement swap file support

2018-05-24 Thread Omar Sandoval
From: Omar Sandoval Hi, This patch series implements swap file support for Btrfs. If you don't remember versions 1-3, that's because they were almost 4 years ago [1] :) This attempt takes a very different approach from my original versions back then. As a refresher, the

[josef-btrfs:for-4.18/block 6/13] include/linux/blk-cgroup.h:832:13: error: 'blkcg_schedule_throttle' defined but not used

2018-05-24 Thread kbuild test robot
tree: https://git.kernel.org/pub/scm/linux/kernel/git/josef/btrfs-next.git for-4.18/block head: 657e770d4d6e3b03c3d4b96e427b30d6f766e2e2 commit: b5c78af7bc40baa7dd71d1b5fccb78ece59812ba [6/13] blkcg: add generic throttling mechanism config: sparc-defconfig (attached as .config) compiler:

[josef-btrfs:for-4.18/block 1/13] include/linux/bio.h:556:55: warning: 'struct blkcg_gq' declared inside parameter list

2018-05-24 Thread kbuild test robot
tree: https://git.kernel.org/pub/scm/linux/kernel/git/josef/btrfs-next.git for-4.18/block head: 657e770d4d6e3b03c3d4b96e427b30d6f766e2e2 commit: 03766852a022b0ff5f8c4b73f40ef205a36d095e [1/13] block: add bi_blkg to the bio for cgroups config: i386-randconfig-a0-201820 (attached as .config)

[josef-btrfs:for-4.18/block 6/13] include/linux/tracehook.h:195:2: error: implicit declaration of function 'blkcg_maybe_throttle_current'

2018-05-24 Thread kbuild test robot
tree: https://git.kernel.org/pub/scm/linux/kernel/git/josef/btrfs-next.git for-4.18/block head: 657e770d4d6e3b03c3d4b96e427b30d6f766e2e2 commit: b5c78af7bc40baa7dd71d1b5fccb78ece59812ba [6/13] blkcg: add generic throttling mechanism config: i386-randconfig-x000-201820 (attached as .config)

[josef-btrfs:blk-iolatency 7/13] mm/memory.c:2497:2: note: in expansion of macro 'if'

2018-05-24 Thread kbuild test robot
tree: https://git.kernel.org/pub/scm/linux/kernel/git/josef/btrfs-next.git blk-iolatency head: 657e770d4d6e3b03c3d4b96e427b30d6f766e2e2 commit: 90f955bbc57765617e3e99f784f3239c3d8f0360 [7/13] memcontrol: schedule throttling if we are congested config: x86_64-randconfig-x018-201820 (attached

[josef-btrfs:for-4.18/block 5/13] mm/page_io.c:346:12: error: 'io_cgrp_subsys' undeclared; did you mean 'pids_cgrp_subsys'?

2018-05-24 Thread kbuild test robot
tree: https://git.kernel.org/pub/scm/linux/kernel/git/josef/btrfs-next.git for-4.18/block head: 657e770d4d6e3b03c3d4b96e427b30d6f766e2e2 commit: 17842d132a0e6a079842f9843739aa6abec4e9ce [5/13] swap,blkcg: issue swap io with the appropriate context config: i386-randconfig-x016-201820

[josef-btrfs:for-4.18/block 5/13] mm/page_io.c:346:12: error: 'io_cgrp_subsys' undeclared; did you mean 'cgroup_subsys'?

2018-05-24 Thread kbuild test robot
tree: https://git.kernel.org/pub/scm/linux/kernel/git/josef/btrfs-next.git for-4.18/block head: 657e770d4d6e3b03c3d4b96e427b30d6f766e2e2 commit: 17842d132a0e6a079842f9843739aa6abec4e9ce [5/13] swap,blkcg: issue swap io with the appropriate context config: x86_64-randconfig-x017-201820

[josef-btrfs:blk-iolatency 8/13] mm/shmem.c:1222:10: error: implicit declaration of function 'mem_cgroup_try_charge_delay'; did you mean 'mem_cgroup_try_charge_swap'?

2018-05-24 Thread kbuild test robot
tree: https://git.kernel.org/pub/scm/linux/kernel/git/josef/btrfs-next.git blk-iolatency head: 657e770d4d6e3b03c3d4b96e427b30d6f766e2e2 commit: 7f1e4ea0a7071711f43deaed15b123bcf0a3ee8f [8/13] blk-stat: export helpers for modifying blk_rq_stat config: x86_64-randconfig-x011-201820 (attached

[josef-btrfs:blk-iolatency 1/13] include/linux/bio.h:556:55: warning: 'struct blkcg_gq' declared inside parameter list will not be visible outside of this definition or declaration

2018-05-24 Thread kbuild test robot
tree: https://git.kernel.org/pub/scm/linux/kernel/git/josef/btrfs-next.git blk-iolatency head: 657e770d4d6e3b03c3d4b96e427b30d6f766e2e2 commit: 03766852a022b0ff5f8c4b73f40ef205a36d095e [1/13] block: add bi_blkg to the bio for cgroups config: x86_64-randconfig-x011-201820 (attached as

[GIT PULL] Btrfs fix for 4.17-rc6

2018-05-24 Thread David Sterba
Hi, please consider pulling a fix for btrfs. This time it's really a one-liner and prevents leaking an internal error value 1 out of the ftruncate syscall. This has been observed in practice. The steps to reproduce make a common pattern (open/write/fync/ftruncate) but also need the application

Re: [PATCH v3 1/3] btrfs: Move btrfs_check_super_valid() to avoid forward declaration

2018-05-24 Thread David Sterba
On Fri, May 25, 2018 at 12:24:10AM +0800, Anand Jain wrote: > On misc-next this patch is causing regression, the seed sprout > functionality test [1] (in the mailing list) fails. This patch merly moves the function so it must have been broken before that already. > > + if

Re: [PATCH] Btrfs: fix memory and mount leak in btrfs_ioctl_rm_dev_v2()

2018-05-24 Thread David Sterba
On Tue, May 22, 2018 at 03:44:01PM -0700, Omar Sandoval wrote: > From: Omar Sandoval > > If we have invalid flags set, when we error out we must drop our writer > counter and free the buffer we allocated for the arguments. This bug is > trivially reproduced with the following

Re: [PATCH v3 0/4] btrfs: lzo: Harden decompression callers to avoid kernel memory corruption.

2018-05-24 Thread David Sterba
On Wed, May 23, 2018 at 04:22:57PM +0800, Qu Wenruo wrote: > James Harvey reported pretty strange kernel misbehavior where after > reading certain btrfs compressed data, kernel crash with unrelated > calltrace. > (https://bugzilla.kernel.org/show_bug.cgi?id=199707 and >

Re: [PATCH v2 3/4] btrfs: lzo: Add header length check to avoid slab out of bounds access

2018-05-24 Thread David Sterba
On Wed, May 23, 2018 at 07:38:28AM +0800, Qu Wenruo wrote: > >> --- a/fs/btrfs/lzo.c > >> +++ b/fs/btrfs/lzo.c > >> @@ -281,6 +281,7 @@ static int lzo_decompress_bio(struct list_head *ws, > >> struct compressed_bio *cb) > >>unsigned long working_bytes; > >>size_t in_len; > >>size_t

Re: [PATCH v3 1/3] btrfs: Move btrfs_check_super_valid() to avoid forward declaration

2018-05-24 Thread Anand Jain
On misc-next this patch is causing regression, the seed sprout functionality test [1] (in the mailing list) fails. [1] [PATCH] fstests: btrfs: add seed sprout functionality test more below.. On 05/11/2018 01:35 PM, Qu Wenruo wrote: Just move btrfs_check_super_valid() before its single

[PATCH] fstests: btrfs: add seed sprout functionality test

2018-05-24 Thread Anand Jain
Create a seed device and add the sprout device to it. Signed-off-by: Anand Jain --- common/config | 1 + tests/btrfs/161 | 69 + tests/btrfs/161.out | 2 ++ tests/btrfs/group | 1 + 4 files changed, 73

[RFC PATCH v3 6/9] mm/vmpressure: update usage of zone modifiers

2018-05-24 Thread Huaisheng Ye
From: Huaisheng Ye Use __GFP_ZONE_MOVABLE to replace (__GFP_HIGHMEM | __GFP_MOVABLE). ___GFP_DMA, ___GFP_HIGHMEM and ___GFP_DMA32 have been deleted from GFP bitmasks, the bottom three bits of GFP mask is reserved for storing encoded zone number. __GFP_ZONE_MOVABLE contains

Re: [RFC PATCH v2 00/12] get rid of GFP_ZONE_TABLE/BAD

2018-05-24 Thread Michal Hocko
On Thu 24-05-18 08:18:18, Matthew Wilcox wrote: > On Thu, May 24, 2018 at 02:23:23PM +0200, Michal Hocko wrote: > > > If we had eight ZONEs, we could offer: > > > > No, please no more zones. What we have is quite a maint. burden on its > > own. Ideally we should only have lowmem, highmem and

Re: [RFC PATCH v2 00/12] get rid of GFP_ZONE_TABLE/BAD

2018-05-24 Thread Matthew Wilcox
On Thu, May 24, 2018 at 02:23:23PM +0200, Michal Hocko wrote: > > If we had eight ZONEs, we could offer: > > No, please no more zones. What we have is quite a maint. burden on its > own. Ideally we should only have lowmem, highmem and special/device > zones for directly kernel accessible memory,

Re: [PATCH] Btrfs: implement unlocked buffered write

2018-05-24 Thread Chris Mason
On 24 May 2018, at 4:46, robbieko wrote: Chris Mason 於 2018-05-23 23:56 寫到: On 23 May 2018, at 3:26, robbieko wrote: But we're not avoiding the inode lock completely, we're just dropping it for the expensive parts of writing to the file. A quick guess about what the expensive parts are:

Re: [PATCH v4 1/3] btrfs: add helper function describe_block_group()

2018-05-24 Thread David Sterba
On Wed, May 23, 2018 at 02:35:06PM +0800, Anand Jain wrote: > Improve on describe_relocation() add a common helper function to describe > the block groups. > > Signed-off-by: Anand Jain > --- > v3->v4: Just pass full flag name in the define DESCRIBE_FLAG(flag,..), >

Re: [PATCH 1/4] btrfs: always wait on ordered extents at fsync time

2018-05-24 Thread Nikolay Borisov
On 24.05.2018 13:49, Filipe Manana wrote: > On Wed, May 23, 2018 at 4:58 PM, Josef Bacik wrote: >> From: Josef Bacik >> >> There's a priority inversion that exists currently with btrfs fsync. In >> some cases we will collect outstanding ordered extents

Re: [RFC PATCH v2 00/12] get rid of GFP_ZONE_TABLE/BAD

2018-05-24 Thread Michal Hocko
On Wed 23-05-18 22:19:19, Matthew Wilcox wrote: > On Tue, May 22, 2018 at 08:37:28PM +0200, Michal Hocko wrote: > > So why is this any better than the current code. Sure I am not a great > > fan of GFP_ZONE_TABLE because of how it is incomprehensible but this > > doesn't look too much better, yet

Re: [External] Re: [RFC PATCH v2 00/12] get rid of GFP_ZONE_TABLE/BAD

2018-05-24 Thread Michal Hocko
On Wed 23-05-18 16:07:16, Huaisheng HS1 Ye wrote: > From: Michal Hocko [mailto:mho...@kernel.org] > Sent: Wednesday, May 23, 2018 2:37 AM > > > > On Mon 21-05-18 23:20:21, Huaisheng Ye wrote: > > > From: Huaisheng Ye > > > > > > Replace GFP_ZONE_TABLE and GFP_ZONE_BAD with

Re: [PATCH v2] Btrfs: fix error handling in btrfs_truncate()

2018-05-24 Thread David Sterba
On Tue, May 22, 2018 at 10:48:38AM -0700, Omar Sandoval wrote: > On Tue, May 22, 2018 at 10:41:11AM -0700, Omar Sandoval wrote: > > On Tue, May 22, 2018 at 10:37:14AM -0700, Omar Sandoval wrote: > > > On Tue, May 22, 2018 at 07:17:48PM +0200, David Sterba wrote: > > > > On Tue, May 22, 2018 at

Re: [PATCH 1/4] btrfs: always wait on ordered extents at fsync time

2018-05-24 Thread Filipe Manana
On Wed, May 23, 2018 at 4:58 PM, Josef Bacik wrote: > From: Josef Bacik > > There's a priority inversion that exists currently with btrfs fsync. In > some cases we will collect outstanding ordered extents onto a list and > only wait on them at the very last

[PATCH V5 10/33] btrfs: use segment_last_page to get bio's last page

2018-05-24 Thread Ming Lei
Preparing for supporting multipage bvec. Cc: Chris Mason Cc: Josef Bacik Cc: David Sterba Cc: linux-btrfs@vger.kernel.org Signed-off-by: Ming Lei --- fs/btrfs/compression.c | 5 - fs/btrfs/extent_io.c | 5 +++-- 2 files

Re: [PATCH] Btrfs: implement unlocked buffered write

2018-05-24 Thread robbieko
Chris Mason 於 2018-05-23 23:56 寫到: On 23 May 2018, at 3:26, robbieko wrote: Chris Mason 於 2018-05-23 02:31 寫到: On 22 May 2018, at 14:08, Christoph Hellwig wrote: On Wed, May 16, 2018 at 11:52:37AM +0800, robbieko wrote: From: Robbie Ko This idea is from direct io.