Skip to contentSkip to conversation

fstests: btrfs: Add test for corrupted childless qgroup numbers

PATCH New Qu Wenruo 1 participant 1 message Aug 13, 2018

lore
Share & tools
lore

Qu Wenruo

author
#0 lore raw

PATCH 1/1 fstests: btrfs: Add test for corrupted childless qgroup numbers

This bug is exposed by populating a high level qgroup, and then make it childless with old qgroup numbers, and finally do rescan.

Normally rescan should zero out all qgroups' accounting number, but due to a kernel bug which won't mark childless qgroups dirty, their on-disk data is never updated, thus old numbers remain and cause qgroup corruption.

Fixed by the following kernel patch:
"btrfs: qgroup: Dirty all qgroups before rescan"

---
changelog:
v2:
Change the adjective for the offending group, from "orphan" to "childless"
v3:
Don't use _run_btrfs_util_prog any more, use $BTRFS_UTIL_PROG directly.
Introduce new filter, _filter_btrfs_qgroup_assign_warnings(), to handle different possible behaviors of "btrfs qgroup assign". Modify golden output to cooperate with above change. Add the missing tailing dot for each sentence.
Fix grammar errors.

---
 common/filter.btrfs |  9 +++++
 tests/btrfs/170     | 87 +++++++++++++++++++++++++++++++++++++++++++++
 tests/btrfs/170.out |  2 ++
 tests/btrfs/group   |  1 +
 4 files changed, 99 insertions(+)
 create mode 100755 tests/btrfs/170
 create mode 100644 tests/btrfs/170.out
common/filter.btrfs +9 -0
index aaff2278..faeef7a2 100644
@@ -88,5 +88,14 @@ _filter_btrfs_prop_error()
 	fi
 }
 
+# filter warning messages caused "btrfs quota assign/remove" command
+# Since qgroup relationship change could cause qgroup inconsistent, it would
+# either trigger a qgroup rescan, or warning message.
+_filter_btrfs_qgroup_assign_warnings()
+{
+	sed -e "/Quota data changed, rescan scheduled/d" \
+	    -e "/quotas may be inconsistent, rescan needed/d"
+}
+
 # make sure this script returns success
 /bin/true
tests/btrfs/170 new file +87 -0

87 lines not on this page · raw message

tests/btrfs/170.out new file +2 -0
new file mode 100644
index 00000000..f37552df
@@ -0,0 +1,2 @@
+QA output created by 170
+Silence is golden
tests/btrfs/group +1 -0
index b616c73d..339c9771 100644
@@ -172,3 +172,4 @@
 167 auto quick replace volume
 168 auto quick send
 169 auto quick send
+170 auto quick qgroup
Signature · 1 line
2.18.0