summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDarrick J. Wong <djwong@kernel.org>2024-06-03 13:12:58 -0700
committerZorro Lang <zlang@kernel.org>2024-06-07 18:19:41 +0800
commit2da0c88e3481c97d04a6d0ec5eb74a93b5c18884 (patch)
treeb82c9ad03eafbdccde6b008fdf8940bd690c5849
parentd67b0d11106db47f7938cf141d9600d37b9b8b13 (diff)
fuzzy: test other dquot ids
Signed-off-by: "Darrick J. Wong" <djwong@kernel.org> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Zorro Lang <zlang@kernel.org>
-rw-r--r--common/fuzzy14
-rw-r--r--common/populate14
-rwxr-xr-xtests/xfs/42510
-rwxr-xr-xtests/xfs/42610
-rwxr-xr-xtests/xfs/42710
-rwxr-xr-xtests/xfs/42810
-rwxr-xr-xtests/xfs/42910
-rwxr-xr-xtests/xfs/43010
-rwxr-xr-xtests/xfs/48710
-rwxr-xr-xtests/xfs/48810
-rwxr-xr-xtests/xfs/48910
-rwxr-xr-xtests/xfs/77910
-rwxr-xr-xtests/xfs/78010
-rwxr-xr-xtests/xfs/78110
14 files changed, 112 insertions, 36 deletions
diff --git a/common/fuzzy b/common/fuzzy
index ed79dbc7..5621b98b 100644
--- a/common/fuzzy
+++ b/common/fuzzy
@@ -680,6 +680,20 @@ _scratch_xfs_set_xattr_fuzz_types() {
SCRATCH_XFS_XATTR_FUZZ_TYPES=(EXTENTS_REMOTE3K EXTENTS_REMOTE4K LEAF NODE)
}
+# Sets the array SCRATCH_XFS_QUOTA_FUZZ_IDS to the list of dquot ids available
+# for fuzzing. By default, this list contains 0 (root), 4242 (non-root), and
+# 8484 (zero counts). Users can override this by setting
+# SCRATCH_XFS_LIST_FUZZ_QUOTAIDS in the environment.
+_scratch_xfs_set_quota_fuzz_ids() {
+ if [ -n "${SCRATCH_XFS_LIST_FUZZ_QUOTAIDS}" ]; then
+ mapfile -t SCRATCH_XFS_QUOTA_FUZZ_IDS < \
+ <(echo "${SCRATCH_XFS_LIST_FUZZ_QUOTAIDS}" | tr '[ ,]' '[\n\n]')
+ return
+ fi
+
+ SCRATCH_XFS_QUOTA_FUZZ_IDS=(0 4242 8484)
+}
+
# Grab the list of available fuzzing verbs
_scratch_xfs_list_fuzz_verbs() {
if [ -n "${SCRATCH_XFS_LIST_FUZZ_VERBS}" ]; then
diff --git a/common/populate b/common/populate
index 33f2db8d..15f8055c 100644
--- a/common/populate
+++ b/common/populate
@@ -360,6 +360,20 @@ _scratch_xfs_populate() {
mknod "${SCRATCH_MNT}/S_IFBLK" b 1 1
mknod "${SCRATCH_MNT}/S_IFIFO" p
+ # non-root dquot
+ local nonroot_id=4242
+ echo "${nonroot_id}" > "${SCRATCH_MNT}/non_root_dquot"
+ chown "${nonroot_id}:${nonroot_id}" "${SCRATCH_MNT}/non_root_dquot"
+ $XFS_IO_PROG -c "chproj ${nonroot_id}" "${SCRATCH_MNT}/non_root_dquot"
+
+ # empty dquot
+ local empty_id=8484
+ echo "${empty_id}" > "${SCRATCH_MNT}/empty_dquot"
+ chown "${empty_id}:${empty_id}" "${SCRATCH_MNT}/empty_dquot"
+ $XFS_IO_PROG -c "chproj ${empty_id}" "${SCRATCH_MNT}/empty_dquot"
+ chown "0:0" "${SCRATCH_MNT}/empty_dquot"
+ $XFS_IO_PROG -c "chproj 0" "${SCRATCH_MNT}/empty_dquot"
+
# special file with an xattr
setfacl -P -m u:nobody:r ${SCRATCH_MNT}/S_IFCHR
diff --git a/tests/xfs/425 b/tests/xfs/425
index c2e16ee8..5275e594 100755
--- a/tests/xfs/425
+++ b/tests/xfs/425
@@ -27,9 +27,13 @@ echo "Format and populate"
_scratch_populate_cached nofill > $seqres.full 2>&1
echo "${MOUNT_OPTIONS}" | grep -q 'usrquota' || _notrun "user quota disabled"
-echo "Fuzz user 0 dquot"
-_scratch_xfs_fuzz_metadata '' 'offline' "dquot -u 0" >> $seqres.full
-echo "Done fuzzing dquot"
+_scratch_xfs_set_quota_fuzz_ids
+
+for id in "${SCRATCH_XFS_QUOTA_FUZZ_IDS[@]}"; do
+ echo "Fuzz user $id dquot"
+ _scratch_xfs_fuzz_metadata '' 'offline' "dquot -u $id" >> $seqres.full
+ echo "Done fuzzing dquot"
+done
# success, all done
status=0
diff --git a/tests/xfs/426 b/tests/xfs/426
index e52b15f2..06f0f44b 100755
--- a/tests/xfs/426
+++ b/tests/xfs/426
@@ -27,9 +27,13 @@ echo "Format and populate"
_scratch_populate_cached nofill > $seqres.full 2>&1
echo "${MOUNT_OPTIONS}" | grep -q 'usrquota' || _notrun "user quota disabled"
-echo "Fuzz user 0 dquot"
-_scratch_xfs_fuzz_metadata '' 'online' "dquot -u 0" >> $seqres.full
-echo "Done fuzzing dquot"
+_scratch_xfs_set_quota_fuzz_ids
+
+for id in "${SCRATCH_XFS_QUOTA_FUZZ_IDS[@]}"; do
+ echo "Fuzz user $id dquot"
+ _scratch_xfs_fuzz_metadata '' 'online' "dquot -u $id" >> $seqres.full
+ echo "Done fuzzing dquot"
+done
# success, all done
status=0
diff --git a/tests/xfs/427 b/tests/xfs/427
index 19f45fbd..327cddd8 100755
--- a/tests/xfs/427
+++ b/tests/xfs/427
@@ -27,9 +27,13 @@ echo "Format and populate"
_scratch_populate_cached nofill > $seqres.full 2>&1
echo "${MOUNT_OPTIONS}" | grep -q 'grpquota' || _notrun "group quota disabled"
-echo "Fuzz group 0 dquot"
-_scratch_xfs_fuzz_metadata '' 'offline' "dquot -g 0" >> $seqres.full
-echo "Done fuzzing dquot"
+_scratch_xfs_set_quota_fuzz_ids
+
+for id in "${SCRATCH_XFS_QUOTA_FUZZ_IDS[@]}"; do
+ echo "Fuzz group $id dquot"
+ _scratch_xfs_fuzz_metadata '' 'offline' "dquot -g $id" >> $seqres.full
+ echo "Done fuzzing dquot"
+done
# success, all done
status=0
diff --git a/tests/xfs/428 b/tests/xfs/428
index 338e659d..80b05b84 100755
--- a/tests/xfs/428
+++ b/tests/xfs/428
@@ -27,9 +27,13 @@ echo "Format and populate"
_scratch_populate_cached nofill > $seqres.full 2>&1
echo "${MOUNT_OPTIONS}" | grep -q 'grpquota' || _notrun "group quota disabled"
-echo "Fuzz group 0 dquot"
-_scratch_xfs_fuzz_metadata '' 'online' "dquot -g 0" >> $seqres.full
-echo "Done fuzzing dquot"
+_scratch_xfs_set_quota_fuzz_ids
+
+for id in "${SCRATCH_XFS_QUOTA_FUZZ_IDS[@]}"; do
+ echo "Fuzz group $id dquot"
+ _scratch_xfs_fuzz_metadata '' 'online' "dquot -g $id" >> $seqres.full
+ echo "Done fuzzing dquot"
+done
# success, all done
status=0
diff --git a/tests/xfs/429 b/tests/xfs/429
index a4aeb6e4..5fa3b2ce 100755
--- a/tests/xfs/429
+++ b/tests/xfs/429
@@ -27,9 +27,13 @@ echo "Format and populate"
_scratch_populate_cached nofill > $seqres.full 2>&1
echo "${MOUNT_OPTIONS}" | grep -q 'prjquota' || _notrun "project quota disabled"
-echo "Fuzz project 0 dquot"
-_scratch_xfs_fuzz_metadata '' 'offline' "dquot -p 0" >> $seqres.full
-echo "Done fuzzing dquot"
+_scratch_xfs_set_quota_fuzz_ids
+
+for id in "${SCRATCH_XFS_QUOTA_FUZZ_IDS[@]}"; do
+ echo "Fuzz project $id dquot"
+ _scratch_xfs_fuzz_metadata '' 'offline' "dquot -p $id" >> $seqres.full
+ echo "Done fuzzing dquot"
+done
# success, all done
status=0
diff --git a/tests/xfs/430 b/tests/xfs/430
index d94f65bd..6f5c772d 100755
--- a/tests/xfs/430
+++ b/tests/xfs/430
@@ -27,9 +27,13 @@ echo "Format and populate"
_scratch_populate_cached nofill > $seqres.full 2>&1
echo "${MOUNT_OPTIONS}" | grep -q 'prjquota' || _notrun "project quota disabled"
-echo "Fuzz project 0 dquot"
-_scratch_xfs_fuzz_metadata '' 'online' "dquot -p 0" >> $seqres.full
-echo "Done fuzzing dquot"
+_scratch_xfs_set_quota_fuzz_ids
+
+for id in "${SCRATCH_XFS_QUOTA_FUZZ_IDS[@]}"; do
+ echo "Fuzz project $id dquot"
+ _scratch_xfs_fuzz_metadata '' 'online' "dquot -p $id" >> $seqres.full
+ echo "Done fuzzing dquot"
+done
# success, all done
status=0
diff --git a/tests/xfs/487 b/tests/xfs/487
index 337541bb..a6885939 100755
--- a/tests/xfs/487
+++ b/tests/xfs/487
@@ -28,9 +28,13 @@ echo "Format and populate"
_scratch_populate_cached nofill > $seqres.full 2>&1
echo "${MOUNT_OPTIONS}" | grep -q 'usrquota' || _notrun "user quota disabled"
-echo "Fuzz user 0 dquot"
-_scratch_xfs_fuzz_metadata '' 'none' "dquot -u 0" >> $seqres.full
-echo "Done fuzzing dquot"
+_scratch_xfs_set_quota_fuzz_ids
+
+for id in "${SCRATCH_XFS_QUOTA_FUZZ_IDS[@]}"; do
+ echo "Fuzz user $id dquot"
+ _scratch_xfs_fuzz_metadata '' 'none' "dquot -u $id" >> $seqres.full
+ echo "Done fuzzing dquot"
+done
# success, all done
status=0
diff --git a/tests/xfs/488 b/tests/xfs/488
index 43477689..0d54ab8c 100755
--- a/tests/xfs/488
+++ b/tests/xfs/488
@@ -28,9 +28,13 @@ echo "Format and populate"
_scratch_populate_cached nofill > $seqres.full 2>&1
echo "${MOUNT_OPTIONS}" | grep -q 'grpquota' || _notrun "group quota disabled"
-echo "Fuzz group 0 dquot"
-_scratch_xfs_fuzz_metadata '' 'none' "dquot -g 0" >> $seqres.full
-echo "Done fuzzing dquot"
+_scratch_xfs_set_quota_fuzz_ids
+
+for id in "${SCRATCH_XFS_QUOTA_FUZZ_IDS[@]}"; do
+ echo "Fuzz group $id dquot"
+ _scratch_xfs_fuzz_metadata '' 'none' "dquot -g $id" >> $seqres.full
+ echo "Done fuzzing dquot"
+done
# success, all done
status=0
diff --git a/tests/xfs/489 b/tests/xfs/489
index c70e674c..012416f9 100755
--- a/tests/xfs/489
+++ b/tests/xfs/489
@@ -28,9 +28,13 @@ echo "Format and populate"
_scratch_populate_cached nofill > $seqres.full 2>&1
echo "${MOUNT_OPTIONS}" | grep -q 'prjquota' || _notrun "project quota disabled"
-echo "Fuzz project 0 dquot"
-_scratch_xfs_fuzz_metadata '' 'none' "dquot -p 0" >> $seqres.full
-echo "Done fuzzing dquot"
+_scratch_xfs_set_quota_fuzz_ids
+
+for id in "${SCRATCH_XFS_QUOTA_FUZZ_IDS[@]}"; do
+ echo "Fuzz project $id dquot"
+ _scratch_xfs_fuzz_metadata '' 'none' "dquot -p $id" >> $seqres.full
+ echo "Done fuzzing dquot"
+done
# success, all done
status=0
diff --git a/tests/xfs/779 b/tests/xfs/779
index fe0de308..05f27186 100755
--- a/tests/xfs/779
+++ b/tests/xfs/779
@@ -29,9 +29,13 @@ echo "Format and populate"
_scratch_populate_cached nofill > $seqres.full 2>&1
echo "${MOUNT_OPTIONS}" | grep -q 'usrquota' || _notrun "user quota disabled"
-echo "Fuzz user 0 dquot"
-_scratch_xfs_fuzz_metadata '' 'both' "dquot -u 0" >> $seqres.full
-echo "Done fuzzing dquot"
+_scratch_xfs_set_quota_fuzz_ids
+
+for id in "${SCRATCH_XFS_QUOTA_FUZZ_IDS[@]}"; do
+ echo "Fuzz user $id dquot"
+ _scratch_xfs_fuzz_metadata '' 'both' "dquot -u $id" >> $seqres.full
+ echo "Done fuzzing dquot"
+done
# success, all done
status=0
diff --git a/tests/xfs/780 b/tests/xfs/780
index 0a234735..9dd8f452 100755
--- a/tests/xfs/780
+++ b/tests/xfs/780
@@ -29,9 +29,13 @@ echo "Format and populate"
_scratch_populate_cached nofill > $seqres.full 2>&1
echo "${MOUNT_OPTIONS}" | grep -q 'grpquota' || _notrun "group quota disabled"
-echo "Fuzz group 0 dquot"
-_scratch_xfs_fuzz_metadata '' 'both' "dquot -g 0" >> $seqres.full
-echo "Done fuzzing dquot"
+_scratch_xfs_set_quota_fuzz_ids
+
+for id in "${SCRATCH_XFS_QUOTA_FUZZ_IDS[@]}"; do
+ echo "Fuzz group $id dquot"
+ _scratch_xfs_fuzz_metadata '' 'both' "dquot -g $id" >> $seqres.full
+ echo "Done fuzzing dquot"
+done
# success, all done
status=0
diff --git a/tests/xfs/781 b/tests/xfs/781
index ada0f8a1..604c9bdd 100755
--- a/tests/xfs/781
+++ b/tests/xfs/781
@@ -29,9 +29,13 @@ echo "Format and populate"
_scratch_populate_cached nofill > $seqres.full 2>&1
echo "${MOUNT_OPTIONS}" | grep -q 'prjquota' || _notrun "project quota disabled"
-echo "Fuzz project 0 dquot"
-_scratch_xfs_fuzz_metadata '' 'both' "dquot -p 0" >> $seqres.full
-echo "Done fuzzing dquot"
+_scratch_xfs_set_quota_fuzz_ids
+
+for id in "${SCRATCH_XFS_QUOTA_FUZZ_IDS[@]}"; do
+ echo "Fuzz project $id dquot"
+ _scratch_xfs_fuzz_metadata '' 'both' "dquot -p $id" >> $seqres.full
+ echo "Done fuzzing dquot"
+done
# success, all done
status=0