Re: [PATCH v2 0/6] btrfs: qgroup: Delay subtree scan to reduce overhead

2018-11-14 Thread Qu Wenruo
On 2018/11/15 上午3:05, David Sterba wrote: > On Tue, Nov 13, 2018 at 05:58:14PM +, Filipe Manana wrote: >> That's the infinite loop issue fixed by one of the patches submitted >> for 4.20-rc2: >> >> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?h=v4.20-rc2&id=11023

Re: [PATCH RFC] btrfs: harden agaist duplicate fsid

2018-11-14 Thread Anand Jain
On 11/13/2018 11:47 PM, Anand Jain wrote: On 11/13/2018 11:31 PM, David Sterba wrote: On Mon, Oct 01, 2018 at 09:31:04PM +0800, Anand Jain wrote: +    /* + * we are going to replace the device path, make sure its the + * same device if the device mounted + */ + 

Re: [PATCH 0/6] btrfs: fix compiler warning with make W=1

2018-11-14 Thread Qu Wenruo
On 2018/11/14 下午9:35, Johannes Thumshirn wrote: > This patchset fixes most of the compiler warnings encountered when building > btrfs with make W=1. > > There are two more compiler warnings left in raid56.c: > CC [M] fs/btrfs/raid56.o > fs/btrfs/raid56.c: In function ‘finish_rmw’: > fs/btrfs/

Re: [PATCH] btrfs: Fix suspicious RCU usage warning in device_list_add

2018-11-14 Thread Lu Fengqi
On Wed, Nov 14, 2018 at 05:05:48PM +0100, David Sterba wrote: >On Wed, Nov 14, 2018 at 03:24:56PM +0800, Lu Fengqi wrote: >> = >> WARNING: suspicious RCU usage >> 4.20.0-rc2+ #23 Tainted: G O >> - >> fs/btrfs/volumes.c:886 suspicious

Re: [PATCH 6/6] btrfs: unconditionally provide function prototypes from free-space-tree.h

2018-11-14 Thread David Sterba
On Wed, Nov 14, 2018 at 11:05:16PM +0200, Nikolay Borisov wrote: > > > On 14.11.18 г. 21:53 ч., David Sterba wrote: > > On Wed, Nov 14, 2018 at 02:54:37PM +0100, Johannes Thumshirn wrote: > >> On 14/11/2018 14:52, Nikolay Borisov wrote: > >>> I agree with this patch, however you go into the gray

Re: [PATCH 5/6] btrfs: remove unused variable tree in end_compressed_bio_write()

2018-11-14 Thread David Sterba
On Wed, Nov 14, 2018 at 02:35:19PM +0100, Johannes Thumshirn wrote: > Commit 2922040236f9 (btrfs: Remove extent_io_ops::writepage_end_io_hook) > removed the indirection to extent_io_ops::writepage_end_io_hook but didn't > remove the tree variable which then became unused. > > Remove 'tree' as well

Re: [PATCH 6/6] btrfs: unconditionally provide function prototypes from free-space-tree.h

2018-11-14 Thread Nikolay Borisov
On 14.11.18 г. 21:53 ч., David Sterba wrote: > On Wed, Nov 14, 2018 at 02:54:37PM +0100, Johannes Thumshirn wrote: >> On 14/11/2018 14:52, Nikolay Borisov wrote: >>> I agree with this patch, however you go into the gray area of >>> "everything which is exported should have btrfs_ prefix". It's u

Re: [PATCH 6/6] btrfs: unconditionally provide function prototypes from free-space-tree.h

2018-11-14 Thread David Sterba
On Wed, Nov 14, 2018 at 02:54:37PM +0100, Johannes Thumshirn wrote: > On 14/11/2018 14:52, Nikolay Borisov wrote: > > I agree with this patch, however you go into the gray area of > > "everything which is exported should have btrfs_ prefix". It's up to > > David to see if he is content with this ch

Re: [PATCH 5/6] btrfs: remove unused variable tree in end_compressed_bio_write()

2018-11-14 Thread Omar Sandoval
On Wed, Nov 14, 2018 at 02:35:19PM +0100, Johannes Thumshirn wrote: > Commit 2922040236f9 (btrfs: Remove extent_io_ops::writepage_end_io_hook) > removed the indirection to extent_io_ops::writepage_end_io_hook but didn't > remove the tree variable which then became unused. > > Remove 'tree' as well

Re: [PATCH 4/6] btrfs: remove unused variable tree in bio_readpage_error()

