[RFC PATCH 2/4] btrfs: don't BUG_ON() in btrfs_link_subvol()

2018-08-05 Thread Lu Fengqi
Both of btrfs_update_inode() and btrfs_add_root_ref() may fail because of ENOMEM. So there's no reason to panic here, we can replace BUG_ON() with btrfs_abort_transaction() here. Signed-off-by: Lu Fengqi --- fs/btrfs/ioctl.c | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) diff

[RFC PATCH 3/4] btrfs: undelete: introduce btrfs_undelete_subvolume

2018-08-05 Thread Lu Fengqi
The function will do the following things which are almost the opposite of what btrfs_delete_subvolume() does: 1. link the subvolume to the parent specified; 2. clear root flag and set root_refs to 1; 3. add the subvol to the uuid_tree; 4. delete the orphan_item. Signed-off-by: Lu Fengqi --- fs

[RFC PATCH 4/4] btrfs: undelete: Add the btrfs_ioctl_undelete

2018-08-05 Thread Lu Fengqi
The function will traverse the root from the fs_info->dead_roots and try to call btrfs_undelete_subvolume() to recover them. Note: It will lock fs_info->cleaner_mutex to keep the cleaner kthread from deleting the subvolume which we want to recover. Signed-off-by: Lu Fengqi --- fs/btrfs/ioctl.c

[RFC PATCH 0/4] undelete subvolume online version

2018-08-05 Thread Lu Fengqi
This patchset will add the BTRFS_IOC_SUBVOL_UNDELETE ioctl for online btrfs subvolume undelete. And btrfs subvolume undelete subcommand was added to btrfs-progs. So user can use the following command to recover all the subolume that is left on the device. The recovered subvolume will be link to

[RFC PATCH 1/4] btrfs: factor out btrfs_link_subvol from create_subvol

2018-08-05 Thread Lu Fengqi
The function btrfs_link_subvol is responsible to link the subvolume to the specified directory, which is the opposite of what btrfs_unlink_subvol does. No functional change. Signed-off-by: Lu Fengqi --- fs/btrfs/ioctl.c | 65 ++-- 1 file changed, 41 i

BUG: scheduling while atomic

2018-08-05 Thread James Courtier-Dutton
I am seeing a server halt and require a manual restart that I think might be related to btrfs. I attach the kernel log from it, in the hope that someone will understand it better than me. Any clues? https://paste.fedoraproject.org/paste/xSblK1RKANiwhKHQj31Cdw Kind Regards James -- To unsubscrib

Hanging btrfs-transaction

2018-08-05 Thread Zoltan
Dear Btrfs Experts, I would like to ask for advice regarding the following problem: I regularly do incremental backups of snapshots using commands like: btrfs send -p /volumes/root/snapshots/2018-08-02 /volumes/root/snapshots/2018-08-03 | btrfs receive /volumes/sj-backup/root Recently the comma

Re: BUG: scheduling while atomic

2018-08-05 Thread Qu Wenruo
On 2018年08月05日 22:09, James Courtier-Dutton wrote: > I am seeing a server halt and require a manual restart that I think > might be related to btrfs. > I attach the kernel log from it, in the hope that someone will > understand it better than me. > Any clues? > > https://paste.fedoraproject.org/

Re: [PATCH v2] btrfs: qgroup: Remove qgroup item along with subvolume deletion

2018-08-05 Thread Misono Tomohiro
On 2018/08/03 18:16, Lu Fengqi wrote: > On Fri, Aug 03, 2018 at 11:39:28AM +0300, Nikolay Borisov wrote: >> >> >> On 3.08.2018 11:37, Misono Tomohiro wrote: >>> On 2018/08/03 16:15, Lu Fengqi wrote: On Fri, Aug 03, 2018 at 03:21:12PM +0900, Misono Tomohiro wrote: > When qgroup is on, subv

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

2018-08-05 Thread Anand Jain
[applies on misc-next and for-next-20180801] 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/features remains same. However internally the ioctl flag is n

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

2018-08-05 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 ++

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

2018-08-05 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: fix unexpected failure of nocow buffered writes after snapshotting when low on space

2018-08-05 Thread robbieko
From: Robbie Ko Commit e9894fd3e3b3 ("Btrfs: fix snapshot vs nocow writting") forced nocow writes to fallback to COW, during writeback, when a snapshot is created. This resulted in writes made before creating the snapshot to unexpectedly fail with ENOSPC during writeback when success (0) was retu

Re: [PATCH] Btrfs: optimization to avoid ENOSPC for nocow writes after snapshot when low on data space

2018-08-05 Thread robbieko
Filipe Manana 於 2018-08-03 18:22 寫到: On Fri, Aug 3, 2018 at 10:13 AM, robbieko wrote: From: Robbie Ko Commit e9894fd3e3b3 ("Btrfs: fix snapshot vs nocow writting") forced writeback fallback to COW when subvolume is snapshotted. Commit e9894fd3e3b3 ("Btrfs: fix snapshot vs nocow writting") f

Re: [PATCH 2/3] btrfs-progs: ins: logical-resolve: Print message when path cannot be resolved

2018-08-05 Thread Misono Tomohiro
On 2018/08/04 0:06, David Sterba wrote: > On Wed, Jul 25, 2018 at 05:20:17PM +0900, Misono Tomohiro wrote: >> Since BTRFS_IOC_INO_PATHS requires fd of subvolume, > > Does it? AFAICS btrfs_ioctl_ino_to_path gets root that's the containing > subvolume of the path given by the user. It is reverse; i

Re: [PATCH 0/3] Remove uneeded variable "err"

