[PATCH] btrfs: qgroup: fix quota disable during rescan

2015-11-06 Thread Justin Maggard
There's a race condition that leads to a NULL pointer dereference if you disable quotas while a quota rescan is running. To fix this, we just need to wait for the quota rescan worker to actually exit before tearing down the quota structures. Signed-off-by: Justin Maggard <jmagg...@netgear.

[PATCH] btrfs-progs: fix memory leak with missing device

2016-07-28 Thread Justin Maggard
In read_one_chunk(), we may add an empty entry for a missing device. However, this entry wasn't being added to the dev_list, and so it never got freed. Signed-off-by: Justin Maggard <jmagg...@netgear.com> --- volumes.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/volumes.c b/vol

[PATCH] btrfs-progs: Fix an infinite loop in btrfs_next_bg

2017-06-09 Thread Justin Maggard
: Fix a bug causing btrfs-find-root to skip first chunk) Signed-off-by: Justin Maggard <jmagg...@netgear.com> --- volumes.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/volumes.c b/volumes.c index b350e259..8c0c10ce 100644 --- a/volumes.c +++ b/volumes.c @@ -1278,6 +1278,8

Re: [PATCH] btrfs-progs: fix memory leak with missing device

2016-07-29 Thread David Sterba
On Thu, Jul 28, 2016 at 10:44:11AM -0700, Justin Maggard wrote: > In read_one_chunk(), we may add an empty entry for a missing device. > However, this entry wasn't being added to the dev_list, and so it never > got freed. > > Signed-off-by: Justin Maggard <jmagg...@netgear.com

Re: [PATCH] btrfs-progs: Fix an infinite loop in btrfs_next_bg

2017-07-12 Thread David Sterba
that situation, and > jumping to the next bg if necessary. > > Fixes: e2e0dae9 (btrfs-progs: volume: Fix a bug causing btrfs-find-root to > skip first chunk) > Signed-off-by: Justin Maggard <jmagg...@netgear.com> Applied, thanks. Do you have a minimal image for testing? --

[PATCH] btrfs: qgroup: exit the rescan worker during umount

2015-09-02 Thread Justin Maggard
is good enough to allow me to unmount without crashing. Signed-off-by: Justin Maggard <jmagg...@netgear.com> --- fs/btrfs/qgroup.c | 9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c index d904ee1..5bfcee9 100644 --- a/fs/btrfs/qg

[PATCH v2] btrfs: qgroup: exit the rescan worker during umount

2015-09-02 Thread Justin Maggard
, but that's a much larger change. This small change is good enough to allow me to unmount without crashing. Signed-off-by: Justin Maggard <jmagg...@netgear.com> --- fs/btrfs/qgroup.c | 9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/fs/btrfs/qgroup.c b/fs

[PATCH] btrfs: Fix quota reservation leak on preallocated files

2017-10-30 Thread Justin Maggard
we're left with both the qgroup and qgroup reservation accounting for the same space. This commit adds the missing btrfs_qgroup_free_data() call in the case of BTRFS_ORDERED_PREALLOC extents. Signed-off-by: Justin Maggard <jmagg...@netgear.com> --- fs/btrfs/inode.c | 2 ++ 1 file chan

Re: [PATCH v2] btrfs: qgroup: exit the rescan worker during umount

2015-09-22 Thread David Sterba
unmount without > crashing. > > Signed-off-by: Justin Maggard <jmagg...@netgear.com> Can you please submit the test you've used to trigger the crash to fstests? Reviewed-by: David Sterba <dste...@suse.com> -- To unsubscribe from this list: send the line "unsubscribe linux-

Re: [PATCH] btrfs: qgroup: Fix root item corruption when multiple same source snapshiots are created with quota enabled

2018-03-07 Thread David Sterba
t; > dirty roots not recorded in current transaction, making root item of > > source subvolume not updated. > > > > Fix it by forcing recording source subvolume in current transaction > > before qgroup sub-transaction commit. > > > > Reported-by: Justin Magga

[PATCH v3] btrfs: qgroup: exit the rescan worker during umount

2015-11-04 Thread Justin Maggard
is good enough to allow me to unmount without crashing. v3: avoid more races by calling btrfs_qgroup_wait_for_completion() Signed-off-by: Justin Maggard <jmagg...@netgear.com> --- fs/btrfs/disk-io.c | 3 +++ fs/btrfs/qgroup.c | 9 ++--- 2 files changed, 9 insertions(+), 3 deletions(-)

