On Tue, Aug 06, 2019 at 10:05:07PM +0800, Qu Wenruo wrote: > When we try to delete qgroups, we're pretty cautious, we make sure both > qgroups exist and there is a relationship between them, then try to > delete the relation. > > This behavior is OK, but the problem is we need to two relation items, > and if we failed the first item deletion, we error out, leaving the > other relation item in qgroup tree. > > Sometimes the error from del_qgroup_relation_item() could just be > -ENOENT, thus we can ignore that error and continue without any problem. > > Further more, such cautious behavior makes qgroup relation deletion > impossible for orphan relation items. > > This patch will enhance __del_qgroup_relation(): > - If both qgroups and their relation items exist > Go the regular deletion routine and update their accounting if needed. > > - If any qgroup or relation item doesn't exist > Then we still try to delete the orphan items anyway, but don't trigger > the accounting update. > > By this, we try our best to remove relation items, and can handle orphan > relation items properly, while still keep the existing behavior for good > qgroup tree. > > Reported-by: Andrei Borzenkov <arvidjaar@xxxxxxxxx> > Signed-off-by: Qu Wenruo <wqu@xxxxxxxx> > --- > changelog: > v2: > - Fix a condition for checking either @parent or @member is not found Patch replaced in misc-next, thanks.