2018-08-05 Thread zhong jiang
On 2018/8/6 3:14, Nikolay Borisov wrote: > > On 5.08.2018 18:02, zhong jiang wrote: >> zhong jiang (3): >> fs/btrfs/disk-io: Remove unneeded variable "err" >> fs/btrfs/extent-tree: remove redudant variable "err" >> fs/btrfs/tree-log: remove the unneeded variable "err" >> >> fs/btrfs/disk-io

Re: [PATCH 1/3] fs/btrfs/disk-io: Remove unneeded variable "err"

2018-08-05 Thread zhong jiang
On 2018/8/5 23:27, Joe Perches wrote: > On Sun, 2018-08-05 at 23:02 +0800, zhong jiang wrote: >> The err is not used after initalization, So remove it and make >> the function to be void function. > [] >> diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c > [] >> @@ -4193,7 +4192,6 @@ static int

Re: [PATCH 1/3] fs/btrfs/disk-io: Remove unneeded variable "err"

2018-08-05 Thread zhong jiang
On 2018/8/6 3:13, Nikolay Borisov wrote: > > On 5.08.2018 18:02, zhong jiang wrote: >> The err is not used after initalization, So remove it and make >> the function to be void function. >> >> Signed-off-by: zhong jiang > The ret value of this function is not checked by the sole caller > (btrfs_c

[PATCH v3] btrfs: qgroup: Remove qgroup items along with subvolume deletion

2018-08-05 Thread Misono Tomohiro
When qgroup is on, subvolume deletion does not remove qgroup items of the subvolume (qgroup info, limit, relation) from quota tree and they need to get removed manually by "btrfs qgroup destroy". Since level 0 qgroup cannot be used/inherited by any other subvolume, let's remove them automatically

[RFC PATCH] btrfs: Remove 'objectid' member from struct btrfs_root

2018-08-05 Thread Misono Tomohiro
There are two members in struct btrfs_root which indicate root's objectid: ->objectid and ->root_key.objectid. They are both set to the same value in __setup_root(): static void __setup_root(struct btrfs_root *root, struct btrfs_fs_info *fs_info,

[PATCH 0/3] btrfs-progs: Minor qgroup subcommand usage update

2018-08-05 Thread Qu Wenruo
It turns out even commit e5a6610c943b ("btrfs-progs: qgroup assign: add option to schedule rescan") introduced the ability to auto rescan, it's less known option and even some developer find it hard to understand. (Well, the whole quota thing is already a little hard to understand) Thus it makes m

[PATCH 2/3] btrfs-progs: qgroup: make --rescan as the default behavior for assign

2018-08-05 Thread Qu Wenruo
Even though we have --rescan option, it still needs user to manually specify it. However even some developer is not aware of the option, it makes even less sense for end-user. So make it the default behavior. Signed-off-by: Qu Wenruo --- Documentation/btrfs-qgroup.asciidoc | 4 ++-- cmds-qgrou

[PATCH 3/3] btrfs-progs: Doc: Update btrfs-qgroup for the rescan condition

2018-08-05 Thread Qu Wenruo
Add a new section, RESCAN CONDITION, to explain why and when we need a full quota rescan when assigning/removing qgroup relationship. Also, since 'remove' shares the same options of 'assign', add reference to 'assign' options for 'remove' subcommand. Signed-off-by: Qu Wenruo --- Documentation/b

[PATCH 1/3] btrfs-progs: cmds-qgroup: Use bool to replace int for @rescan

2018-08-05 Thread Qu Wenruo
Just a cleanup to avoid abuse of int. Signed-off-by: Qu Wenruo --- cmds-qgroup.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cmds-qgroup.c b/cmds-qgroup.c index 93206900693d..7a505443d271 100644 --- a/cmds-qgroup.c +++ b/cmds-qgroup.c @@ -40,7 +40,7 @@ static int _c

Re: [RFC PATCH] btrfs: Remove 'objectid' member from struct btrfs_root

2018-08-05 Thread Qu Wenruo
On 2018年08月06日 13:25, Misono Tomohiro wrote: > There are two members in struct btrfs_root which indicate root's > objectid: ->objectid and ->root_key.objectid. > > They are both set to the same value in __setup_root(): > static void __setup_root(struct btrfs_root *root, >

Re: BUG: scheduling while atomic

2018-08-05 Thread Qu Wenruo
On 2018年08月06日 14:07, James Courtier-Dutton wrote: > > > On Mon, 6 Aug 2018, 01:48 Qu Wenruo, > wrote: > > > > On 2018年08月05日 22:09, James Courtier-Dutton wrote: > > I am seeing a server halt and require a manual restart that I think > > might be r

Re: [RFC PATCH] btrfs: Remove 'objectid' member from struct btrfs_root

2018-08-05 Thread Su Yue
On 08/06/2018 02:17 PM, Qu Wenruo wrote: On 2018年08月06日 13:25, Misono Tomohiro wrote: There are two members in struct btrfs_root which indicate root's objectid: ->objectid and ->root_key.objectid. They are both set to the same value in __setup_root(): static void __setup_root(struct btr

Re: [RFC PATCH] btrfs: Remove 'objectid' member from struct btrfs_root

2018-08-05 Thread Misono Tomohiro
On 2018/08/06 15:17, Qu Wenruo wrote: > > > On 2018年08月06日 13:25, Misono Tomohiro wrote: >> There are two members in struct btrfs_root which indicate root's >> objectid: ->objectid and ->root_key.objectid. >> >> They are both set to the same value in __setup_root(): >> static void __setup_root(