Re: [PATCH] btrfs: Allow non-privileged user to delete empty subvolume by default

2018-03-22 Thread Misono Tomohiro
On 2018/03/21 16:46, Nikolay Borisov wrote: > > > On 20.03.2018 22:06, Goffredo Baroncelli wrote: >> On 03/20/2018 07:45 AM, Misono, Tomohiro wrote: >>> Deletion of subvolume by non-privileged user is completely restricted >>> by default because we can delete a subvolume even if it is not empty >

[PATCH v2] btrfs: Validate child tree block's level and first key

2018-03-22 Thread Qu Wenruo
We have several reports about node pointer points to incorrect child tree blocks, which could have even wrong owner and level but still with valid generation and checksum. Although btrfs check could handle it and print error message like: leaf parent key incorrect 60670574592 Kernel doesn't have

Status of host managed SMR device support

2018-03-22 Thread Mason Fan
Hi all, I read from a SNIA's slide that btrfs will support host managed SMR device natively, and also saw it in "Features Currently in Development or Planned for Future Implementation" on the wiki. Does anyone know any further information? Like the schedule? Thanks. -- To unsubscribe from this l

[no subject]

2018-03-22 Thread Mason Fan
Hi all, I read from a SNIA's slide that btrfs will support host managed SMR device natively, and also saw it in "Features Currently in Development or Planned for Future Implementation" on the wiki. Does anyone know any further information? Like the schedule? Thanks. -- To unsubscribe from this l

Re: Status of RAID5/6

2018-03-22 Thread waxhead
Liu Bo wrote: On Wed, Mar 21, 2018 at 9:50 AM, Menion wrote: Hi all I am trying to understand the status of RAID5/6 in BTRFS I know that there are some discussion ongoing on the RFC patch proposed by Liu bo But it seems that everything stopped last summary. Also it mentioned about a "separate d

Re: [PATCH] btrfs: Allow non-privileged user to delete empty subvolume by default

2018-03-22 Thread Goffredo Baroncelli
On 03/22/2018 01:15 PM, Austin S. Hemmelgarn wrote: > On 2018-03-21 16:38, Goffredo Baroncelli wrote: >> On 03/21/2018 12:47 PM, Austin S. Hemmelgarn wrote: >>> I agree as well, with the addendum that I'd love to see a new ioctl that >>> does proper permissions checks.  While letting rmdir(2) work

Re: [PATCH v5 0/2] Remove false-positive VLAs when using max()

2018-03-22 Thread Linus Torvalds
On Thu, Mar 22, 2018 at 8:01 AM, Kees Cook wrote: > > Seems like it doesn't like void * arguments: Yeah, that was discussed separately, I just didn't realize we had any such users. As David said, just adding a (long) cast to it should be fine, ie #define __is_constant(a) \ (sizeof(in

Next btrfs development cycle open - 4.18

2018-03-22 Thread David Sterba
Hi, a friendly reminder of the timetable and what's expected at this phase. 4.15 - current 4.16 - upcoming, urgent regression fixes only 4.17 - development closed, pull request in prep, fixes or regressions only 4.18 - development open, until 4.17-rc5 (at least) (https://btrfs.wiki.kernel.org/in

Re: [PATCH] Btrfs: delete dead code in btrfs_orphan_add()

