[PATCH 6/8] btrfs-progs: sub show: Allow non-privileged user to call "subvolume show"

2018-11-26 Thread Misono Tomohiro
:15e80697-2ffb-0b4b-8e1e-e0873a7cf944 ... Snapshot(s): /mnt/snap2 Signed-off-by: Misono Tomohiro Signed-off-by: David Sterba --- Documentation/btrfs-subvolume.asciidoc | 11 ++- cmds-subvolume.c | 107 ++--- 2 files

[PATCH 1/8] btrfs-progs: sub list: Use libbtrfsuitl for subvolume list

2018-11-26 Thread Misono Tomohiro
Sandoval Signed-off-by: Misono Tomohiro Signed-off-by: David Sterba --- cmds-subvolume.c | 963 +-- 1 file changed, 936 insertions(+), 27 deletions(-) diff --git a/cmds-subvolume.c b/cmds-subvolume.c index a8395aac..84a03fd8 100644 --- a/cmds-subvolume.c

[PATCH 8/8] btrfs-porgs: test: Add cli-test/009 to check subvolume list for both root and normal user

2018-11-26 Thread Misono Tomohiro
Signed-off-by: Misono Tomohiro Signed-off-by: David Sterba --- tests/cli-tests/009-subvolume-list/test.sh | 130 + 1 file changed, 130 insertions(+) create mode 100755 tests/cli-tests/009-subvolume-list/test.sh diff --git a/tests/cli-tests/009-subvolume-list/test.sh b

[PATCH 7/8] btrfs-progs: test: Add helper function to check if test user exists

2018-11-26 Thread Misono Tomohiro
Add helper function to check that if user 'nobody' exists or not. Note that 'nobody' should not have root privileges as it will be used to test the behavior of non-privileged user. Signed-off-by: Misono Tomohiro Signed-off-by: David Sterba --- tests/common | 10 ++ 1 file changed, 10

[PATCH 4/8] btrfs-progs: sub list: Update -a option and remove meaningless filter

2018-11-26 Thread Misono Tomohiro
AAA/BBB ID 258 gen 10 top level 5 path ZZZ ** output of progs <= 4.19 $ btrfs subvolume list -a /mnt ID 256 gen 9 top level 5 path AAA ID 257 gen 9 top level 256 path /AAA/BBB ID 258 gen 10 top level 5 path ZZZ Signed-off-by: Misono Tomohiro Signed-off-by: David Sterba --- Documen

[PATCH 5/8] btrfs-progs: utils: Fallback to open without O_NOATIME flag in find_mount_root():

2018-11-26 Thread Misono Tomohiro
Signed-off-by: Misono Tomohiro Signed-off-by: David Sterba --- utils.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/utils.c b/utils.c index 3a4bc92a..8ce8417d 100644 --- a/utils.c +++ b/utils.c @@ -2054,6 +2054,9 @@ int find_mount_root(const char *path, char **mount_root)

[PATCH RESEND 0/8] btrfs-progs: sub: Relax the privileges of "subvolume list/show"

2018-11-26 Thread Misono Tomohiro
to top-level subvolume) Also, snapshots to be shown are to which the user can access from current mount point. (for root, all snapshots in the fs) === [1] https://lore.kernel.org/linux-btrfs/cover.1529310485.git.misono.tomoh...@jp.fujitsu.com/ [2] https://lore

[PATCH 3/8] btrfs-progs: sub list: Change the default behavior of "subvolume list" and allow non-privileged user to call it

2018-11-26 Thread Misono Tomohiro
ogs <= 4.19 $ mount -o subvol=AAA $DEV /mnt $ btrfs subvolume list /mnt ID 256 gen 11 top level 5 path AAA ID 257 gen 8 top level 256 path BBB ID 258 gen 8 top level 257 path BBB/dir/CCC ID 259 gen 11 top level 256 path ZZZ Signed-off-by: Misono Tomohiro Signed-off-by: David Sterba

[PATCH 2/8] btrfs-progs: sub list: factor out main part of btrfs_list_subvols

2018-11-26 Thread Misono Tomohiro
No functional changes. This is a preparation work for reworking "subvolume list". Signed-off-by: Misono Tomohiro Signed-off-by: David Sterba --- cmds-subvolume.c | 50 +--- 1 file changed, 30 insertions(+), 20 deletions(-) diff --

Re: [RFC PATCH 1/6] btrfs-progs: splitcmd-gen.sh: create btrfs- binaries for selected subcommands

2018-08-29 Thread Misono Tomohiro
On 2018/08/30 2:24, Axel Burri wrote: > Create separate binaries for each subcommand ("btrfs foo bar"). > Least invasive approach, generate c-files for each command: > > # ./splitcmd-gen.sh > # make V=1 btrfs-subvolume-show > # make V=1 btrfs-send > # [...] > > Alternative

[PATCH] btrfs: extent-tree.c: Remove redundant variable from btrfs_cross_ref_exist()

