Re: [PATCH] btrfs: qgroup: Auto kick in rescan if qgroup tree is initialized without rescan initialized

2018-07-26 Thread Misono Tomohiro
On 2018/07/26 15:59, Qu Wenruo wrote: > Under certain case, btrfs/166 could cause power loss just after quota > tree initialized but rescan not kicked in. > > In this case, since flags of qgroup status item is just ON | > INCONSISTENT, without RESCAN flag, rescan won't be kicked in in next > mount

Re: [PATCH] btrfs: qgroup: Auto kick in rescan if qgroup tree is initialized without rescan initialized

2018-07-26 Thread Qu Wenruo
On 2018年07月26日 15:21, Misono Tomohiro wrote: > On 2018/07/26 15:59, Qu Wenruo wrote: >> Under certain case, btrfs/166 could cause power loss just after quota >> tree initialized but rescan not kicked in. >> >> In this case, since flags of qgroup status item is just ON | >> INCONSISTENT, without R

[PATCH] btrfs: qgroup: Init flags with RESCAN bit at quota enable time

2018-07-26 Thread Qu Wenruo
Between btrfs_quota_enable() finished and rescan kicked in, there is a small window that quota status has (ON | INCONSISTENT) bits set but without RESCAN bits set. And transaction is committed inside the window and then power loss happens, we will have a quota tree with all qgroup numbers set to 0

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

2018-07-26 Thread Anand Jain
[based on latest misc-next] v7: Use struct btrfs_ioctl_vol_args (instead of struct btrfs_ioctl_vol_args_v2) as its inline with other ioctl btrfs-control The CLI usage remains same. However internally the ioctl flag is not required to delete all the unmounted devices. Instead leave btrfs_

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

2018-07-26 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

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

2018-07-26 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 --- cmds-device.c | 58 ++

Re: [PATCH] btrfs: qgroup: Auto kick in rescan if qgroup tree is initialized without rescan initialized

2018-07-26 Thread Qu Wenruo
On 2018年07月26日 14:59, Qu Wenruo wrote: > Under certain case, btrfs/166 could cause power loss just after quota > tree initialized but rescan not kicked in. > > In this case, since flags of qgroup status item is just ON | > INCONSISTENT, without RESCAN flag, rescan won't be kicked in in next > mo

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

2018-07-26 Thread Filipe Manana
On Thu, Jul 26, 2018 at 12:32 PM, 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

[PATCH v2 0/2] btrfs-progs: build improvements

2018-07-26 Thread Omar Sandoval
From: Omar Sandoval Hi, Dave, Here's v2 of "btrfs-progs: make all programs and libraries optional", this time much less overkill. Now, it's just --disable-programs, --disable-shared, and --disable-static. Based on your devel branch. Please consider these for the next progs release. Thanks! Oma

[PATCH v2 2/2] btrfs-progs: add --disable-shared and --disable-static

2018-07-26 Thread Omar Sandoval
From: Omar Sandoval The build system mentioned in the previous commit builds libraries in both PIC and non-PIC mode. Shared libraries don't work in PIC mode, so it expects a --disable-shared configure option, which most open source libraries using autoconf have. Let's add it, too. Signed-off-by:

[PATCH v2 1/2] btrfs-progs: add --disable-programs

2018-07-26 Thread Omar Sandoval
From: Omar Sandoval We have a build system internally which only needs to build and install the libraries out of a repository, not any binaries. There's no easy way to do this in btrfs-progs currently. Add --disable-programs to ./configure to support this. Signed-off-by: Omar Sandoval --- Make

Lockdep splat with v4.18.6

2018-07-26 Thread Ross Zwisler
I was testing my new xfstest posted here: https://lists.01.org/pipermail/linux-nvdimm/2018-July/016850.html against a btrfs test device + scrach device setup, and hit a lockdep splat. I'm using vanilla v4.18.6. I've attached the splats to this mail, one just as it happened in dmesg and one pass

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