[PATCH v2] btrfs: test unmount during quota rescan

2015-11-04 Thread Justin Maggard
This test case tests if we are able to unmount a filesystem while a quota rescan is running. Up to now (4.3) this would result in a kernel NULL pointer dereference. Fixed by patch (btrfs: qgroup: exit the rescan worker during umount). Signed-off-by: Justin Maggard <jmagg...@netgear.

[PATCH] btrfs: test quota disable during quota rescan

2015-11-06 Thread Justin Maggard
This test case tests if we are able to disable quotas on a filesystem while a quota rescan is running. Up to now (4.3) this would result in a kernel NULL pointer dereference. Fixed by patch (btrfs: qgroup: fix quota disable during rescan). Signed-off-by: Justin Maggard <jmagg...@netgear.

[PATCH] btrfs: test for qgroup reservation leaks with prealloc

2017-10-30 Thread Justin Maggard
quota reservation leak on preallocated files" Signed-off-by: Justin Maggard <jmagg...@netgear.com> --- tests/btrfs/153 | 72 + tests/btrfs/153.out | 2 ++ tests/btrfs/group | 1 + 3 files changed, 75 insertions(+) create mode 100755

Re: [PATCH] btrfs: test quota disable during quota rescan

2015-11-08 Thread Dave Chinner
.3) this would result > > in a kernel NULL pointer dereference. > > > > Fixed by patch (btrfs: qgroup: fix quota disable during rescan). > > > > Signed-off-by: Justin Maggard <jmagg...@netgear.com> > Reviewed-by: Filipe Manana <fdman...@suse.com> > > Look

Re: [PATCH v2] btrfs: qgroup: exit the rescan worker during umount

2015-09-25 Thread Justin Maggard
small change is good enough to allow me to unmount without >> crashing. >> >> Signed-off-by: Justin Maggard <jmagg...@netgear.com> > > Can you please submit the test you've used to trigger the crash to > fstests? > Sure, I've got a reproducer coded up for xfstests now.

[PATCH] btrfs: qgroup: Fix root item corruption when multiple same source snapshiots are created with quota enabled

2017-12-18 Thread Qu Wenruo
-by: Justin Maggard <jmagg...@netgear.com> Signed-off-by: Qu Wenruo <w...@suse.com> --- fs/btrfs/transaction.c | 10 +- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c index ddae813c01dd..f645e5de5fa5 100644 --- a/fs/btrfs/t

Re: [PATCH] btrfs: Fix quota reservation leak on preallocated files

2017-10-30 Thread Qu Wenruo
xtents. > > Signed-off-by: Justin Maggard <jmagg...@netgear.com> Reviewed-by: Qu Wenruo <w...@suse.com> Thanks, Qu > --- > fs/btrfs/inode.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c > index d94e3

[PATCH] btrfs: test if receive with qgroups corrupts metadata

2017-10-30 Thread Justin Maggard
) as the culprit. Signed-off-by: Justin Maggard <jmagg...@netgear.com> --- tests/btrfs/152 | 102 tests/btrfs/152.out | 13 +++ tests/btrfs/group | 1 + 3 files changed, 116 insertions(+) create mode 100755 tests/btrfs/152 creat

Re: [PATCH] btrfs: qgroup: fix quota disable during rescan

2015-11-07 Thread Filipe Manana
before tearing down > the quota structures. > > Signed-off-by: Justin Maggard <jmagg...@netgear.com> Justin, it looks good and it's a very good find. But can you please give a more detailed change log? You mention a NULL pointer dereference, but you don't say where, which var

Re: [PATCH v2] btrfs: qgroup: exit the rescan worker during umount

2015-09-26 Thread Filipe Manana
gt;>> close_ctree(), but we do nothing to stop the qgroup rescan. We should >>> probably be doing the same for qgroup rescan, but that's a much larger >>> change. This small change is good enough to allow me to unmount without >>> crashing. >>> >>> S

Re: [PATCH] btrfs: qgroup: Fix root item corruption when multiple same source snapshiots are created with quota enabled

2018-02-02 Thread Filipe Manana
t; > Fix it by forcing recording source subvolume in current transaction > before qgroup sub-transaction commit. > > Reported-by: Justin Maggard <jmagg...@netgear.com> > Signed-off-by: Qu Wenruo <w...@suse.com> Reviewed-by: Filipe Manana <fdman...@suse.com> Looks goo