2018-08-29 Thread Misono Tomohiro
move 'ret2'. Signed-off-by: Misono Tomohiro --- fs/btrfs/extent-tree.c | 12 ++-- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 2d9074295d7f..0c87472d5719 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c

Re: [PATCH v2] btrfs: Always check nocow for quota enabled case to make sure we won't reserve unnecessary data space

2018-08-29 Thread Misono Tomohiro
On 2018/08/28 14:21, Qu Wenruo wrote: > On 2018/8/24 下午4:09, Misono Tomohiro wrote: > [snip] >>> >>> BTW, what's the possibility of such problem in your test environment? >> >> It's like one in several times. >> It may depend on hardware performance?

Re: [PATCH v2] btrfs: Always check nocow for quota enabled case to make sure we won't reserve unnecessary data space

2018-08-24 Thread Misono Tomohiro
On 2018/08/24 16:58, Qu Wenruo wrote: > > > On 2018/8/24 下午3:54, Misono Tomohiro wrote: >> On 2018/08/24 16:20, Qu Wenruo wrote: >>> >>> >>> On 2018/8/24 下午3:14, Misono Tomohiro wrote: >>>> Hi, >>>> >>>> On 2018/0

Re: [PATCH v2] btrfs: Always check nocow for quota enabled case to make sure we won't reserve unnecessary data space

2018-08-24 Thread Misono Tomohiro
On 2018/08/24 16:20, Qu Wenruo wrote: > > > On 2018/8/24 下午3:14, Misono Tomohiro wrote: >> Hi, >> >> On 2018/08/21 14:40, Qu Wenruo wrote: >>> Commit c6887cd11149 ("Btrfs: don't do nocow check unless we have to") >>> makes nocow chec

Re: [PATCH v2] btrfs: Always check nocow for quota enabled case to make sure we won't reserve unnecessary data space

2018-08-24 Thread Misono Tomohiro
Hi, On 2018/08/21 14:40, Qu Wenruo wrote: > Commit c6887cd11149 ("Btrfs: don't do nocow check unless we have to") > makes nocow check less frequent to improve performance. > > However for quota enabled case, such optimization could lead to extra > unnecessary data reservation, which results

[PATCH] btrfs: ctree.h: Fix suspicious rcu usage warning in btrfs_debug_in_rcu()

2018-08-23 Thread Misono Tomohiro
en message is not printed), leading suspicious RCU usage warning when CONFIG_PROVE_RCU is on. Fix this by adding a wrapper to call lock/unlock for non debug case too. Fixes: 672d599041c8 ("btrfs: Use wrapper macro for rcu string to remove duplicate code") Reported-by: David Howells S

Re: fs/btrfs/volumes.c:6114 suspicious rcu_dereference_check() usage!

2018-08-23 Thread Misono Tomohiro
generated. > > Note that the mount succeeds. > > This code was introduced by: > > commit 672d599041c862dd61a1576c32e946ef0d77aa34 > Author: Misono Tomohiro > Date: Thu Aug 2 16:19:07 2018 +0900 > Thanks for the reporting. I didn't turn

Re: [PATCH] btrfs-progs: rescue: Add ability to disable quota offline

2018-08-21 Thread Misono Tomohiro
On 2018/08/12 10:33, Qu Wenruo wrote: > Provide an offline tool to disable quota. > > For kernel which skip_balance doesn't work, there is no way to disable > quota on huge fs with balance, as quota will cause balance to hang for a > long long time for each tree block switch. > > So add an

Re: [PATCH v2 00/20] btrfs-progs: Rework of "subvolume list/show" and relax the root privileges of them

2018-08-21 Thread Misono Tomohiro
On 2018/08/16 3:12, David Sterba wrote: > Hi, > > so I've merged the first bath to devel. There was quite some whitespace > damage and style issues, but I fixed that as I went through the pathes. Thanks for taking this. > > I've left out all patches that introduce new options, this is the hard

Re: [PATCH] btrfs: Always check nocow for quota enabled case to make sure we won't reserve unnecessary data space

2018-08-20 Thread Misono Tomohiro
On 2018/08/15 15:13, Qu Wenruo wrote: > Commit c6887cd11149 ("Btrfs: don't do nocow check unless we have to") > makes nocow check less frequent to improve performance. > > However for quota enabled case, such optimization could lead to extra > unnecessary data reservation, which results failure

Re: [PATCH v2 00/20] btrfs-progs: Rework of "subvolume list/show" and relax the root privileges of them

2018-08-09 Thread Misono Tomohiro
On 2018/08/03 22:46, David Sterba wrote: > On Wed, Jul 04, 2018 at 05:14:59PM +0900, Misono Tomohiro wrote: >> Gentle ping, as this is related to the new ioctls merged in 4.18-rc1. > > Due to me spending more time than expected on kernel, this patchset will > be merged par

Re: [PATCH v2] btrfs: qgroup: Dirty all qgroups before rescan

2018-08-09 Thread Misono Tomohiro
each that qgroup. > > This will cause QGROUP_INFO items of orphan qgroups never get updated in > quota tree, thus their numbers will stay the same in "btrfs qgroup show" > output. > > [FIX] > Just mark all qgroups dirty in qgroup_rescan_zero_tracking(), so even

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