2018-07-26 Thread Anand Jain
On 07/26/2018 11:25 PM, Filipe Manana wrote: On Thu, Jul 26, 2018 at 12:32 PM, 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.

[PATCH] btrfs: revert fs_devices state on error of btrfs_init_new_device()

2018-07-26 Thread Naohiro Aota
When btrfs hits error after modifying fs_devices in btrfs_init_new_device() (such as btrfs_add_dev_item() returns error), it leaves everything as is, but frees allocated btrfs_device. As a result, fs_devices->devices and fs_devices->alloc_list contain already freed btrfs_device, leading to later us

Re: Lockdep splat with v4.18.6

2018-07-26 Thread Anand Jain
Hi Ross, Thanks for the report. I have analyzed it here [1] earlier and is harmless since lockdep checks doesn't seem to account for the difference in the lock time-space, there is similar fix in block layer as well (which I am unable to pull the ref as of now, but will try again). And thi

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

2018-07-26 Thread Anand Jain
[based on latest misc-next] v8: Change log update in the kernel patch. v7: Use struct btrfs_ioctl_vol_args (instead of struct btrfs_ioctl_vol_args_v2) as its inline with other ioctl btrfs-control The CLI usage remains same. However internally the ioctl flag is not required to delete all

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

2018-07-26 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

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

2018-07-26 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 --- cmds-device.c | 58 ++

Re: [PATCH] btrfs: qgroup: Init flags with RESCAN bit at quota enable time

2018-07-26 Thread Misono Tomohiro
On 2018/07/26 18:15, Qu Wenruo wrote: > Between btrfs_quota_enable() finished and rescan kicked in, there is a > small window that quota status has (ON | INCONSISTENT) bits set but > without RESCAN bits set. > > And transaction is committed inside the window and then power loss > happens, we will

Re: [PATCH] btrfs: qgroup: Init flags with RESCAN bit at quota enable time

2018-07-26 Thread Qu Wenruo
On 2018年07月27日 09:10, Misono Tomohiro wrote: > On 2018/07/26 18:15, Qu Wenruo wrote: >> Between btrfs_quota_enable() finished and rescan kicked in, there is a >> small window that quota status has (ON | INCONSISTENT) bits set but >> without RESCAN bits set. >> >> And transaction is committed insi

Re: [PATCH] btrfs: qgroup: Init flags with RESCAN bit at quota enable time

2018-07-26 Thread Misono Tomohiro
On 2018/07/27 10:19, Qu Wenruo wrote: > > > On 2018年07月27日 09:10, Misono Tomohiro wrote: >> On 2018/07/26 18:15, Qu Wenruo wrote: >>> Between btrfs_quota_enable() finished and rescan kicked in, there is a >>> small window that quota status has (ON | INCONSISTENT) bits set but >>> without RESCAN b

Re: [PATCH] btrfs: qgroup: Init flags with RESCAN bit at quota enable time

2018-07-26 Thread Qu Wenruo
On 2018年07月27日 09:43, Misono Tomohiro wrote: > On 2018/07/27 10:19, Qu Wenruo wrote: >> >> >> On 2018年07月27日 09:10, Misono Tomohiro wrote: >>> On 2018/07/26 18:15, Qu Wenruo wrote: Between btrfs_quota_enable() finished and rescan kicked in, there is a small window that quota status has

Re: [PATCH] btrfs: qgroup: Init flags with RESCAN bit at quota enable time

2018-07-26 Thread Misono Tomohiro
On 2018/07/27 15:09, Qu Wenruo wrote: > > > On 2018年07月27日 09:43, Misono Tomohiro wrote: >> On 2018/07/27 10:19, Qu Wenruo wrote: >>> >>> >>> On 2018年07月27日 09:10, Misono Tomohiro wrote: On 2018/07/26 18:15, Qu Wenruo wrote: > Between btrfs_quota_enable() finished and rescan kicked in, t