2018-11-14 Thread Omar Sandoval
On Wed, Nov 14, 2018 at 02:35:18PM +0100, Johannes Thumshirn wrote: > Commit 2922040236f9 (btrfs: Remove extent_io_ops::writepage_end_io_hook) > removed the indirection to extent_io_ops::writepage_end_io_hook but didn't > remove the tree variable which then became unused. > > Remove 'tree' as well

Re: [PATCH 3/6] btrfs: remove unused function btrfs_sysfs_feature_update()

2018-11-14 Thread Omar Sandoval
On Wed, Nov 14, 2018 at 02:35:17PM +0100, Johannes Thumshirn wrote: > btrfs_sysfs_feature_update() was introduced with commit 444e75169872 (btrfs: > sysfs: introduce helper for syncing bits with sysfs files) to provide a helper > which was used in 14e46e04958d (btrfs: synchronize incompat feature b

Re: [PATCH 1/6] btrfs: remove unused drop_on_err in btrfs_mkdir()

2018-11-14 Thread Omar Sandoval
On Wed, Nov 14, 2018 at 02:35:15PM +0100, Johannes Thumshirn wrote: > Up to commit 32955c5422a8 (btrfs: switch to discard_new_inode()) the > drop_on_err variable in btrfs_mkdir() was used to check whether the inode had > to be dropped via iput(). > > After commit 32955c5422a8 (btrfs: switch to dis

Re: [PATCH v2 0/6] btrfs: qgroup: Delay subtree scan to reduce overhead

2018-11-14 Thread David Sterba
On Tue, Nov 13, 2018 at 05:58:14PM +, Filipe Manana wrote: > That's the infinite loop issue fixed by one of the patches submitted > for 4.20-rc2: > > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?h=v4.20-rc2&id=11023d3f5fdf89bba5e1142127701ca6e6014587 > > The bran

[PATCH] btrfs: test send after radical changes in a complex directory hierarchy

2018-11-14 Thread fdmanana
From: Filipe Manana Test an incremental send operation in a scenario where the relationship of ancestor-descendant between multiple directories is inversed, and where multiple directories that were previously ancestors of another directory now become descendents of multiple directories that used

[PATCH] Btrfs: send, fix infinite loop due to directory rename dependencies

2018-11-14 Thread fdmanana
From: Robbie Ko When doing an incremental send, due to the need of delaying directory move (rename) operations we can end up in infinite loop at apply_children_dir_moves(). An example scenario that triggers this problem is described below, where directory names correspond to the numbers of their

Re: [PATCH] Btrfs: ensure path name is null terminated at btrfs_control_ioctl

2018-11-14 Thread David Sterba
On Wed, Nov 14, 2018 at 11:35:24AM +, fdman...@kernel.org wrote: > From: Filipe Manana > > We were using the path name received from user space without checking that > it is null terminated. While btrfs-progs is well behaved and does proper > validation and null termination, someone could cal

Re: [PATCH] btrfs: Fix suspicious RCU usage warning in device_list_add

2018-11-14 Thread David Sterba
On Wed, Nov 14, 2018 at 03:24:56PM +0800, Lu Fengqi wrote: > = > WARNING: suspicious RCU usage > 4.20.0-rc2+ #23 Tainted: G O > - > fs/btrfs/volumes.c:886 suspicious rcu_dereference_check() usage! > > Use btrfs_info_in_rcu instead o

Re: [PATCH 6/6] btrfs: unconditionally provide function prototypes from free-space-tree.h

2018-11-14 Thread Johannes Thumshirn
On 14/11/2018 14:52, Nikolay Borisov wrote: > > I agree with this patch, however you go into the gray area of > "everything which is exported should have btrfs_ prefix". It's up to > David to see if he is content with this change. Yep you're right. I think I should change it, but I'll wait for Da

Re: [PATCH 6/6] btrfs: unconditionally provide function prototypes from free-space-tree.h

2018-11-14 Thread Nikolay Borisov
On 14.11.18 г. 15:35 ч., Johannes Thumshirn wrote: > Currently the function prototypes of: > * search_free_space_info() > * convert_free_space_to_bitmaps() > * convert_free_space_to_extents() > * free_space_test_bit() > * __remove_from_free_space_tree() > * __add_to_free_space_tree() > are hidde

Re: [PATCH 2/6] btrfs: remove set but not used variable err in btrfs_add_link

2018-11-14 Thread Nikolay Borisov
On 14.11.18 г. 15:35 ч., Johannes Thumshirn wrote: > err holds the return value of either btrfs_del_root_ref() or > btrfs_del_inode_ref() but it hasn't been checked since it's introduction with > commit fe66a05a0679 (Btrfs: improve error handling for btrfs_insert_dir_item > callers) in 2012. >

Re: [PATCH 0/6] btrfs: fix compiler warning with make W=1

2018-11-14 Thread Nikolay Borisov
On 14.11.18 г. 15:35 ч., Johannes Thumshirn wrote: > This patchset fixes most of the compiler warnings encountered when building > btrfs with make W=1. > > There are two more compiler warnings left in raid56.c: > CC [M] fs/btrfs/raid56.o > fs/btrfs/raid56.c: In function ‘finish_rmw’: > fs/bt

[PATCH 0/6] btrfs: fix compiler warning with make W=1

2018-11-14 Thread Johannes Thumshirn
This patchset fixes most of the compiler warnings encountered when building btrfs with make W=1. There are two more compiler warnings left in raid56.c: CC [M] fs/btrfs/raid56.o fs/btrfs/raid56.c: In function ‘finish_rmw’: fs/btrfs/raid56.c:1185:6: warning: variable ‘p_stripe’ set but not used

[PATCH 6/6] btrfs: unconditionally provide function prototypes from free-space-tree.h

2018-11-14 Thread Johannes Thumshirn
Currently the function prototypes of: * search_free_space_info() * convert_free_space_to_bitmaps() * convert_free_space_to_extents() * free_space_test_bit() * __remove_from_free_space_tree() * __add_to_free_space_tree() are hidden behind CONFIG_BTRFS_FS_RUN_SANITY_TESTS. If CONFIG_BTRFS_FS_RUN_SAN

[PATCH 4/6] btrfs: remove unused variable tree in bio_readpage_error()

2018-11-14 Thread Johannes Thumshirn
Commit 2922040236f9 (btrfs: Remove extent_io_ops::writepage_end_io_hook) removed the indirection to extent_io_ops::writepage_end_io_hook but didn't remove the tree variable which then became unused. Remove 'tree' as well to silence the warning when -Wunused-but-set-variable is used to compile btrf

[PATCH 2/6] btrfs: remove set but not used variable err in btrfs_add_link

2018-11-14 Thread Johannes Thumshirn
err holds the return value of either btrfs_del_root_ref() or btrfs_del_inode_ref() but it hasn't been checked since it's introduction with commit fe66a05a0679 (Btrfs: improve error handling for btrfs_insert_dir_item callers) in 2012. As the error value hasn't been of any interest for 6 years we ca

[PATCH 3/6] btrfs: remove unused function btrfs_sysfs_feature_update()

2018-11-14 Thread Johannes Thumshirn
btrfs_sysfs_feature_update() was introduced with commit 444e75169872 (btrfs: sysfs: introduce helper for syncing bits with sysfs files) to provide a helper which was used in 14e46e04958d (btrfs: synchronize incompat feature bits with sysfs files). But commit e410e34fad91 (Revert "btrfs: synchroniz

[PATCH 5/6] btrfs: remove unused variable tree in end_compressed_bio_write()

2018-11-14 Thread Johannes Thumshirn
Commit 2922040236f9 (btrfs: Remove extent_io_ops::writepage_end_io_hook) removed the indirection to extent_io_ops::writepage_end_io_hook but didn't remove the tree variable which then became unused. Remove 'tree' as well to silence the warning when -Wunused-but-set-variable is used to compile btrf

[PATCH 1/6] btrfs: remove unused drop_on_err in btrfs_mkdir()

2018-11-14 Thread Johannes Thumshirn
Up to commit 32955c5422a8 (btrfs: switch to discard_new_inode()) the drop_on_err variable in btrfs_mkdir() was used to check whether the inode had to be dropped via iput(). After commit 32955c5422a8 (btrfs: switch to discard_new_inode()) discard_new_inode() is called when err is set and inode is n

Re: [PATCH] btrfs: introduce feature to forget a btrfs device

2018-11-14 Thread Anand Jain
On 11/14/2018 07:28 PM, Filipe Manana wrote: On Wed, Nov 14, 2018 at 11:15 AM Filipe Manana wrote: On Wed, Nov 14, 2018 at 9:14 AM Anand Jain wrote: Support for a new command 'btrfs dev forget [dev]' is proposed here to undo the effects of 'btrfs dev scan [dev]'. For this purpose this pa

Re: [PATCH] btrfs: introduce feature to forget a btrfs device

2018-11-14 Thread Anand Jain
On 11/14/2018 07:15 PM, Filipe Manana wrote: On Wed, Nov 14, 2018 at 9:14 AM Anand Jain wrote: Support for a new command 'btrfs dev forget [dev]' is proposed here to undo the effects of 'btrfs dev scan [dev]'. For this purpose this patch proposes to use ioctl #5 as it was empty. IO

Re: [PATCH] Btrfs: ensure path name is null terminated at btrfs_control_ioctl

2018-11-14 Thread Anand Jain
On 11/14/2018 07:35 PM, fdman...@kernel.org wrote: From: Filipe Manana We were using the path name received from user space without checking that it is null terminated. While btrfs-progs is well behaved and does proper validation and null termination, someone could call the ioctl and pass a

Re: [PATCH] btrfs: Fix suspicious RCU usage warning in device_list_add

2018-11-14 Thread Anand Jain
On 11/14/2018 03:24 PM, Lu Fengqi wrote: = WARNING: suspicious RCU usage 4.20.0-rc2+ #23 Tainted: G O - fs/btrfs/volumes.c:886 suspicious rcu_dereference_check() usage! Use btrfs_info_in_rcu instead of pr_info for the required

[PATCH v5 3/3] btrfs: balance: add kernel log for end or paused

2018-11-14 Thread Anand Jain
Add a kernel log when the balance ends, either for cancel or completed or if it is paused. Signed-off-by: Anand Jain --- v4->v5: nothing. v3->v4: nothing. v2->v3: nothing. v1->v2: Moved from 2/3 to 3/3 fs/btrfs/volumes.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a/fs/btrfs/volumes

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

2018-11-14 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 -dusage=50,limit=10..2

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

2018-11-14 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.1->v5: Initialize buf[128] to null. v4->v4.1: Use strcpy(buf, "|NONE"); as in the original v3->v4: Just pass full flag name in the define DESCRIB

[PATCH v5 0/3] btrfs: balance: improve kernel logs

2018-11-14 Thread Anand Jain
v4->v5: Mainly address David review comment [1]. [1] https://patchwork.kernel.org/patch/10425987/ pls ref to individual patch 2/3 for details. v3->v4: Pls ref to individual patches. Based on misc-next. v2->v3: Inspried by describe_relocation(), improves it, makes it a helper function a

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

2018-11-14 Thread Anand Jain
On 05/31/2018 05:47 PM, David Sterba wrote: On Fri, May 25, 2018 at 11:05:47AM +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 -f -mprofiles=raid1,convert=single,s

[PATCH] Btrfs: ensure path name is null terminated at btrfs_control_ioctl

2018-11-14 Thread fdmanana
From: Filipe Manana We were using the path name received from user space without checking that it is null terminated. While btrfs-progs is well behaved and does proper validation and null termination, someone could call the ioctl and pass a non-null terminated patch, leading to buffer overrun pro

Re: [PATCH] btrfs: introduce feature to forget a btrfs device

2018-11-14 Thread Filipe Manana
On Wed, Nov 14, 2018 at 11:15 AM Filipe Manana wrote: > > On Wed, Nov 14, 2018 at 9:14 AM Anand Jain wrote: > > > > Support for a new command 'btrfs dev forget [dev]' is proposed here > > to undo the effects of 'btrfs dev scan [dev]'. For this purpose > > this patch proposes to use ioctl #5 as it

Re: [PATCH] btrfs: introduce feature to forget a btrfs device

2018-11-14 Thread Filipe Manana
On Wed, Nov 14, 2018 at 9:14 AM Anand Jain wrote: > > Support for a new command 'btrfs dev forget [dev]' is proposed here > to undo the effects of 'btrfs dev scan [dev]'. For this purpose > this patch proposes to use ioctl #5 as it was empty. > IOW(BTRFS_IOCTL_MAGIC, 5, ..) > This patch ad

[PATCH] btrfs-progs: add cli to forget one or all scanned devices

2018-11-14 Thread Anand Jain
This patch adds cli btrfs device forget [dev] to remove the given device structure in the kernel if the device is unmounted. If no argument is given it shall remove all stale (device which are not mounted) from the kernel. Signed-off-by: Anand Jain Reviewed-by: Nikolay Borisov --- cmds-device

[PATCH RESEND v11] Add cli and ioctl to forget scanned device(s)

2018-11-14 Thread Anand Jain
v11: btrfs-progs: Bring the code into the else part of if(forget). Use strerror to print the erorr instead of ret. v10: Make btrfs-progs changes more readable. With an effort to keep the known bug [1] as it is.. [1] The cli 'btrfs device scan --all /dev/sdb' which should have

[PATCH] btrfs: introduce feature to forget a btrfs device

2018-11-14 Thread Anand Jain
Support for a new command 'btrfs dev forget [dev]' is proposed here to undo the effects of 'btrfs dev scan [dev]'. For this purpose this patch proposes to use ioctl #5 as it was empty. IOW(BTRFS_IOCTL_MAGIC, 5, ..) This patch adds new ioctl BTRFS_IOC_FORGET_DEV which can be sent from the /d