2018-08-09 Thread Misono Tomohiro
omatically when subvolume is deleted (to be precise, when the subvolume root is dropped). Signed-off-by: Misono Tomohiro --- v4 -> v5: Commit current transaction before calling btrfs_remove_qgroup() to keep qgroup consistency in all case. This resolves the concern in v4 path and

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

2018-08-09 Thread Misono Tomohiro
On 2018/08/09 15:14, Qu Wenruo wrote: > > > On 8/9/18 2:05 PM, Misono Tomohiro wrote: >> On 2018/08/09 14:47, Qu Wenruo wrote: >>> >>> >>> On 8/9/18 12:12 PM, Misono Tomohiro wrote: >>>> When qgroup is on, subvolume deletion does not remove

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

2018-08-09 Thread Misono Tomohiro
On 2018/08/09 14:47, Qu Wenruo wrote: > > > On 8/9/18 12:12 PM, Misono Tomohiro wrote: >> 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 manual

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

2018-08-08 Thread Misono Tomohiro
uo Signed-off-by: Misono Tomohiro --- Hi David, It turned out that this patch may cause qgroup inconsistency in case described above and need manual rescan. Since current code will keep qgroup items but not break qgroup consistency when deleting subvolume, I cannot clearly say which behavior

[PATCH] btrfs: qgroup: Always remove all qgroup relation in btrfs_remove_qgroup()

2018-08-08 Thread Misono Tomohiro
and removing first relation causes inconsistency, remaining items will not be removed. Fix this by continuing to remove items if return value of __del_qgroup_relation() is 1. Signed-off-by: Misono Tomohiro --- fs/btrfs/qgroup.c | 15 --- 1 file changed, 12 insertions(+), 3 deletions(-) diff

Re: [PATCH] btrfs: qgroup: Don't populating excl numbers for snapshot src if it belongs to other qgroups

2018-08-08 Thread Misono Tomohiro
ing -i option), 1/0 - 2/0, 1/1 - 2/0. > > So to make it simple, if snapshot src has higher level qgroups, just > mark qgroup inconsistent and let later rescan to do its job. > > Reported-by: Misono Tomohiro > Signed-off-by: Qu Wenruo > --- > fs/btrfs/qgroup.c | 16

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

2018-08-07 Thread Misono Tomohiro
On 2018/08/08 1:23, Lu Fengqi wrote: > On Mon, Aug 06, 2018 at 01:53:28PM +0900, Misono Tomohiro wrote: >> 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 manu

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

2018-08-06 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 __setu

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

2018-08-05 Thread Misono Tomohiro
e 'objecitd' member and unify code to use ->root_key.objectid in all places. Signed-off-by: Misono Tomohiro --- Although being fundamentally independent, this is based on the patch: https://patchwork.kernel.org/patch/10556485/ since it also touches root->objectid. fs/btrfs/backref

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

2018-08-05 Thread Misono Tomohiro
omatically when subvolume is deleted (to be precise, when the subvolume root is dropped). Reviewed-by: Lu Fengqi Reviewed-by: Qu Wenruo Signed-off-by: Misono Tomohiro --- v2 -> v3: Use root->root_key.objectid instead of root->objectid Add Reviewed-by tag v1 -> v2: Move call

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 us

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

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

2018-08-03 Thread Misono Tomohiro
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, subvolume deletion does not remove qgroup item >> of the subvolume (qgroup info, limits, relation) from quota tree and >> they needs to get remov

[PATCH] fstests: btrfs/057: Update test case to keep subvolume in any kernel version

2018-08-03 Thread Misono Tomohiro
ut we plan to change the behavior and remove them along with subvolume deletion. So update the test and keep subvolume (and qgroup item) in any kernel version. Signed-off-by: Misono Tomohiro --- tests/btrfs/057 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/btrfs/057 b/t

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

2018-08-03 Thread Misono Tomohiro
emove them automatically when subvolume is deleted (to be precise, when the subvolume root is dropped). Signed-off-by: Misono Tomohiro --- Note that btrfs/057 fails, but it is the problem of testcase. I will update it too. v1 -> v2: Move call of btrfs_remove_qgroup() from btrfs_del

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

