Re: btrfs device replace can cause silent or noisy corruption on compressed NOCOW/NODATASUM

2018-05-30 Thread Qu Wenruo
On 2018年05月17日 17:46, james harvey wrote: > Looks like Qu may have taken care of corrupted compressed data with > NODATASUM from causing causing random kernel memory corruption. > > As long as the compressed data was valid and could be uncompressed, > there were no problems, even on data marked

Re: [PATCH] Btrfs: checking for NULL instead of IS_ERR

2018-05-30 Thread Misono Tomohiro
Thanks again. David, could you apply this on top of my v7 patch in for-next tree? Regards, Tomohiro Misono On 2018/05/31 15:21, Dan Carpenter wrote: > memdup_user() returns error pointers, it doesn't return NULL. > > Fixes: 01141b08dee5 ("btrfs: Add unprivileged ioctl which returns subvolume's

[PATCH] Btrfs: checking for NULL instead of IS_ERR

2018-05-30 Thread Dan Carpenter
memdup_user() returns error pointers, it doesn't return NULL. Fixes: 01141b08dee5 ("btrfs: Add unprivileged ioctl which returns subvolume's ROOT_REF") Signed-off-by: Dan Carpenter diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index ff5018587bd9..d8dd4504bdab 100644 --- a/fs/btrfs/ioctl.c +++

[PATCH v8 3/3] btrfs: Add unprivileged version of ino_lookup ioctl

2018-05-30 Thread Misono Tomohiro
Add unprivileged version of ino_lookup ioctl BTRFS_IOC_INO_LOOKUP_USER to allow normal users to call "btrfs subvolume list/show" etc. in combination with BTRFS_IOC_GET_SUBVOL_INFO/BTRFS_IOC_GET_SUBVOL_ROOTREF. This can be used like BTRFS_IOC_INO_LOOKUP but the argument is different. This is becau

Re: [bug report] btrfs: Add unprivileged version of ino_lookup ioctl

2018-05-30 Thread Misono Tomohiro
Thanks for the reporting. I will update the patch. Regards, Tomohiro Misono On 2018/05/30 19:19, Dan Carpenter wrote: > Hello Tomohiro Misono, > > The patch 56bfce6502b7: "btrfs: Add unprivileged version of > ino_lookup ioctl" from May 16, 2018, leads to the following static > checker warning: >

Re: [PATCH v2] btrfs: returns -ENOMEM if path allocation failed in btrfs_cross_ref_exist()

2018-05-30 Thread Su Yue
On 05/30/2018 11:33 PM, David Sterba wrote: > On Wed, May 30, 2018 at 02:49:10PM +0800, Su Yue wrote: >> btrfs_alloc_path() may fail due to no enough memory, >> so let the function return -ENOMEM instead of -ENOENT is better. >> >> Signed-off-by: Su Yue > > Reviewed-by: David Sterba > > Thank

Re: [PATCH 2/2] btrfs: Refactor running of delayed inode items during transaction commit

2018-05-30 Thread Nikolay Borisov
On 28.05.2018 19:12, David Sterba wrote: > On Mon, May 28, 2018 at 03:26:58PM +0300, Nikolay Borisov wrote: >> dmesg looks like: >> [6.649213] WARNING: CPU: 0 PID: 2838 at fs/btrfs/transaction.c:303 >> record_root_in_trans+0x38/0xd0 > > Found in the logs. I reported it to the p

Re: [PATCH] Btrfs: clean up error handling in btrfs_truncate()