Re: [PATCH v3] btrfs: qgroup: exit the rescan worker during umount

2015-11-05 Thread Filipe Manana
about what changes between versions should go after the "---" (triple dash) below. You should also have mentioned what changed between v2 and v1 as well (see https://btrfs.wiki.kernel.org/index.php/Developer%27s_FAQ#Repeated_submissions). > > Signed-off-by: Justin Maggard <jmagg...@n

Re: [PATCH v2] btrfs: test unmount during quota rescan

2015-11-05 Thread Filipe Manana
(btrfs: qgroup: exit the rescan worker during umount). > > Signed-off-by: Justin Maggard <jmagg...@netgear.com> Reviewed-by: Filipe Manana <fdman...@suse.com> > --- Btw, for future patches/versions, here after the --- you should mention what changed between versions of the p

Re: [PATCH v2] btrfs: qgroup: exit the rescan worker during umount

2015-10-08 Thread Filipe Manana
e and scrub operations in > close_ctree(), but we do nothing to stop the qgroup rescan. We should > probably be doing the same for qgroup rescan, but that's a much larger > change. This small change is good enough to allow me to unmount without > crashing. > > Signed-off-by: Justin

Re: [PATCH] btrfs: test quota disable during quota rescan

2015-11-07 Thread Filipe Manana
h (btrfs: qgroup: fix quota disable during rescan). > > Signed-off-by: Justin Maggard <jmagg...@netgear.com> Reviewed-by: Filipe Manana <fdman...@suse.com> Looks good and it triggers the bug without the btrfs kernel fix. A side note, and if you would like you could do as a sepa

Re: [PATCH] btrfs: test unmount during quota rescan

2015-10-08 Thread Filipe Manana
le of the patch that fixes this problem ("btrfs: qgroup: exit the rescan worker during umount"). > > Signed-off-by: Justin Maggard <jmagg...@netgear.com> > --- > tests/btrfs/104 | 85 > + > tests/btrfs/104.ou

Re: [PATCH] btrfs: test unmount during quota rescan

2015-10-08 Thread Dave Chinner
esult > > in a kernel NULL pointer dereference. > > Please mention here the title of the patch that fixes this problem > ("btrfs: qgroup: exit the rescan worker during umount"). > > > > > Signed-off-by: Justin Maggard

[PATCH] btrfs: test if receive with qgroups corrupts metadata

2017-07-20 Thread Justin Maggard
This test case does some concurrent send/receives with qgroups enabled. Currently (4.13-rc1) this usually results in btrfs check errors, and often also results in a WARN_ON in record_root_in_trans(). Bisecting points to 6426c7ad697d (btrfs: qgroup: Fix qgroup accounting when creating snapshot) as

Re: [PATCH] btrfs: test if receive with qgroups corrupts metadata

2017-10-30 Thread Qu Wenruo
c7ad697d (btrfs: qgroup: Fix qgroup accounting > when creating snapshot) as the culprit. Thanks for the report, I'll look into it. BTW can this only be reproduced by concurrent run? Will single thread also cause the problem? Thanks, Qu > > Signed-off-by: Justin Maggard <jmagg...@netgea

Re: [PATCH] btrfs: qgroup: Fix root item corruption when multiple same source snapshiots are created with quota enabled

2018-05-03 Thread David Sterba
; Fix it by forcing recording source subvolume in current transaction > before qgroup sub-transaction commit. > > Reported-by: Justin Maggard <jmagg...@netgear.com> > Signed-off-by: Qu Wenruo <w...@suse.com> > --- > fs/btrfs/transaction.c | 10 +- > 1 fi

Re: [PATCH] btrfs: qgroup: Fix root item corruption when multiple same source snapshiots are created with quota enabled

2018-05-03 Thread Qu Wenruo
rent transaction, making root item of >> source subvolume not updated. >> >> Fix it by forcing recording source subvolume in current transaction >> before qgroup sub-transaction commit. >> >> Reported-by: Justin Maggard <jmagg...@netgear.com> >> Signed-

Re: [PATCH] btrfs: test if receive with qgroups corrupts metadata

2017-10-30 Thread Justin Maggard
by concurrent run? > Will single thread also cause the problem? > > Thanks, > Qu I ran 1000 single-threaded passes with no failures, so I'm pretty sure there must be multiple concurrent receives running to reproduce it. -Justin >> >> Si