2018-08-02 Thread Misono Tomohiro
On 2018/08/03 13:23, Lu Fengqi wrote: > On Fri, Aug 03, 2018 at 12:17:26PM +0800, Qu Wenruo wrote: >> >> >> On 2018年08月03日 12:08, Misono Tomohiro wrote: >>> When qgroup is on, subvolume deletion does not remove qgroup items >>> of the subvolume (qgroup

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

2018-08-02 Thread Misono Tomohiro
emove them automatically when subvolume is deleted. Signed-off-by: Misono Tomohiro --- I don't see any reason to keep these items after subvolume deletion, but is there something I'm missing? fs/btrfs/inode.c | 4 1 file changed, 4 insertions(+) diff --git a/fs/btrfs/inode.c b/fs/btrfs/ino

[PATCH] btrfs: Use wrapper macro for rcu string to remove duplicate code

2018-08-02 Thread Misono Tomohiro
Cleanup patch and no functional changes. Signed-off-by: Misono Tomohiro --- fs/btrfs/ioctl.c | 6 ++ fs/btrfs/scrub.c | 8 ++-- fs/btrfs/super.c | 9 +++-- fs/btrfs/volumes.c | 21 ++--- 4 files changed, 13 insertions(+), 31 deletions(-) diff --git a/fs

[PATCH] btrfs: replace: Reset on-disk dev stats value after replace

2018-07-31 Thread Misono Tomohiro
ay return old device's value after umount/mount (Example: See "btrfs ins dump-t -t DEV $DEV" after btrfs/100 finish). Fix this by just increment dev_stats_ccnt in btrfs_dev_replace_finishing() when replace is succeeded. Signed-off-by: Misono Tomohiro --- fs/btrfs/dev-replace.c | 6 ++

Re: [PATCH 0/2] btrfs-progs: completion: Small fixes to make debug simpler

2018-07-30 Thread Misono Tomohiro
This is useful. Reviewed-by: Misono Tomohiro On 2018/07/17 15:15, Qu Wenruo wrote: > For developer, it's pretty common to use "btrfs check" or "btrfs ins > dump-tree" on raw dumps. > > However "btrfs check" can only complete real block devices, and >

Re: [PATCH 11/15] btrfs-progs: Add delayed refs infrastructure

2018-07-30 Thread Misono Tomohiro
On 2018/06/08 21:47, Nikolay Borisov wrote: > This commit pulls those portions of the kernel implementation of > delayed refs which are necessary to have them working in user-space. > I've done the following modifications: > > 1. Replaced all kmem_cache_alloc calls to kmalloc. > > 2. Removed all

Re: [PATCH 14/15] btrfs-progs: Wire up delayed refs

2018-07-30 Thread Misono Tomohiro
On 2018/06/08 21:47, Nikolay Borisov wrote: > This commit enables the delayed refs infrastructures. This entails doing > the following: > > 1. Replacing existing calls of btrfs_extent_post_op (which is the > equivalent of delayed refs) with the proper btrfs_run_delayed_refs. > As well as

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

2018-07-27 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: >>

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

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

2018-07-26 Thread Misono Tomohiro
trfs_quota_enable(), > so even after power loss we will still kick in rescan automatically. > > Suggested-by: Misono Tomohiro > Signed-off-by: Qu Wenruo > --- > fs/btrfs/qgroup.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/fs/btrfs/

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 >

[PATCH] btrfs: extent-tree.c: Remove unused __btrfs_free_block_rsv()

2018-07-25 Thread Misono Tomohiro
There is no user of this function. This is forgotten to get removed in commit a575ceeb1338 ("Btrfs: get rid of unused orphan infrastructure"). Signed-off-by: Misono Tomohiro --- fs/btrfs/ctree.h | 1 - fs/btrfs/extent-tree.c | 5 - 2 files changed, 6 deletions(-) diff

[PATCH] btrfs: backref.c: Use ERR_CAST() to return error code

2018-07-25 Thread Misono Tomohiro
Use ERR_CAST() instead of void * to make meaning clear. Signed-off-by: Misono Tomohiro --- fs/btrfs/backref.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/btrfs/backref.c b/fs/btrfs/backref.c index 7ce0b5f9e99e..9f231bbccb1e 100644 --- a/fs/btrfs/backref.c +++ b/fs

[PATCH] btrfs: backref: Do not return duplicate refs from find_parent_nodes()

2018-07-25 Thread Misono Tomohiro
info and not ref - snapshot aware defrag (through iterate_extent_inodes_from_logical()) - currently dead code and not used Signed-off-by: Misono Tomohiro --- fs/btrfs/backref.c | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/fs/btrfs/backref.c b/fs/btrfs/backref.

[PATCH 1/3] btrfs-progs: ins: logical-resolve: Set correct error value

2018-07-25 Thread Misono Tomohiro
Reset ret value to zero after snprintf(), which returns the number of written chars. Otherwise non-zero value returns after command success with -P option. Also set return value from __ino_to_path_fd() to reflect the final status for default behavior. Signed-off-by: Misono Tomohiro --- cmds

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

2018-07-25 Thread Misono Tomohiro
Since BTRFS_IOC_INO_PATHS requires fd of subvolume, logical-resolve cannot find the path when mount point is not FS_TREE (because the subvolume path cannot be opened). In that case, print message to try -P option instead. Signed-off-by: Misono Tomohiro --- cmds-inspect.c | 34

[PATCH v2 3/3] btrfs-progs: ins: logical-resolve: Add v2 ioctl support

2018-07-25 Thread Misono Tomohiro
root 5 // v2 ioctl returns all refs pointing at least one block of given extent $ btrfs inspect-internal logical-resolve -P --ignore-offset \ $((3392*4096)) /mnt inode 257 offset 0 root 5 inode 257 offset 45056 root 5 Signed-off-by: Misono Tomohiro --- v1 -> v2 - add explnation - add bui

[PATCH 0/3] btrfs-progs: ins: Update for logical-resolve command

2018-07-25 Thread Misono Tomohiro
Patch 1 and 2 fix some issues in logical-resolve. Patch 3 is a main part and adds v2 support of BTRFS_IOC_LOGICA_INO_V2 Misono Tomohiro (3): btrfs-progs: ins: logical-resolve: Set correct error value btrfs-progs: ins: logical-resolve: Print message when path cannot be resolved btrfs

[PATCH] btrfs-progs: ins: Add v2 ioctl support in logical-resolve

2018-07-18 Thread Misono Tomohiro
Signed-off-by: Misono Tomohiro --- Documentation/btrfs-inspect-internal.asciidoc | 4 cmds-inspect.c| 17 +++-- ioctl.h | 10 +- libbtrfsutil/btrfs.h | 10 +- 4 files changed

Re: [PATCH 2/2] btrfs-progs: check: enhanced progress indicator

2018-07-16 Thread Misono Tomohiro
On 2018/07/05 4:20, Stéphane Lesimple wrote: > We reuse the task_position enum and task_ctx struct of the original progress > indicator, adding more values and fields for our needs. > > Then add hooks in all steps of the check to properly record progress. > > Signed-off-by: Stéphane Lesimple >

Re: [PATCH v2 00/20] btrfs-progs: Rework of "subvolume list/show" and relax the root privileges of them

2018-07-04 Thread Misono Tomohiro
Gentle ping, as this is related to the new ioctls merged in 4.18-rc1. On 2018/06/18 17:40, Misono Tomohiro wrote: > Changelog > > v1 -> v2: > generally update whole patch set, especially: >- rebased to progs 4.17 >- Improve error handling >- Update

[PATCH] btrfs-progs: doc: Update man 5 btrfs for 4.18

2018-07-03 Thread Misono Tomohiro
Update the information to reflect the status of 4.18 Main Updates: - Add explanation of improved compression heuristic algorithm - Add explanation that norecovery == nologreplay - Add explanation of nossd_spread mount option - Add explanation of rmdir_subovl feature Signed-off-by: Misono

Re: [PATCH] btrfs: qgroups: Move transaction managed inside btrfs_quota_enable

2018-07-03 Thread Misono Tomohiro
trfs_quota_enable") > Link: https://marc.info/?l=linux-btrfs=152999289017582 > Reported-by: Misono Tomohiro > Reviewed-by: Misono Tomohiro > Signed-off-by: Nikolay Borisov > --- > fs/btrfs/ioctl.c | 15 ++- > fs/btrfs/qgroup.c | 38 +++

Re: Enabling quota may not correctly rescan on 4.17

2018-07-02 Thread Misono Tomohiro
> Misono, > > Can you please try the attached patch? > I tried and it works (on 4.18.0-rc3). Committing transaction before starting rescan worker is what btrfs_qgroup_resan() does, so it looks fine. (though I'm not sure why you don't see the problem in your machine.) Reviewe

Re: Enabling quota may not correctly rescan on 4.17

2018-06-28 Thread Misono Tomohiro
On 2018/06/28 16:12, Qu Wenruo wrote: > > > On 2018年06月27日 16:25, Misono Tomohiro wrote: >> On 2018/06/27 17:10, Qu Wenruo wrote: >>> >>> >>> On 2018年06月26日 14:00, Misono Tomohiro wrote: >>>> Hello Nikolay, >>>> >>>>

Re: [PATCH v1] btrfs: quota: Set rescan progress to (u64)-1 if we hit last leaf

2018-06-27 Thread Misono Tomohiro
to keep > the original behavior. > > Reported-by: Misono Tomohiro > Fixes: ff3d27a048d9 ("btrfs: qgroup: Finish rescan when hit the last leaf of > extent tree") > Signed-off-by: Qu Wenruo > --- > changelog: > v2: > Commit message update, as the bug only

Re: Enabling quota may not correctly rescan on 4.17

2018-06-27 Thread Misono Tomohiro
On 2018/06/27 17:22, Nikolay Borisov wrote: > > > On 27.06.2018 11:20, Misono Tomohiro wrote: >> I can see the failure with or without options... >> maybe it depends on machine spec? > > I'm testing in a virtual machine: > > qemu-system-x86_64 -smp 6 -kernel

Re: Enabling quota may not correctly rescan on 4.17

2018-06-27 Thread Misono Tomohiro
On 2018/06/27 17:10, Qu Wenruo wrote: > > > On 2018年06月26日 14:00, Misono Tomohiro wrote: >> Hello Nikolay, >> >> I noticed that commit 5d23515be669 ("btrfs: Move qgroup rescan >> on quota enable to btrfs_quota_enable") in 4.17 sometimes causes >&

Re: Enabling quota may not correctly rescan on 4.17

2018-06-27 Thread Misono Tomohiro
On 2018/06/27 17:04, Nikolay Borisov wrote: > > > On 27.06.2018 10:55, Misono Tomohiro wrote: >> On 2018/06/27 16:40, Nikolay Borisov wrote: >>> >>> >>> On 26.06.2018 09:00, Misono Tomohiro wrote: >>>> Hello Nikolay, >>>> &

Re: Enabling quota may not correctly rescan on 4.17

2018-06-27 Thread Misono Tomohiro
On 2018/06/27 16:40, Nikolay Borisov wrote: > > > On 26.06.2018 09:00, Misono Tomohiro wrote: >> Hello Nikolay, >> >> I noticed that commit 5d23515be669 ("btrfs: Move qgroup rescan >> on quota enable to btrfs_quota_enable") in 4.17 sometimes causes

Re: [PATCH] btrfs: qgroups: Move transaction managed inside btrfs_quota_enable

2018-06-26 Thread Misono Tomohiro
disk. > > This patch aims to fix this by movign the transaction creation/commit > inside btrfs_quota_enable, which allows to schedule the quota commit > after the transaction has been committed. > > Fixes: 5d23515be669 ("btrfs: Move qgroup rescan on quota enable to > b

Enabling quota may not correctly rescan on 4.17

2018-06-26 Thread Misono Tomohiro
Hello Nikolay, I noticed that commit 5d23515be669 ("btrfs: Move qgroup rescan on quota enable to btrfs_quota_enable") in 4.17 sometimes causes to fail correctly rescanning quota when quota is enabled. Simple reproducer: $ mkfs.btrfs -f $DEV $ mount $DEV /mnt $ dd if=/dev/urandom of=/mnt/file

Re: [PATCH] btrfs: Use iocb to derive pos instead of passing a separate parameter

2018-06-25 Thread Misono Tomohiro
On 2018/06/26 1:20, David Sterba wrote: > On Mon, Jun 25, 2018 at 01:58:58PM +0900, Misono Tomohiro wrote: >> So, this is the updated version of >> https://patchwork.kernel.org/patch/10063039/ >> >> This time xfstest is ok and >> Reviewed-by: Misono

Re: [PATCH] btrfs: Use iocb to derive pos instead of passing a separate parameter

2018-06-24 Thread Misono Tomohiro
So, this is the updated version of https://patchwork.kernel.org/patch/10063039/ This time xfstest is ok and Reviewed-by: Misono Tomohiro On 2018/06/18 2:39, Goldwyn Rodrigues wrote: > From: Goldwyn Rodrigues > > struct kiocb carries the ki_pos, so there is no need to pass it as >

[PATCH v2 03/20] btrfs-progs: libbtrfsutil: Factor out btrfs_util_subvolume_info_fd()

2018-06-18 Thread Misono Tomohiro
Factor out main logic of btrfs_util_subvolume_info_fd(). This is a preparation work to relax the root privilege of this function. No functional change happens. Signed-off-by: Misono Tomohiro --- libbtrfsutil/subvolume.c | 45 ++--- 1 file changed, 26

[PATCH v2 10/20] btrfs-progs: sub list: Add -A option to output path in absolute path

2018-06-18 Thread Misono Tomohiro
-A /mnt ID 256 gen 6 top level 5 path /mnt/AAA Signed-off-by: Misono Tomohiro --- Documentation/btrfs-subvolume.asciidoc | 2 + cmds-subvolume.c | 73 +- 2 files changed, 66 insertions(+), 9 deletions(-) diff --git a/Documentation/btrfs

[PATCH v2 00/20] btrfs-progs: Rework of "subvolume list/show" and relax the root privileges of them

2018-06-18 Thread Misono Tomohiro
behavior of "sub show" 18th-20th patch are cli-test for "sub list" of new behavior. * Future todo: If this approach is ok, I'd like to update the output of "sub list" more like: - Remove obsolete field (i.e. top-level) from output Any comments are welcome.

[PATCH v2 04/20] btrfs-porgs: libbtrfsutil: Relax the privileges of util_subvolume_info()

2018-06-18 Thread Misono Tomohiro
This commit relaxes the privileges of util_subvolume_info() if kernel supports new ioctl (BTRFS_IOC_GET_SUBVOL_INFO) and @id is zero (i.e. when getting the information of the given path/fd). For older kernel (< 4.18), the behavior is the same. Signed-off-by: Misono Tomohiro --- libbtrfsu

[PATCH v2 12/20] btrfs-progs: sub list: Add --nosort option to output incrementally without sort

2018-06-18 Thread Misono Tomohiro
ing memory. Signed-off-by: Misono Tomohiro --- Documentation/btrfs-subvolume.asciidoc | 5 ++ cmds-subvolume.c | 140 ++--- 2 files changed, 100 insertions(+), 45 deletions(-) diff --git a/Documentation/btrfs-subvolume.asciidoc b/Documenta

[PATCH v2 05/20] btrfs-progs: libbtrfsuitl: Factor out btrfs_util_subvolume_iterator_next()

2018-06-18 Thread Misono Tomohiro
Factor out the main logic of btrfs_util_subvolume_iterator_next(). This is a preparation work to relax the root privilege of this function. No functional change happens. Signed-off-by: Misono Tomohiro --- libbtrfsutil/subvolume.c | 13 ++--- 1 file changed, 10 insertions(+), 3

[PATCH v2 13/20] btrfs-progs: sub list: Update -a option and remove meaningless filter

2018-06-18 Thread Misono Tomohiro
AAA/BBB ID 258 gen 10 top level 5 path ZZZ ** output of progs <= 4.17 $ btrfs subvolume list -a /mnt ID 256 gen 9 top level 5 path AAA ID 257 gen 9 top level 256 path /AAA/BBB ID 258 gen 10 top level 5 path ZZZ Signed-off-by: Misono Tomohiro --- Documentation/btrfs-subvolume.asciido

[PATCH v2 01/20] btrfs-progs: doc: Update man btrfs subvolume

2018-06-18 Thread Misono Tomohiro
t in "parent ID/UUID" - Fix indent/misspelling - Add missing comma Signed-off-by: Misono Tomohiro --- Documentation/btrfs-subvolume.asciidoc | 77 -- 1 file changed, 55 insertions(+), 22 deletions(-) diff --git a/Documentation/btrfs-subvolume.a

[PATCH v2 02/20] btrfs-progs: ioctl/libbtrfsutil: Add 3 definitions of new unprivileged ioctl

2018-06-18 Thread Misono Tomohiro
Copy and add 3 definitions of new unprivileged ioctl (BTRFS_IOC_GET_SUBVOL_INFO, BTRFS_IOC_GET_SUBVOL_ROOTREF and BTRFS_IOC_INO_LOOKUP_USER) from kernel. They will be used to implement the user version of "btrfs subvolume list/show" etc. Signed-off-by: Misono Tomohiro --

[PATCH v2 11/20] btrfs-progs: sub list: Add -f option to follow mounted subvolumes below the path

2018-06-18 Thread Misono Tomohiro
/mnt ID 256 gen 9 top level 5 path . ID 258 gen 7 top level 5 path bbb ID 259 gen 8 top level 5 path ccc Note that this option lists top-level subvolume if it is mounted in the way. Signed-off-by: Misono Tomohiro --- Documentation/btrfs-subvolume.asciidoc | 4 ++ cmds-subvolume.c

[PATCH v2 15/20] btrfs-progs: sub list: Update help message of -d option

2018-06-18 Thread Misono Tomohiro
Explicitly states that -d requires root privileges. Also, update some option handling with regard to -d option. Signed-off-by: Misono Tomohiro --- Documentation/btrfs-subvolume.asciidoc | 3 ++- cmds-subvolume.c | 8 2 files changed, 10 insertions(+), 1 deletion

[PATCH v2 06/20] btrfs-progs: libbtrfsutil: Relax the privileges of subvolume iterator

2018-06-18 Thread Misono Tomohiro
ume by INO_LOOKUP_USER (may happen if a dir in the path is being mounted) - it cannot be opened due to permission error Note that this commit also allows root user to specify non-subvolume direcotry when @top is zero. Only in that case, root's code path is the same as user. Signed-off-by: Misono Tomoh

[PATCH v2 07/20] btrfs-progs: sub list: Use libbtrfsuitl for subvolume list

2018-06-18 Thread Misono Tomohiro
Sandoval Signed-off-by: Misono Tomohiro --- cmds-subvolume.c | 963 +-- 1 file changed, 936 insertions(+), 27 deletions(-) diff --git a/cmds-subvolume.c b/cmds-subvolume.c index 45363a5a..c54a8003 100644 --- a/cmds-subvolume.c +++ b/cmds

[PATCH v2 17/20] btrfs-progs: sub show: Allow non-privileged user to call "subvolume show"

2018-06-18 Thread Misono Tomohiro
:15e80697-2ffb-0b4b-8e1e-e0873a7cf944 ... Snapshot(s): /mnt/snap2 Signed-off-by: Misono Tomohiro --- Documentation/btrfs-subvolume.asciidoc | 11 +++- cmds-subvolume.c | 107 + 2 files changed, 105 insertions

[PATCH v2 09/20] btrfs-progs: sub list: Change the default behavior of "subvolume list" and allow non-privileged user to call it

2018-06-18 Thread Misono Tomohiro
vel 256 path ZZZ Signed-off-by: Misono Tomohiro --- Documentation/btrfs-subvolume.asciidoc | 8 +- cmds-subvolume.c | 144 + 2 files changed, 119 insertions(+), 33 deletions(-) diff --git a/Documentation/btrfs-subvolume.asciidoc b/Doc

[PATCH v2 14/20] btrfs-progs: sub list: Update help message of -o option

2018-06-18 Thread Misono Tomohiro
Currently "sub list -o" lists only child subvolumes of the specified path. So, update help message and variable name more appropriately. Signed-off-by: Misono Tomohiro --- Documentation/btrfs-subvolume.asciidoc | 2 +- cmds-subvolume.c | 10 +- 2 files

[PATCH v2 18/20] btrfs-progs: test: Add helper function to check if test user exists

2018-06-18 Thread Misono Tomohiro
Test user 'progs-test' will be used to test the behavior of normal user. In order to pass this check, add the user by "useradd -M progs-test". Note that progs-test should not have root privileges. Signed-off-by: Misono Tomohiro --- tests/common | 10 ++ 1 file changed, 10

[PATCH v2 20/20] btrfs-progs: test: Add cli-test/010 to check "subvolume list -f" option

2018-06-18 Thread Misono Tomohiro
Signed-off-by: Misono Tomohiro --- tests/cli-tests/010-subvolume-list-follow/test.sh | 86 +++ 1 file changed, 86 insertions(+) create mode 100755 tests/cli-tests/010-subvolume-list-follow/test.sh diff --git a/tests/cli-tests/010-subvolume-list-follow/test.sh b/tests/cli

[PATCH v2 19/20] btrfs-porgs: test: Add cli-test/009 to check subvolume list for both root and normal user

2018-06-18 Thread Misono Tomohiro
Signed-off-by: Misono Tomohiro --- tests/cli-tests/009-subvolume-list/test.sh | 134 + 1 file changed, 134 insertions(+) create mode 100755 tests/cli-tests/009-subvolume-list/test.sh diff --git a/tests/cli-tests/009-subvolume-list/test.sh b/tests/cli-tests/009

[PATCH v2 16/20] btrfs-progs: utils: Fallback to open without O_NOATIME flag in find_mount_root():

2018-06-18 Thread Misono Tomohiro
Signed-off-by: Misono Tomohiro --- utils.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/utils.c b/utils.c index 21de09d3..1a4366e8 100644 --- a/utils.c +++ b/utils.c @@ -2048,6 +2048,9 @@ int find_mount_root(const char *path, char **mount_root) char *longest_match = NULL;

[PATCH v2 08/20] btrfs-progs: sub list: factor out main part of btrfs_list_subvols

2018-06-18 Thread Misono Tomohiro
No functional changes. This is a preparation work for reworking "subvolume list". Signed-off-by: Misono Tomohiro --- cmds-subvolume.c | 50 ++ 1 file changed, 30 insertions(+), 20 deletions(-) diff --git a/cmds-subvolume.c b/cmds-s

[PATCH v3] btrfs: Add test that checks rmdir(2) can delete a subvolume

2018-06-13 Thread Misono Tomohiro
ipped if kernel does not support the feature, which can be checked whether /sys/fs/btrfs/features/rmdir_subvol exists or not. Reviewed-by: David Sterba Signed-off-by: Misono Tomohiro --- changelog: v2 -> v3 - Skip test if kernel does not support the feature by checking sysfs

Re: [PATCH] btrfs-progs: check: Initialize all filed of btrfs_inode_item in insert_inode_item()

2018-06-07 Thread Misono Tomohiro
On 2018/06/07 21:22, David Sterba wrote: > On Thu, Jun 07, 2018 at 11:49:58AM +0900, Misono Tomohiro wrote: >> Initialize all filed of btrfs_inode_item to zero in order to prevent >> having some garbage, especially for flags field. > > Have you observed in practice or is it a

[PATCH] btrfs-progs: check: Initialize all filed of btrfs_inode_item in insert_inode_item()

2018-06-06 Thread Misono Tomohiro
Initialize all filed of btrfs_inode_item to zero in order to prevent having some garbage, especially for flags field. Signed-off-by: Misono Tomohiro --- check/mode-common.c | 6 +- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/check/mode-common.c b/check/mode-common.c index

Re: [PATCH v2 1/3] btrfs-progs: check: check symlinks with append/immutable flags

2018-06-06 Thread Misono Tomohiro
On 2018/05/15 10:33, Su Yue wrote: > Define new macro I_ERR_ODD_INODE_FLAGS to represents odd inode flags. > > Symlinks should never have append/immutable flags. > While processing inodes, if found a symlink with append/immutable > flags, mark the inode record with I_ERR_ODD_INODE_FLAGS. > >

[PATCH] btrfs: Check error of btrfs_iget() in btrfs_search_path_in_tree_user()

2018-06-04 Thread Misono Tomohiro
Signed-off-by: Misono Tomohiro --- Hi david, It seems that v8 patch I sent last week is missed and commit in misc-next tree is also a bit updated from v7, so I resend the fix as a separate patch. Please fold this patch to current misc-next (head is the commit to be fixed: "btrfs

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

2018-05-31 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 v8 3/3] btrfs: Add unprivileged version of ino_lookup ioctl

2018-05-30 Thread Misono Tomohiro
subvolume is also searched and filled. Note that the maximum length of path is shorter 256 (BTRFS_VOL_NAME_MAX+1) bytes than ino_lookup ioctl because of space of subvolume's name. Reviewed-by: Gu Jinxiang Reviewed-by: Qu Wenruo Tested-by: Gu Jinxiang Signed-off-by: Misono Tomohiro ---

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:

  1   2   3   4   >