2018-03-22 Thread David Sterba
On Fri, Jan 26, 2018 at 12:54:38PM +0200, Nikolay Borisov wrote: > > > On 26.01.2018 01:56, Omar Sandoval wrote: > > From: Omar Sandoval > > > > btrfs_orphan_add() has had this case commented out since it was first > > introduced in commit d68fc57b7e32 ("Btrfs: Metadata reservation for > > orph

Re: [PATCH] btrfs: ctree.h: Fix wrong comment position about csum size

2018-03-22 Thread David Sterba
On Tue, Mar 20, 2018 at 04:50:32PM +0800, Qu Wenruo wrote: > > > On 2018年03月20日 14:47, Misono, Tomohiro wrote: > > > > Signed-off-by: Tomohiro Misono > > Reviewed-by: Qu Wenruo Added to next, thanks. -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a m

Re: [PATCH 2/2] btrfs: defer adding raid type kobject until after chunk relocation

2018-03-22 Thread David Sterba
On Wed, Mar 21, 2018 at 08:44:58AM +0200, Nikolay Borisov wrote: > > > On 20.03.2018 21:25, je...@suse.com wrote: > > From: Jeff Mahoney > > > > Any time the first block group of a new type is created, we add a new > > kobject to sysfs to hold the attributes for that type. Kobject-internal > >

RE: [PATCH v5 0/2] Remove false-positive VLAs when using max()

2018-03-22 Thread David Laight
From: Kees Cook > Sent: 22 March 2018 15:01 ... > > /* Glory to Martin Uecker */ > > #define __is_constant(a) \ > > (sizeof(int) == sizeof(*(1 ? ((void*)((a) * 0l)) : (int*)1))) ... > So, this time it's not a catastrophic failure with gcc 4.4. Instead it > fails in 11 distinct places:

Re: [PATCH v5 0/2] Remove false-positive VLAs when using max()

2018-03-22 Thread Kees Cook
On Tue, Mar 20, 2018 at 4:23 PM, Linus Torvalds wrote: > On Sat, Mar 17, 2018 at 1:07 PM, Kees Cook wrote: >> >> No luck! :( gcc 4.4 refuses to play along. And, hilariously, not only >> does it not change the complaint about __builtin_choose_expr(), it >> also thinks that's a VLA now. > > Hmm. So

Re: [PATCH] btrfs: Validate child tree block's level and first key

2018-03-22 Thread Nikolay Borisov
On 22.03.2018 16:26, Qu Wenruo wrote: > > > On 2018年03月22日 22:20, Nikolay Borisov wrote: >> >> >> On 22.03.2018 16:17, Qu Wenruo wrote: >>> >>> >>> On 2018年03月22日 22:00, David Sterba wrote: On Thu, Mar 22, 2018 at 09:53:46PM +0800, Qu Wenruo wrote: >>> diff --git a/fs/btrfs/backref.c b

Re: [PATCH] btrfs: Validate child tree block's level and first key

2018-03-22 Thread Qu Wenruo
On 2018年03月22日 22:20, Nikolay Borisov wrote: > > > On 22.03.2018 16:17, Qu Wenruo wrote: >> >> >> On 2018年03月22日 22:00, David Sterba wrote: >>> On Thu, Mar 22, 2018 at 09:53:46PM +0800, Qu Wenruo wrote: >> diff --git a/fs/btrfs/backref.c b/fs/btrfs/backref.c >> index 26484648d090..3866b

Re: [PATCH] btrfs: Validate child tree block's level and first key

2018-03-22 Thread Nikolay Borisov
On 22.03.2018 16:17, Qu Wenruo wrote: > > > On 2018年03月22日 22:00, David Sterba wrote: >> On Thu, Mar 22, 2018 at 09:53:46PM +0800, Qu Wenruo wrote: > diff --git a/fs/btrfs/backref.c b/fs/btrfs/backref.c > index 26484648d090..3866b8ab20f1 100644 > --- a/fs/btrfs/backref.c > +++ b

Re: [PATCH] btrfs: Validate child tree block's level and first key

2018-03-22 Thread Qu Wenruo
On 2018年03月22日 22:00, David Sterba wrote: > On Thu, Mar 22, 2018 at 09:53:46PM +0800, Qu Wenruo wrote: diff --git a/fs/btrfs/backref.c b/fs/btrfs/backref.c index 26484648d090..3866b8ab20f1 100644 --- a/fs/btrfs/backref.c +++ b/fs/btrfs/backref.c @@ -738,7 +738,8 @@ static

Re: [PATCH V2] Btrfs: replace: cache rbio when rebuild data on missing device

2018-03-22 Thread David Sterba
On Thu, Mar 22, 2018 at 09:20:11AM +0800, Liu Bo wrote: > Rebuild on missing device is as same as recover, after it's done, rbio > has data which is consistent with on-disk data, so it can be cached to > avoid further reads. > > Signed-off-by: Liu Bo > Signed-off-by: Liu Bo Added to next, thank

Re: [PATCH] btrfs: Validate child tree block's level and first key

2018-03-22 Thread David Sterba
On Thu, Mar 22, 2018 at 09:53:46PM +0800, Qu Wenruo wrote: > >> diff --git a/fs/btrfs/backref.c b/fs/btrfs/backref.c > >> index 26484648d090..3866b8ab20f1 100644 > >> --- a/fs/btrfs/backref.c > >> +++ b/fs/btrfs/backref.c > >> @@ -738,7 +738,8 @@ static int add_missing_keys(struct btrfs_fs_info >

Re: [PATCH 1/2] btrfs-progs: print-tree: Use macro to replace immediate number for readable flags string buffer length

2018-03-22 Thread Qu Wenruo
On 2018年03月22日 21:39, David Sterba wrote: > On Thu, Mar 22, 2018 at 10:40:22AM +0200, Nikolay Borisov wrote: >> On 22.03.2018 10:32, Qu Wenruo wrote: >>> On 2018年03月22日 16:20, Nikolay Borisov wrote: On 22.03.2018 09:37, Qu Wenruo wrote: > In print-tree, we have a lot of parsers to conver

Re: [PATCH] btrfs: Validate child tree block's level and first key

2018-03-22 Thread Qu Wenruo
On 2018年03月22日 21:40, David Sterba wrote: > On Mon, Mar 19, 2018 at 05:18:41PM +0800, Qu Wenruo wrote: >> We have several reports about node pointer points to incorrect child >> tree blocks, which could have even wrong owner and level but still with >> valid generation and checksum. >> >> Althoug

Re: [PATCH] btrfs: Validate child tree block's level and first key

2018-03-22 Thread David Sterba
On Mon, Mar 19, 2018 at 05:18:41PM +0800, Qu Wenruo wrote: > We have several reports about node pointer points to incorrect child > tree blocks, which could have even wrong owner and level but still with > valid generation and checksum. > > Although btrfs check could handle it and print error mess

Re: [PATCH v2] btrfs-progs: wipe stale sb copy beyond -b size

2018-03-22 Thread Anand Jain
I continue asserting that all this code is unnecessary, just wipe every sb between 0, dev_size and be done with it. Yep. That's a nice clean up. We have tried to use libblkid a long time back but there were some issues. So we used the open code. As of now there is other bigger concern as

Re: [PATCH 1/2] btrfs-progs: print-tree: Use macro to replace immediate number for readable flags string buffer length

2018-03-22 Thread David Sterba
On Thu, Mar 22, 2018 at 10:40:22AM +0200, Nikolay Borisov wrote: > On 22.03.2018 10:32, Qu Wenruo wrote: > > On 2018年03月22日 16:20, Nikolay Borisov wrote: > >> On 22.03.2018 09:37, Qu Wenruo wrote: > >>> In print-tree, we have a lot of parsers to convert numeric flags to > >>> human readable string.

Re: [PATCH 1/3] btrfs-progs: Remove deprecated btrfs-zero-log standalone tool

2018-03-22 Thread Nikolay Borisov
On 22.03.2018 15:31, David Sterba wrote: > On Thu, Mar 22, 2018 at 09:29:46PM +0800, Qu Wenruo wrote: >> >> >> On 2018年03月22日 21:18, Nikolay Borisov wrote: >>> Its function has been subsumed by "btrfs rescue zero-log". Remove its >>> source file and adjust make/tests soruces accordingly. >> >> De

Re: [PATCH v2] btrfs: check if the fsid in the primary sb and copy sb are same

2018-03-22 Thread Anand Jain
So the code per-se makes sense. However, have you came across such a case in the real world or are you just fixing a theoretical (but real) issue? As discussed in the other thread, the SB csum check is coming to scan context as well. Now the question I have is, what do we do if the csum does

Re: [PATCH 2/3] btrfs-progs: Remove deprecated btrfs-show-super

2018-03-22 Thread Qu Wenruo
On 2018年03月22日 21:18, Nikolay Borisov wrote: > Its function has been superseded by btrfs inspect-internal show-super. > Furthermore the tools is currently not built by default. Just remove > it. Same missing sob tag. > --- > Makefile | 2 +- > btrfs-show-super.c | 39 ---

Re: [PATCH 1/3] btrfs-progs: Remove deprecated btrfs-zero-log standalone tool

2018-03-22 Thread David Sterba
On Thu, Mar 22, 2018 at 09:29:46PM +0800, Qu Wenruo wrote: > > > On 2018年03月22日 21:18, Nikolay Borisov wrote: > > Its function has been subsumed by "btrfs rescue zero-log". Remove its > > source file and adjust make/tests soruces accordingly. > > Despite of the lack of sob tag, it looks good. >

Re: [PATCH 1/3] btrfs-progs: Remove deprecated btrfs-zero-log standalone tool

2018-03-22 Thread Qu Wenruo
On 2018年03月22日 21:18, Nikolay Borisov wrote: > Its function has been subsumed by "btrfs rescue zero-log". Remove its > source file and adjust make/tests soruces accordingly. Despite of the lack of sob tag, it looks good. > --- > Makefile | 4 +- > btrfs-zero-log.c

Re: [PATCH v3 0/6] Fix long standing -EOPNOTSUPP problem caused by large inline extent

2018-03-22 Thread David Sterba
On Thu, Mar 22, 2018 at 08:12:31AM +0800, Qu Wenruo wrote: > > Applied, thanks. I had to fix the test, fallocate may fail, so a file of > > given size is created directly. > > The fix looks good, and I learn a new trick. > > But I'm wondering how could it fail. > > Nowadays /tmp should be tmpfs

[PATCH 3/3] btrfs-progs: Remove deprecated btrfs-calc-size tool

2018-03-22 Thread Nikolay Borisov
Its function has been superseded by btrfs inspect-internal tree-stats. Just remove it. --- Makefile | 2 +- btrfs-calc-size.c | 39 --- 2 files changed, 1 insertion(+), 40 deletions(-) delete mode 100644 btrfs-calc-size.c diff --git a/Makefile b/Make

[PATCH 2/3] btrfs-progs: Remove deprecated btrfs-show-super

2018-03-22 Thread Nikolay Borisov
Its function has been superseded by btrfs inspect-internal show-super. Furthermore the tools is currently not built by default. Just remove it. --- Makefile | 2 +- btrfs-show-super.c | 39 --- 2 files changed, 1 insertion(+), 40 deletions(-) delete

[PATCH 1/3] btrfs-progs: Remove deprecated btrfs-zero-log standalone tool

2018-03-22 Thread Nikolay Borisov
Its function has been subsumed by "btrfs rescue zero-log". Remove its source file and adjust make/tests soruces accordingly. --- Makefile | 4 +- btrfs-zero-log.c | 78 --- tests/misc-tests.sh | 1

Re: [PATCH v2] btrfs-progs: wipe stale sb copy beyond -b size

2018-03-22 Thread Nikolay Borisov
On 22.03.2018 15:01, Anand Jain wrote: > During the mkfs.btrfs -b btrfs_prepare_device() zeros all > the superblock bytenr locations only if the bytenr is below the > blockcount. The problem with this is that if the BTRFS is recreated > with a smaller size then we will leave the stale superblock

Re: [PATCH v2] btrfs: check if the fsid in the primary sb and copy sb are same

2018-03-22 Thread Nikolay Borisov
On 22.03.2018 15:01, Anand Jain wrote: > During the btrfs dev scan make sure that other copies of superblock > contain the same fsid as the primary SB. So that we bring to the > users notice if the superblock has been overwritten. > > mkfs.btrfs -fq /dev/sdc > mkfs.btrfs -fq /dev/sdb > dd if=

Re: [PATCH] btrfs-progs: wipe all copies of the stale superblock

2018-03-22 Thread Anand Jain
So I misread the code in the beginning, so the actual btrfs SB are being wiped out by the for loop which calls zer_dev_clamped. And in there all superblocks between 0 - block_count are zeored. And block_count is actual physical size of the device, right. And this value can further be limited b

[PATCH v2] handle SB beyond blockcount mkfs.btrfs

2018-03-22 Thread Anand Jain
v2->v1: progs: update change log Adds kernel check if there is a mismatch in the FSID between primary and copy SB The kernel patch here checks if all the SB copies are of the same fsid. The btrfs-progs patch zeros SB if found beyond blockcount. mkfs.btrfs -b ** CAVEAT ** On the systems wit

[PATCH v2] btrfs: check if the fsid in the primary sb and copy sb are same

2018-03-22 Thread Anand Jain
During the btrfs dev scan make sure that other copies of superblock contain the same fsid as the primary SB. So that we bring to the users notice if the superblock has been overwritten. mkfs.btrfs -fq /dev/sdc mkfs.btrfs -fq /dev/sdb dd if=/dev/sdb of=/dev/sdc count=4K skip=64K seek=64K obs=1 i

[PATCH v2] btrfs-progs: wipe stale sb copy beyond -b size

2018-03-22 Thread Anand Jain
During the mkfs.btrfs -b btrfs_prepare_device() zeros all the superblock bytenr locations only if the bytenr is below the blockcount. The problem with this is that if the BTRFS is recreated with a smaller size then we will leave the stale superblock in the disk which shall confuse the recovery. As

Re: [PATCH] btrfs-progs: wipe all copies of the stale superblock

2018-03-22 Thread Nikolay Borisov
On 22.03.2018 14:14, Anand Jain wrote: > > >  Ok. Will update the change log. > >> A better place for this code is really inside btrfs_wipe_existing_sb. >> Furthermore looking at libblkid it supports a way to wipe multiple >> superblocks by way of: blkid_do_wipe. I.e >> https://mirrors.edge.ke

Re: [PATCH] btrfs: Validate child tree block's level and first key

2018-03-22 Thread Qu Wenruo
On 2018年03月22日 20:12, Nikolay Borisov wrote: > > > On 19.03.2018 11:18, Qu Wenruo wrote: >> We have several reports about node pointer points to incorrect child >> tree blocks, which could have even wrong owner and level but still with >> valid generation and checksum. >> >> Although btrfs chec

Re: [PATCH] btrfs: Allow non-privileged user to delete empty subvolume by default

2018-03-22 Thread Austin S. Hemmelgarn
On 2018-03-21 16:38, Goffredo Baroncelli wrote: On 03/21/2018 12:47 PM, Austin S. Hemmelgarn wrote: I agree as well, with the addendum that I'd love to see a new ioctl that does proper permissions checks.  While letting rmdir(2) work for an empty subvolume with the appropriate permissions woul

Re: [PATCH] btrfs-progs: wipe all copies of the stale superblock

2018-03-22 Thread Anand Jain
Ok. Will update the change log. A better place for this code is really inside btrfs_wipe_existing_sb. Furthermore looking at libblkid it supports a way to wipe multiple superblocks by way of: blkid_do_wipe. I.e https://mirrors.edge.kernel.org/pub/linux/utils/util-linux/v2.21/libblkid-docs/lib

Re: [PATCH] btrfs: Validate child tree block's level and first key

2018-03-22 Thread Nikolay Borisov
On 19.03.2018 11:18, Qu Wenruo wrote: > We have several reports about node pointer points to incorrect child > tree blocks, which could have even wrong owner and level but still with > valid generation and checksum. > > Although btrfs check could handle it and print error message like: > leaf pa

Re: Status of RAID5/6

2018-03-22 Thread Austin S. Hemmelgarn
On 2018-03-21 16:02, Christoph Anton Mitterer wrote: On the note of maintenance specifically: - Maintenance tools - How to get the status of the RAID? (Querying kernel logs is IMO rather a bad way for this) This includes: - Is the raid degraded or not? Check for the 'degraded' f

[PATCH] btrfs-progs: check/original: Remove unused variable first_key

2018-03-22 Thread Qu Wenruo
This @first_key variable is introduced in f5c4c4f3b75b ("btrfsck: add code to rebuild extent records"), however it's not only unused, but also used incorrectly. It's calling btrfs_item_key_to_cpu() on an node extent buffer. Anyway, just remove it. Fixes: f5c4c4f3b75b ("btrfsck: add code to rebui

Re: Out of space and incorrect size reported

2018-03-22 Thread Duncan
Shane Walton posted on Thu, 22 Mar 2018 00:56:05 + as excerpted: btrfs fi df /mnt2/pool_homes >>> Data, RAID1: total=240.00GiB, used=239.78GiB >>> System, RAID1: total=8.00MiB, used=64.00KiB >>> Metadata, RAID1: total=8.00GiB, used=5.90GiB >>> GlobalReserve, single: total=512.00MiB, used=

Re: [PATCH 1/2] btrfs-progs: print-tree: Use macro to replace immediate number for readable flags string buffer length

2018-03-22 Thread Nikolay Borisov
On 22.03.2018 10:32, Qu Wenruo wrote: > > > On 2018年03月22日 16:20, Nikolay Borisov wrote: >> >> >> On 22.03.2018 09:37, Qu Wenruo wrote: >>> In print-tree, we have a lot of parsers to convert numeric flags to >>> human readable string. >>> >>> For the buffer size we're using immediate numbers fo

Re: [PATCH 1/2] btrfs-progs: print-tree: Use macro to replace immediate number for readable flags string buffer length

2018-03-22 Thread Qu Wenruo
On 2018年03月22日 16:20, Nikolay Borisov wrote: > > > On 22.03.2018 09:37, Qu Wenruo wrote: >> In print-tree, we have a lot of parsers to convert numeric flags to >> human readable string. >> >> For the buffer size we're using immediate numbers for all their callers. >> Change this to macro so it

Re: [PATCH 2/2] btrfs-progs: print-tree: Add output for node flags and backref version

2018-03-22 Thread Nikolay Borisov
On 22.03.2018 09:37, Qu Wenruo wrote: > Just like what we did for leaf, also add this output to make it easier > to distinguish tree reloc tree blocks. > > Signed-off-by: Qu Wenruo Reviewed-by: Nikolay Borisov > --- > print-tree.c | 8 > 1 file changed, 8 insertions(+) > > diff --

Re: [PATCH 1/2] btrfs-progs: print-tree: Use macro to replace immediate number for readable flags string buffer length

2018-03-22 Thread Nikolay Borisov
On 22.03.2018 09:37, Qu Wenruo wrote: > In print-tree, we have a lot of parsers to convert numeric flags to > human readable string. > > For the buffer size we're using immediate numbers for all their callers. > Change this to macro so it will be much easier for us to expand the > buffer size. >

Re: grub_probe/grub-mkimage does not find all drives in BTRFS RAID1

2018-03-22 Thread Duncan
Matthew Hawn posted on Thu, 22 Mar 2018 00:13:38 + as excerpted: > This is almost definitely a bug in GRUB, but I wanted to get the btrfs > mailing list opinion first. > > Symptoms: > I have a btrfs raid1 /boot and root filesystem. Ever since I replaced a > drive, when I run the grub utiliti

[PATCH 2/2] btrfs-progs: print-tree: Add output for node flags and backref version

2018-03-22 Thread Qu Wenruo
Just like what we did for leaf, also add this output to make it easier to distinguish tree reloc tree blocks. Signed-off-by: Qu Wenruo --- print-tree.c | 8 1 file changed, 8 insertions(+) diff --git a/print-tree.c b/print-tree.c index d5bb413019bb..a82cdc945247 100644 --- a/print-tree

[PATCH 1/2] btrfs-progs: print-tree: Use macro to replace immediate number for readable flags string buffer length

2018-03-22 Thread Qu Wenruo
In print-tree, we have a lot of parsers to convert numeric flags to human readable string. For the buffer size we're using immediate numbers for all their callers. Change this to macro so it will be much easier for us to expand the buffer size. Signed-off-by: Qu Wenruo --- print-tree.c | 29 +++