]> git.apps.os.sepia.ceph.com Git - xfstests-dev.git/commitdiff
fuzzy: test other dquot ids
authorDarrick J. Wong <djwong@kernel.org>
Mon, 3 Jun 2024 20:12:58 +0000 (13:12 -0700)
committerZorro Lang <zlang@kernel.org>
Fri, 7 Jun 2024 10:19:41 +0000 (18:19 +0800)
Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Zorro Lang <zlang@kernel.org>
14 files changed:
common/fuzzy
common/populate
tests/xfs/425
tests/xfs/426
tests/xfs/427
tests/xfs/428
tests/xfs/429
tests/xfs/430
tests/xfs/487
tests/xfs/488
tests/xfs/489
tests/xfs/779
tests/xfs/780
tests/xfs/781

index ed79dbc7e5fecf2febaab694d8c23d83a5685e32..5621b98b7f5c7305323e3eb73593681a0f107570 100644 (file)
@@ -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
index 33f2db8d4ad8500f80871cddba670c41de9457d4..15f8055c2ca85c222a67e4309219a53c9d7eb153 100644 (file)
@@ -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
 
index c2e16ee87e5a9758798c328f39184295986687ca..5275e594b2007257162e9d9ee7471c5f2e645616 100755 (executable)
@@ -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
index e52b15f28d1338a49352bbdd2eb7106316285345..06f0f44b62a8563957073bbd8e1c2022af533731 100755 (executable)
@@ -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
index 19f45fbd81ae67ab9d1471ab0555ea6d9569d235..327cddd879b7d265072f6a6630fdc686625a5b11 100755 (executable)
@@ -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
index 338e659df2e5818e5504766c394008a651c82900..80b05b8450da8b8621acdfe29a3a96befd83812f 100755 (executable)
@@ -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
index a4aeb6e4409475683bb9a25f61cb71bd36e85fb7..5fa3b2ce29b4cdf061509648cb4641a4fe8417e3 100755 (executable)
@@ -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
index d94f65bd142d1e198d4cd9d89f12960d06e1721e..6f5c772dfbb1f25c775f7dfa300254cc0c765b9f 100755 (executable)
@@ -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
index 337541bbcd7b1daed46b840a3fd3750f03908002..a68859395080b79dbc10283f8fd76074727bd6de 100755 (executable)
@@ -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
index 43477689645780f5a1180617b3df0631126852ab..0d54ab8c7da4639f37aee921f1aebd82dae9106a 100755 (executable)
@@ -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
index c70e674cccb385939785e740ac13ffba6c8989fa..012416f9890f9e6dbbb1f05e8c6193b75f2d548e 100755 (executable)
@@ -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
index fe0de3087ad0e22b0f2eb558fc59c1e6f99b3593..05f27186328683df581257ec865b34496f05d41f 100755 (executable)
@@ -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
index 0a2347353842881835b421364ef1b9c886d3fa5d..9dd8f4527e33ec71227f18b44e0a90b2e4e3c5b1 100755 (executable)
@@ -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
index ada0f8a1caec1728616b54e9d8b71d29ebaa7d58..604c9bdd8706f4efdeaea1031f51635c98129f74 100755 (executable)
@@ -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