2018-05-30 Thread David Sterba
On Tue, May 29, 2018 at 12:24:31PM -0700, Omar Sandoval wrote: > On Tue, May 22, 2018 at 09:59:50AM -0700, Omar Sandoval wrote: > > From: Omar Sandoval > > > > btrfs_truncate() uses two variables for error handling, ret and err (if > > this sounds familiar, it's because btrfs_truncate_inode_items

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

2018-05-30 Thread kbuild test robot
tree: https://git.kernel.org/pub/scm/linux/kernel/git/josef/btrfs-next.git blk-iolatency head: 6fd950dfd5f71e7eba6d0763c6861669cec7963f commit: f624090ed7dadc44d46a8a0b4381ab286c9f45fb [12/13] block: introduce blk-iolatency io controller config: i386-allyesconfig (attached as .config) compile

Re: [PATCH v3 1/2] btrfs: Factor out read portion of btrfs_get_blocks_direct

2018-05-30 Thread David Sterba
On Wed, May 02, 2018 at 03:19:32PM +0300, Nikolay Borisov wrote: > Currently this function handles both the READ and WRITE dio cases. This > is facilitated by a bunch of 'if' statements, a goto short-circuit > statement and a very perverse aliasing of "!created"(READ) case > by setting lockstart =

Re: [PATCH v2] btrfs: returns -ENOMEM if path allocation failed in btrfs_cross_ref_exist()

2018-05-30 Thread David Sterba
On Wed, May 30, 2018 at 02:49:10PM +0800, Su Yue wrote: > btrfs_alloc_path() may fail due to no enough memory, > so let the function return -ENOMEM instead of -ENOENT is better. > > Signed-off-by: Su Yue Reviewed-by: David Sterba Thanks. I've audited all return codes after failed path allocati

Re: [PATCH] btrfs: return error value if create_io_em() failed in cow_file_range()

2018-05-30 Thread David Sterba
On Wed, May 30, 2018 at 04:48:56PM +0800, Su Yue wrote: > In cow_file_range(), create_io_em() may fail, but its return value is > not recorded. > Then return value may be 0 even it failed which is a wrong behavior. > > Let cow_file_range() return PTR_ERR(em) if create_io_em() failed. > > Signed-o

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

2018-05-30 Thread David Sterba
On Wed, May 30, 2018 at 12:58:24PM +0800, Qu Wenruo wrote: > > Reported-by: James Harvey > Signed-off-by: Qu Wenruo > --- > changelog: > v3->v4: Patch replaced, thanks. -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majord...@vger.kernel.or

Re: [PATCH 1/2] btrfs: drop unused parameter qgroup_reserved

2018-05-30 Thread David Sterba
On Wed, May 30, 2018 at 11:00:38AM +0800, Gu Jinxiang wrote: > From: Gu JinXiang > > Since commit 7775c8184ec0 > ("btrfs: remove unused parameter from btrfs_subvolume_release_metadata") > parameter qgroup_reserved is not used by caller > of function btrfs_subvolume_reserve_metadata. > So remove i

[bug report] btrfs: Add unprivileged version of ino_lookup ioctl

2018-05-30 Thread Dan Carpenter
Hello Tomohiro Misono, The patch 56bfce6502b7: "btrfs: Add unprivileged version of ino_lookup ioctl" from May 16, 2018, leads to the following static checker warning: fs/btrfs/ioctl.c:2478 btrfs_search_path_in_tree_user() error: 'temp_inode' dereferencing possible ERR_PTR() fs/bt

Re: [PATCH] btrfs: return error value if create_io_em() failed in cow_file_range()

2018-05-30 Thread Nikolay Borisov
On 30.05.2018 11:48, Su Yue wrote: > In cow_file_range(), create_io_em() may fail, but its return value is > not recorded. > Then return value may be 0 even it failed which is a wrong behavior. > > Let cow_file_range() return PTR_ERR(em) if create_io_em() failed. > > Signed-off-by: Su Yue Re

[PATCH] btrfs: return error value if create_io_em() failed in cow_file_range()

2018-05-30 Thread Su Yue
In cow_file_range(), create_io_em() may fail, but its return value is not recorded. Then return value may be 0 even it failed which is a wrong behavior. Let cow_file_range() return PTR_ERR(em) if create_io_em() failed. Signed-off-by: Su Yue --- fs/btrfs/inode.c | 4 +++- 1 file changed, 3 inser

Re: [PATCH v2 2/2] btrfs-progs: ins: dump-tree: Print tree name for extent data/tree block backref

2018-05-30 Thread Nikolay Borisov
On 30.05.2018 10:25, Misono Tomohiro wrote: > Print tree name instead of number to make output more readable. > > Example: > [before] >extent data backref root 5 objectid 257 offset 16384 count 1 > >tree block backref root 18446744073709551607 > > [after] >extent data backref r

[PATCH v2 2/2] btrfs-progs: ins: dump-tree: Print tree name for extent data/tree block backref

2018-05-30 Thread Misono Tomohiro
Print tree name instead of number to make output more readable. Example: [before] extent data backref root 5 objectid 257 offset 16384 count 1 tree block backref root 18446744073709551607 [after] extent data backref root FS_TREE objectid 257 offset 16384 count 1 tree block bac

Re: [PATCH REBASED 2/2] btrfs: Delayed empty block group auto removal to next transaction

2018-05-30 Thread Qu Wenruo
On 2018年05月30日 15:01, Nikolay Borisov wrote: > > > On 30.05.2018 07:40, Qu Wenruo wrote: >> Under certain KVM load and LTP tests, we are possible to hit the >> following calltrace if quota is enabled: >> -- >> BTRFS critical (device vda2): unable to find logical 8820195328 length 4096 >> B

Re: [PATCH 6/6] btrfs: rename btrfs_free_stale_devices drop btrfs prefix

2018-05-30 Thread Nikolay Borisov
On 30.05.2018 09:58, Anand Jain wrote: > btrfs_free_stale_devices() is a static function drop the btrfs prefix. > > Signed-off-by: Anand Jain Nit: I think this patch could be dropped, it's not a set-in-stone rule that static function shouldn't have btrfs_ prefix. Personally, I'd prefer all su

Re: [PATCH REBASED 2/2] btrfs: Delayed empty block group auto removal to next transaction

2018-05-30 Thread Nikolay Borisov
On 30.05.2018 07:40, Qu Wenruo wrote: > Under certain KVM load and LTP tests, we are possible to hit the > following calltrace if quota is enabled: > -- > BTRFS critical (device vda2): unable to find logical 8820195328 length 4096 > BTRFS critical (device vda2): unable to find logical 882019

Re: [PATCH 2/2] btrfs-progs: ins: dump-tree: Print tree name for tree block backref

2018-05-30 Thread Nikolay Borisov
On 30.05.2018 09:55, Misono Tomohiro wrote: > On 2018/05/30 15:28, Nikolay Borisov wrote: >> >> >> On 30.05.2018 07:55, Misono Tomohiro wrote: >>> Print tree name instead of number to make output more readable. >>> >>> Signed-off-by: Misono Tomohiro >>> --- >>> print-tree.c | 5 +++-- >>> 1 fi