Skip to contentSkip to conversation

xfstests: random fixes and improvements

PATCH In review Dave Chinner 4 participants 18 messages Jul 26, 2012 – Aug 28, 2012

lore
Share & tools
lore
#1 lore raw

PATCH 1/4 xfstests: test 110 sometimes fails to unmount scratch dev

In reply to Dave Chinner

From: Dave Chinner <[email protected]>

It runs a bunch of rm processes in the background, then immediately calls _check_scratch_fs without waiting for them to complete, hence the unmount can fail with a busy filesystem error.

---
 110 |    1 +
 1 file changed, 1 insertion(+)
110 +1 -0
index aad5835..c58e6c9 100755
@@ -69,6 +69,7 @@ do
     let I=$I+1
     [ $[$I % 1000] -eq 0 ] && echo "Created $I/$E"
 done
+wait
 
 sync
 
Signature · 6 lines
1.7.10

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
#5 lore raw

PATCH 2/4 xfstests: loop devices vs umount stupidity

In reply to Dave Chinner

From: Dave Chinner <[email protected]>

Unmounting a fileystem mounted on a loop device doesn't always tear down the loop device. Its racy, and it causes tests to randomly fail.

To avoid that, we have to use umount -d to ensure that we destroy loop devices under filesystems in case the kernel doesn't tear it down automatically to prevent the test from failing. However, if the kernel does tear it down automatically, umount now issues a warning that it couldn't tear down the loop device because it couldn't find it, and that causes the test to fail. *facepalm*

So, convert all the loop device unmounts to use -d, and direct the output of all of them to /dev/null.

---
 049 |    8 ++++----
 073 |    2 +-
 078 |    4 ++--
 216 |    2 +-
 217 |    2 +-
 250 |    4 ++--
 6 files changed, 11 insertions(+), 11 deletions(-)
049 +4 -4
index c6c4faa..c3065ad 100755
@@ -30,8 +30,8 @@ echo "QA output created by $seq"
 _cleanup()
 {
     cd /
-    umount $SCRATCH_MNT/test2 > /dev/null 2>&1
-    umount $SCRATCH_MNT/test > /dev/null 2>&1
+    umount -d $SCRATCH_MNT/test2 > /dev/null 2>&1
+    umount -d $SCRATCH_MNT/test > /dev/null 2>&1
     rm -f $tmp.*
 
     if [ -w $seq.full ]
@@ -124,11 +124,11 @@ rm -rf $SCRATCH_MNT/test/* >> $seq.full 2>&1 \
     || _fail "!!! clean failed"
 
 _log "umount ext2 on xfs"
-umount $SCRATCH_MNT/test2 >> $seq.full 2>&1 \
+umount -d $SCRATCH_MNT/test2 >> $seq.full 2>&1 \
     || _fail "!!! umount ext2 failed"
 
 _log "umount xfs"
-umount $SCRATCH_MNT/test >> $seq.full 2>&1 \
+umount -d $SCRATCH_MNT/test >> $seq.full 2>&1 \
     || _fail "!!! umount xfs failed"
 
 echo "--- mounts at end (before cleanup)" >> $seq.full
073 +1 -1
index 18257d4..9605662 100755
@@ -120,7 +120,7 @@ _verify_copy()
 
 	echo unmounting and removing new image
 	umount $source_dir
-	umount -d $target_dir
+	umount -d $target_dir > /dev/null 2>&1
 	rm -f $target
 }
 
078 +2 -2
index 5cb66df..7af552e 100755
@@ -37,7 +37,7 @@ _cleanup()
 {
     cd /
     rm -f $tmp.*
-    umount $LOOP_MNT 2>/dev/null
+    umount -d $LOOP_MNT 2>/dev/null
     rmdir $LOOP_MNT
     _cleanup_testdir
 }
@@ -98,7 +98,7 @@ _grow_loop()
 	$XFS_GROWFS_PROG $LOOP_MNT 2>&1 |  _filter_growfs 2>&1
 
 	echo "*** unmount"
-	umount $LOOP_MNT
+	umount -d $LOOP_MNT > /dev/null 2>&1
 
 	# Large grows takes forever to check..
 	if [ "$check" -gt "0" ]
216 +1 -1
index 7c046f5..71e6dd7 100755
@@ -63,7 +63,7 @@ _do_mkfs()
 			-d name=$LOOP_DEV,size=${i}g |grep log
 		mount -o loop -t xfs $LOOP_DEV $LOOP_MNT
 		echo "test write" > $LOOP_MNT/test
-		umount $LOOP_MNT
+		umount -d $LOOP_MNT > /dev/null 2>&1
 	done
 }
 # make large holey file
217 +1 -1
index 19540ad..ef0761e 100755
@@ -65,7 +65,7 @@ _do_mkfs()
 			-d name=$LOOP_DEV,size=${i}g |grep log
 		mount -o loop -t xfs $LOOP_DEV $LOOP_MNT
 		echo "test write" > $LOOP_MNT/test
-		umount $LOOP_MNT
+		umount -d $LOOP_MNT > /dev/null 2>&1
 	done
 }
 # make large holey file
250 +2 -2
index 92e3cc5..9eca2b6 100755
@@ -34,7 +34,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _cleanup()
 {
 	cd /
-	umount $LOOP_MNT 2>/dev/null
+	umount -d $LOOP_MNT 2>/dev/null
 	rm -f $LOOP_DEV
 	rmdir $LOOP_MNT
 	_cleanup_testdir
@@ -85,7 +85,7 @@ _test_loop()
 	xfs_io -f -c "resvsp 0 $fsize" $LOOP_MNT/foo | _filter_io
 
 	echo "*** unmount loop filesystem"
-	umount $LOOP_MNT
+	umount -d $LOOP_MNT > /dev/null 2>&1
 
 	echo "*** check loop filesystem"
 	 _check_xfs_filesystem $LOOP_DEV none none
Signature · 6 lines
1.7.10

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
#10 lore raw

PATCH 3/4 xfstests: _check_quota_usage needs to unmount to get XFS quotacheck

In reply to Dave Chinner

From: Dave Chinner <[email protected]>

Remount won't run a quota check - it's only done during mount. Hence all quota tests using this check function are not actually validating XFS filesystems right now.

---
 common.quota |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
common.quota +8 -2
index 9736306..2fa784b 100644
@@ -236,6 +236,11 @@ _check_quota_usage()
 {
 	# Sync to get delalloc to disk
 	sync
+
+	# kill caches to guarantee removal speculative delalloc
+	# XXX: really need an ioctl instead of this big hammer
+	echo 3 > /proc/sys/vm/drop_caches
+
 	VFS_QUOTA=0
 	case $FSTYP in
 	ext2|ext3|ext4|ext4dev|reiserfs)
@@ -253,8 +258,9 @@ _check_quota_usage()
 		quotacheck -u -g $SCRATCH_MNT 2>/dev/null
 	else
 		# use XFS method to force quotacheck
-		mount -o remount,noquota $SCRATCH_DEV
-		mount -o remount,usrquota,grpquota $SCRATCH_DEV
+		xfs_quota -x -c "off -ug" $SCRATCH_MNT
+		_scratch_unmount
+		_scratch_mount "-o usrquota,grpquota"
 	fi
 	repquota -u -n $SCRATCH_MNT  | grep -v "^#0" | _filter_scratch |
 		sort >$tmp.user.checked
Signature · 6 lines
1.7.10

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
#14 lore raw

PATCH 4/4 xfstests: speed up 227 by using preallocation

From: Dave Chinner <[email protected]>

Test 227 (fsr test) creates fragmented fre space by doing lots of small writes to sparse offsets ni a file. This seeks the disk heads around a lot writing data. We don't need to write data - just trigger allocation. Hence use preallocation instead of data writes and run at allocation speed rather than data write speed.

---
 227 |   46 +++++++++++++++++++++++++++++++++-------------
 1 file changed, 33 insertions(+), 13 deletions(-)
227 +33 -13
index cb7fa70..dfcb1a5 100755
@@ -52,6 +52,8 @@ _supported_fs xfs
 _supported_os Linux
 _require_scratch
 
+rm -f $seq.full
+
 [ "$XFS_FSR_PROG" = "" ] && _notrun "xfs_fsr not found"
 
 # create freespace holes of 1-3 blocks in length
@@ -62,26 +64,41 @@ _require_scratch
 # (say 5 extents) and lots of variations around that dependent on the
 # number of attributes in the files being defragmented.
 #
+# We have to make sure there are enough free inodes for the test to
+# pass without needing to allocate new clusters during the test.
+# With such fragemented free space, that will fail.
+#
 fragment_freespace()
 {
 	_file="$SCRATCH_MNT/not_free"
+	_dir="$SCRATCH_MNT/saved"
 
-	for i in `seq 0 1 10000`; do
-		echo foo > $_file.$i
+	# allocate inode space
+	mkdir -p $_dir
+	for i in `seq 0 1 1000`; do
+		touch $_file.$i
 	done
-	sync
-
-	for i in `seq 0 2 10000`; do
-		rm -f $_file.$i
+	for i in `seq 0 63 1000`; do
+		mv $_file.$i $_dir
 	done
-	for i in `seq 0 7 10000`; do
+	for i in `seq 0 1 1000`; do
 		rm -f $_file.$i
 	done
+
+	$XFS_IO_PROG -fs -c "resvsp 0 40000k" $_file > /dev/null 2>&1
+
+	for i in `seq 0 8 40000`; do
+		$XFS_IO_PROG -f -c "unresvsp ${i}k 4k" $_file \
+					> /dev/null 2>&1
+	done
+	for i in `seq 0 28 40000`; do
+		$XFS_IO_PROG -f -c "unresvsp ${i}k 4k" $_file \
+					> /dev/null 2>&1
+	done
 	sync
 
 	# and now use up all the remaining extents larger than 3 blocks
-	dd if=/dev/zero of=$_file.large bs=4k count=1024 > /dev/null 2>&1
-	sync
+	$XFS_IO_PROG -fs -c "resvsp 0 4m" $_file.large > /dev/null 2>&1
 }
 
 create_attrs()
@@ -93,11 +110,12 @@ create_attrs()
 
 create_data()
 {
+	size=`expr \( $1 + 1 \) \* 4096`
+	$XFS_IO_PROG -f -c "truncate $size" $2 > /dev/null 2>&1
 	for foo in `seq $1 -1 0`; do
 		let offset=$foo*4096
-		$XFS_IO_PROG -f -c "pwrite $offset 4096" -c "fsync" $2 > /dev/null 2>&1
+		$XFS_IO_PROG -f -c "resvsp $offset 4096" $2 > /dev/null 2>&1
 	done
-	xfs_bmap -vp $2
 }
 
 # create the designated file with a certain number of attributes and a certain
@@ -113,7 +131,7 @@ create_target_attr_first()
 	target=$3
 
 	rm -f $target
-	echo > $target
+	touch $target
 	create_attrs $nattrs $target
 	create_data $file_blocks $target
 }
@@ -131,7 +149,7 @@ create_target_attr_last()
 	target=$3
 
 	rm -f $target
-	echo > $target
+	touch $target
 	create_data $file_blocks $target
 	create_attrs $nattrs $target
 }
@@ -176,11 +194,13 @@ for n in `seq 4 1 12`; do
 		for j in `seq 5 1 20`; do
 			create_target_attr_first $i $j $targ.$i.$j >> $seq.full 2>&1
 		done
+		xfs_bmap -vp $targ.$i.* >> $seq.full 2>&1
 		FSRXFSTEST=true xfs_fsr -d -v -C $n $targ.$i.* >> $seq.full 2>&1
 		xfs_bmap -vp $targ.$i.* >> $seq.full 2>&1
 		for j in `seq 5 1 20`; do
 			create_target_attr_last $i $j $targ.$i.$j >> $seq.full 2>&1
 		done
+		xfs_bmap -vp $targ.$i.* >> $seq.full 2>&1
 		FSRXFSTEST=true xfs_fsr -d -v -C $n $targ.$i.* >> $seq.full 2>&1
 		xfs_bmap -vp $targ.$i.* >> $seq.full 2>&1
 	done
Signature · 6 lines
1.7.10

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
#11 lore raw

Re: [PATCH 3/4] xfstests: _check_quota_usage needs to unmount to get XFS quotacheck

In reply to Dave Chinner
Quoted 7 lines · Dave Chinner

From: Dave Chinner <[email protected]>

Remount won't run a quota check - it's only done during mount. Hence all quota tests using this check function are not actually validating XFS filesystems right now.

FWIW, this change is exposing some problems in the new dquot code:

Quoted 9 lines
---
 common.quota |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
common.quota +0 -0
index 9736306..2fa784b 100644

common.quota _check_quota_usage() · line 243

Quoted 8 lines
common.quota +5 -0
@@ -236,6 +236,11 @@ _check_quota_usage()
 {
 	# Sync to get delalloc to disk
 	sync
+
+	# kill caches to guarantee removal speculative delalloc
+	# XXX: really need an ioctl instead of this big hammer
+	echo 3 > /proc/sys/vm/drop_caches
+

Some kind of locking issue is present:

[ 1871.738970] XFS (vdb): Quotacheck: Done.
[ 1877.795774] ------------[ cut here ]------------
[ 1877.797347] WARNING: at kernel/mutex-debug.c:78 debug_mutex_unlock+0xda/0xe0()
[ 1877.799416] Hardware name: Bochs
[ 1877.799416] Modules linked in:
[ 1877.799416] Pid: 2261, comm: 232 Not tainted 3.5.0-rc5-dgc+ #313
[ 1877.799416] Call Trace:
[ 1877.799416]  [<ffffffff8107a83f>] warn_slowpath_common+0x7f/0xc0
[ 1877.799416]  [<ffffffff8107a89a>] warn_slowpath_null+0x1a/0x20
[ 1877.799416]  [<ffffffff810d022a>] debug_mutex_unlock+0xda/0xe0
[ 1877.799416]  [<ffffffff81b4c97c>] __mutex_unlock_slowpath+0x7c/0x130
[ 1877.799416]  [<ffffffff81b4ca3e>] mutex_unlock+0xe/0x10
[ 1877.799416]  [<ffffffff814b12d8>] xfs_qm_dqreclaim_one+0x178/0x3d0
[ 1877.799416]  [<ffffffff814b1620>] xfs_qm_shake+0xf0/0x170
[ 1877.799416]  [<ffffffff81137789>] shrink_slab+0x169/0x350
[ 1877.799416]  [<ffffffff81709b04>] ? do_raw_spin_lock+0x54/0x120
[ 1877.799416]  [<ffffffff8118a488>] ? iput+0x48/0x210
[ 1877.799416]  [<ffffffff8119b433>] drop_caches_sysctl_handler+0x73/0xa0
[ 1877.799416]  [<ffffffff811de863>] proc_sys_call_handler.isra.11+0xb3/0xd0
[ 1877.799416]  [<ffffffff811de898>] proc_sys_write+0x18/0x20
[ 1877.799416]  [<ffffffff81170298>] vfs_write+0xa8/0x160
[ 1877.799416]  [<ffffffff8117058a>] sys_write+0x4a/0x90
[ 1877.799416]  [<ffffffff81b57269>] system_call_fastpath+0x16/0x1b
[ 1877.799416] ---[ end trace 4f2a89b2cbd5e64f ]---

which is:

	DEBUG_LOCKS_WARN_ON(lock->owner != current);

so something other than the task that locked the mutex unlocked it, or we are unlocking an unlocked dquot...

common.quota _check_quota_usage() · line 261

Quoted 10 lines
common.quota +1 -2
 	VFS_QUOTA=0
 	case $FSTYP in
 	ext2|ext3|ext4|ext4dev|reiserfs)
@@ -253,8 +258,9 @@ _check_quota_usage()
 		quotacheck -u -g $SCRATCH_MNT 2>/dev/null
 	else
 		# use XFS method to force quotacheck
-		mount -o remount,noquota $SCRATCH_DEV
-		mount -o remount,usrquota,grpquota $SCRATCH_DEV
+		xfs_quota -x -c "off -ug" $SCRATCH_MNT

And this is hanging with what appears to be a reference counting bug when purging dquots in generic/233:

# echo w > /proc/sysrq-trigger 
[53710.206100] SysRq : Show Blocked State
[53710.207213]   task                        PC stack   pid father
[53710.208749] xfs_quota       D ffff88003fc12880  3896 18147  17936 0x00000000
[53710.209738]  ffff88000f3afc18 0000000000000086 ffff88001cb160c0 ffff88000f3affd8
[53710.209738]  ffff88000f3affd8 ffff88000f3affd8 ffffffff81f9b420 ffff88001cb160c0
[53710.209738]  ffff88000f3afc08 ffffffff821ece80 ffff88000f3afc50 0000000100cbbe68
[53710.209738] Call Trace:
[53710.209738]  [<ffffffff81b4dea9>] schedule+0x29/0x70
[53710.209738]  [<ffffffff81b4bcad>] schedule_timeout+0x13d/0x2c0
[53710.209738]  [<ffffffff81089f90>] ? usleep_range+0x50/0x50
[53710.209738]  [<ffffffff814aea90>] ? xfs_qm_need_dqattach+0x70/0x70
[53710.209738]  [<ffffffff81b4be4e>] schedule_timeout_uninterruptible+0x1e/0x20
[53710.209738]  [<ffffffff814aeef3>] xfs_qm_dquot_walk+0x153/0x170
[53710.209738]  [<ffffffff816fb81b>] ? radix_tree_lookup+0xb/0x10
[53710.209738]  [<ffffffff8149772a>] ? xfs_perag_get+0x3a/0x120
[53710.209738]  [<ffffffff814ace60>] ? xfs_trans_free_dqinfo+0x40/0x40
[53710.209738]  [<ffffffff81448aef>] ? xfs_inode_ag_iterator+0x8f/0xa0
[53710.209738]  [<ffffffff814aef93>] xfs_qm_dqpurge_all+0x83/0x90
[53710.209738]  [<ffffffff814ae4b9>] xfs_qm_scall_quotaoff+0x139/0x350
[53710.209738]  [<ffffffff814b2780>] xfs_fs_set_xstate+0xd0/0xf0
[53710.209738]  [<ffffffff811d1088>] sys_quotactl+0x1f8/0x740
[53710.209738]  [<ffffffff81174d7a>] ? sys_newstat+0x2a/0x40
[53710.209738]  [<ffffffff81b52635>] ? do_async_page_fault+0x35/0x90
[53710.209738]  [<ffffffff81b57269>] system_call_fastpath+0x16/0x1b

It's hitting a dquot that either has the FREEING flag set of an elevated reference count, so is skipping it. It gets stuck in the loop forever retrying. That's probably related to the above lock issue.

And generic/231 fails with a significant accounting difference:

generic/231 [failed, exit status 1] - output mismatch (see tests/generic/231.out.bad)

generic/231.out.bad 2012-07-27 08:24:22.000000000 +1000 renamed from generic/231.out 2012-07-26 18:42:30.000000000 +1000 +4 -12
@@ -2,15 +2,7 @@
 === FSX Standard Mode, Memory Mapping, 1 Tasks ===
 All operations completed A-OK!
 Comparing user usage
-Comparing group usage
-=== FSX Standard Mode, Memory Mapping, 4 Tasks ===
-All operations completed A-OK!
-All operations completed A-OK!
-All operations completed A-OK!
-All operations completed A-OK!
-Comparing user usage
-Comparing group usage
-=== FSX Standard Mode, Memory Mapping, 1 Tasks ===
-All operations completed A-OK!
-Comparing user usage
-Comparing group usage
+4c4
+< #1001     --     524       0       0              3     0     0
+---
+> #1001     --     316       0       0              3     0     0

generic/270 and generic/233 give a similar mismatch when they don't hang.

So, yeah, we haven't been verifying the quota accounting code as well as we should have been for some time now....

Cheers,

Dave.

Signature · 7 lines
Dave Chinner
[email protected]

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
#17 lore raw
In reply to Dave Chinner

ping?

Quoted 14 lines · Dave Chinner

These have been sitting around in my local work area for a little while, so probably best to get them upstream....

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

Signature · 3 lines
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Signature · 7 lines
Dave Chinner
[email protected]

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Reviewed-by on v1 1/4
#2 lore raw

Re: [PATCH 1/4] xfstests: test 110 sometimes fails to unmount scratch dev

In reply to Dave Chinner
Quoted 16 lines · Dave Chinner

From: Dave Chinner <[email protected]>

It runs a bunch of rm processes in the background, then immediately calls _check_scratch_fs without waiting for them to complete, hence the unmount can fail with a busy filesystem error.

---
  110 |    1 +
  1 file changed, 1 insertion(+)
110 +0 -0
index aad5835..c58e6c9 100755

110 do · line 71

Quoted 3 lines
110 +0 -0
@@ -69,6 +69,7 @@ do
      let I=$I+1
      [ $[$I % 1000] -eq 0 ] && echo "Created $I/$E"
  done

#RCJ Yes wait for rm processes to complete

110 do · line 75

Quoted 5 lines
110 +1 -0
+wait
 
  sync
 

Looks good to me.

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

Reviewed-by on v1 2/4
#6 lore raw

Re: [PATCH 2/4] xfstests: loop devices vs umount stupidity

In reply to Dave Chinner
Quoted 131 lines · Dave Chinner

From: Dave Chinner <[email protected]>

Unmounting a fileystem mounted on a loop device doesn't always tear down the loop device. Its racy, and it causes tests to randomly fail.

To avoid that, we have to use umount -d to ensure that we destroy loop devices under filesystems in case the kernel doesn't tear it down automatically to prevent the test from failing. However, if the kernel does tear it down automatically, umount now issues a warning that it couldn't tear down the loop device because it couldn't find it, and that causes the test to fail. *facepalm*

So, convert all the loop device unmounts to use -d, and direct the output of all of them to /dev/null.

---
  049 |    8 ++++----
  073 |    2 +-
  078 |    4 ++--
  216 |    2 +-
  217 |    2 +-
  250 |    4 ++--
  6 files changed, 11 insertions(+), 11 deletions(-)
049 +4 -4
index c6c4faa..c3065ad 100755
@@ -30,8 +30,8 @@ echo "QA output created by $seq"
  _cleanup()
  {
      cd /
-    umount $SCRATCH_MNT/test2 > /dev/null 2>&1
-    umount $SCRATCH_MNT/test > /dev/null 2>&1
+    umount -d $SCRATCH_MNT/test2 > /dev/null 2>&1
+    umount -d $SCRATCH_MNT/test > /dev/null 2>&1
      rm -f $tmp.*
 
      if [ -w $seq.full ]
@@ -124,11 +124,11 @@ rm -rf $SCRATCH_MNT/test/* >> $seq.full 2>&1 \
      || _fail "!!! clean failed"
 
  _log "umount ext2 on xfs"
-umount $SCRATCH_MNT/test2 >> $seq.full 2>&1 \
+umount -d $SCRATCH_MNT/test2 >> $seq.full 2>&1 \
      || _fail "!!! umount ext2 failed"
 
  _log "umount xfs"
-umount $SCRATCH_MNT/test >> $seq.full 2>&1 \
+umount -d $SCRATCH_MNT/test >> $seq.full 2>&1 \
      || _fail "!!! umount xfs failed"
 
  echo "--- mounts at end (before cleanup)" >> $seq.full
073 +1 -1
index 18257d4..9605662 100755
@@ -120,7 +120,7 @@ _verify_copy()
 
  	echo unmounting and removing new image
  	umount $source_dir
-	umount -d $target_dir
+	umount -d $target_dir > /dev/null 2>&1
  	rm -f $target
  }
 
078 +2 -2
index 5cb66df..7af552e 100755
@@ -37,7 +37,7 @@ _cleanup()
  {
      cd /
      rm -f $tmp.*
-    umount $LOOP_MNT 2>/dev/null
+    umount -d $LOOP_MNT 2>/dev/null
      rmdir $LOOP_MNT
      _cleanup_testdir
  }
@@ -98,7 +98,7 @@ _grow_loop()
  	$XFS_GROWFS_PROG $LOOP_MNT 2>&1 |  _filter_growfs 2>&1
 
  	echo "*** unmount"
-	umount $LOOP_MNT
+	umount -d $LOOP_MNT > /dev/null 2>&1
 
  	# Large grows takes forever to check..
  	if [ "$check" -gt "0" ]
216 +1 -1
index 7c046f5..71e6dd7 100755
@@ -63,7 +63,7 @@ _do_mkfs()
  			-d name=$LOOP_DEV,size=${i}g |grep log
  		mount -o loop -t xfs $LOOP_DEV $LOOP_MNT
  		echo "test write" > $LOOP_MNT/test
-		umount $LOOP_MNT
+		umount -d $LOOP_MNT > /dev/null 2>&1
  	done
  }
  # make large holey file
217 +1 -1
index 19540ad..ef0761e 100755
@@ -65,7 +65,7 @@ _do_mkfs()
  			-d name=$LOOP_DEV,size=${i}g |grep log
  		mount -o loop -t xfs $LOOP_DEV $LOOP_MNT
  		echo "test write" > $LOOP_MNT/test
-		umount $LOOP_MNT
+		umount -d $LOOP_MNT > /dev/null 2>&1
  	done
  }
  # make large holey file
250 +1 -1
index 92e3cc5..9eca2b6 100755
@@ -34,7 +34,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
  _cleanup()
  {
  	cd /
-	umount $LOOP_MNT 2>/dev/null
+	umount -d $LOOP_MNT 2>/dev/null
  	rm -f $LOOP_DEV
  	rmdir $LOOP_MNT
  	_cleanup_testdir

250 _test_loop() · line 91

Quoted 8 lines
250 +1 -1
@@ -85,7 +85,7 @@ _test_loop()
  	xfs_io -f -c "resvsp 0 $fsize" $LOOP_MNT/foo | _filter_io
 
  	echo "*** unmount loop filesystem"
-	umount $LOOP_MNT
+	umount -d $LOOP_MNT > /dev/null 2>&1
 
  	echo "*** check loop filesystem"
  	 _check_xfs_filesystem $LOOP_DEV none none

Test 250 Fails but a bug is already created for this, PV1026237. Other than that it looks good and the bug is not related to this patch, so ...

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

Reviewed-by
#12 lore raw

Re: [PATCH 3/4] xfstests: _check_quota_usage needs to unmount to get XFS quotacheck

In reply to Dave Chinner
Quoted 137 lines · Dave Chinner
Quoted 7 lines · Dave Chinner

From: Dave Chinner <[email protected]>

Remount won't run a quota check - it's only done during mount. Hence all quota tests using this check function are not actually validating XFS filesystems right now.

FWIW, this change is exposing some problems in the new dquot code:

Quoted 9 lines
---
  common.quota |   10 ++++++++--
  1 file changed, 8 insertions(+), 2 deletions(-)
common.quota +0 -0
index [email protected] 100644

common.quota _check_quota_usage()[email protected] · line 243

Quoted 8 lines
common.quota +5 -0
@@ -236,6 +236,11 @@ _check_quota_usage()[email protected]
  {
  	# Sync to get delalloc to disk
  	sync
+
+	# kill caches to guarantee removal speculative delalloc
+	# XXX: really need an ioctl instead of this big hammer
+	echo 3 > /proc/sys/vm/drop_caches
+

Some kind of locking issue is present:

[ 1871.738970] XFS (vdb): Quotacheck: Done.
[ 1877.795774] ------------[ cut here ]------------
[ 1877.797347] WARNING: at kernel/mutex-debug.c:78 debug_mutex_unlock+0xda/0xe0()
[ 1877.799416] Hardware name: Bochs
[ 1877.799416] Modules linked in:
[ 1877.799416] Pid: 2261, comm: 232 Not tainted 3.5.0-rc5-dgc+ #313
[ 1877.799416] Call Trace:
[ 1877.799416]  [<ffffffff8107a83f>] warn_slowpath_common+0x7f/0xc0
[ 1877.799416]  [<ffffffff8107a89a>] warn_slowpath_null+0x1a/0x20
[ 1877.799416]  [<ffffffff810d022a>] debug_mutex_unlock+0xda/0xe0
[ 1877.799416]  [<ffffffff81b4c97c>] __mutex_unlock_slowpath+0x7c/0x130
[ 1877.799416]  [<ffffffff81b4ca3e>] mutex_unlock+0xe/0x10
[ 1877.799416]  [<ffffffff814b12d8>] xfs_qm_dqreclaim_one+0x178/0x3d0
[ 1877.799416]  [<ffffffff814b1620>] xfs_qm_shake+0xf0/0x170
[ 1877.799416]  [<ffffffff81137789>] shrink_slab+0x169/0x350
[ 1877.799416]  [<ffffffff81709b04>] ? do_raw_spin_lock+0x54/0x120
[ 1877.799416]  [<ffffffff8118a488>] ? iput+0x48/0x210
[ 1877.799416]  [<ffffffff8119b433>] drop_caches_sysctl_handler+0x73/0xa0
[ 1877.799416]  [<ffffffff811de863>] proc_sys_call_handler.isra.11+0xb3/0xd0
[ 1877.799416]  [<ffffffff811de898>] proc_sys_write+0x18/0x20
[ 1877.799416]  [<ffffffff81170298>] vfs_write+0xa8/0x160
[ 1877.799416]  [<ffffffff8117058a>] sys_write+0x4a/0x90
[ 1877.799416]  [<ffffffff81b57269>] system_call_fastpath+0x16/0x1b
[ 1877.799416] ---[ end trace 4f2a89b2cbd5e64f ]---

which is:

	DEBUG_LOCKS_WARN_ON(lock->owner != current);

so something other than the task that locked the mutex unlocked it, or we are unlocking an unlocked dquot...

common.quota _check_quota_usage() · line 261

Quoted 10 lines
common.quota +1 -2
  	VFS_QUOTA=0
  	case $FSTYP in
  	ext2|ext3|ext4|ext4dev|reiserfs)
@@ -253,8 +258,9 @@ _check_quota_usage()
  		quotacheck -u -g $SCRATCH_MNT 2>/dev/null
  	else
  		# use XFS method to force quotacheck
-		mount -o remount,noquota $SCRATCH_DEV
-		mount -o remount,usrquota,grpquota $SCRATCH_DEV
+		xfs_quota -x -c "off -ug" $SCRATCH_MNT

And this is hanging with what appears to be a reference counting bug when purging dquots in generic/233:

# echo w > /proc/sysrq-trigger
[53710.206100] SysRq : Show Blocked State
[53710.207213]   task                        PC stack   pid father
[53710.208749] xfs_quota       D ffff88003fc12880  3896 18147  17936 0x00000000
[53710.209738]  ffff88000f3afc18 0000000000000086 ffff88001cb160c0 ffff88000f3affd8
[53710.209738]  ffff88000f3affd8 ffff88000f3affd8 ffffffff81f9b420 ffff88001cb160c0
[53710.209738]  ffff88000f3afc08 ffffffff821ece80 ffff88000f3afc50 0000000100cbbe68
[53710.209738] Call Trace:
[53710.209738]  [<ffffffff81b4dea9>] schedule+0x29/0x70
[53710.209738]  [<ffffffff81b4bcad>] schedule_timeout+0x13d/0x2c0
[53710.209738]  [<ffffffff81089f90>] ? usleep_range+0x50/0x50
[53710.209738]  [<ffffffff814aea90>] ? xfs_qm_need_dqattach+0x70/0x70
[53710.209738]  [<ffffffff81b4be4e>] schedule_timeout_uninterruptible+0x1e/0x20
[53710.209738]  [<ffffffff814aeef3>] xfs_qm_dquot_walk+0x153/0x170
[53710.209738]  [<ffffffff816fb81b>] ? radix_tree_lookup+0xb/0x10
[53710.209738]  [<ffffffff8149772a>] ? xfs_perag_get+0x3a/0x120
[53710.209738]  [<ffffffff814ace60>] ? xfs_trans_free_dqinfo+0x40/0x40
[53710.209738]  [<ffffffff81448aef>] ? xfs_inode_ag_iterator+0x8f/0xa0
[53710.209738]  [<ffffffff814aef93>] xfs_qm_dqpurge_all+0x83/0x90
[53710.209738]  [<ffffffff814ae4b9>] xfs_qm_scall_quotaoff+0x139/0x350
[53710.209738]  [<ffffffff814b2780>] xfs_fs_set_xstate+0xd0/0xf0
[53710.209738]  [<ffffffff811d1088>] sys_quotactl+0x1f8/0x740
[53710.209738]  [<ffffffff81174d7a>] ? sys_newstat+0x2a/0x40
[53710.209738]  [<ffffffff81b52635>] ? do_async_page_fault+0x35/0x90
[53710.209738]  [<ffffffff81b57269>] system_call_fastpath+0x16/0x1b

It's hitting a dquot that either has the FREEING flag set of an elevated reference count, so is skipping it. It gets stuck in the loop forever retrying. That's probably related to the above lock issue.

And generic/231 fails with a significant accounting difference:

generic/231 [failed, exit status 1] - output mismatch (see tests/generic/231.out.bad)

generic/231.out.bad 2012-07-27 08:24:22.000000000 +1000 renamed from generic/231.out 2012-07-26 18:42:30.000000000 +1000 +4 -12
@@ -2,15 +2,7 @@
  === FSX Standard Mode, Memory Mapping, 1 Tasks ===
  All operations completed A-OK!
  Comparing user usage
-Comparing group usage
-=== FSX Standard Mode, Memory Mapping, 4 Tasks ===
-All operations completed A-OK!
-All operations completed A-OK!
-All operations completed A-OK!
-All operations completed A-OK!
-Comparing user usage
-Comparing group usage
-=== FSX Standard Mode, Memory Mapping, 1 Tasks ===
-All operations completed A-OK!
-Comparing user usage
-Comparing group usage
+4c4
+< #1001     --     524       0       0              3     0     0
+---
+> #1001     --     316       0       0              3     0     0

generic/270 and generic/233 give a similar mismatch when they don't hang.

Quoted 7 lines

So, yeah, we haven't been verifying the quota accounting code as well as we should have been for some time now....

Cheers,

Dave.

I did see the the hang some times and the accounting mismatch. Dave do you want to look into this further. Otherwise I am OK with approving this patch and fixing the accounting and lockup under another bug because this patch is the way to work around the remount issue. I will leave it up to you.

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

Reviewed-by on v1 4/4
#15 lore raw

Re: [PATCH 4/4] xfstests: speed up 227 by using preallocation

In reply to Dave Chinner
Quoted 8 lines · Dave Chinner

From: Dave Chinner <[email protected]>

Test 227 (fsr test) creates fragmented fre space by doing lots of small writes to sparse offsets ni a file. This seeks the disk heads around a lot writing data. We don't need to write data - just trigger allocation. Hence use preallocation instead of data writes and run at allocation speed rather than data write speed.

Quoted 4 lines
---
  227 |   46 +++++++++++++++++++++++++++++++++-------------
  1 file changed, 33 insertions(+), 13 deletions(-)

Looks good to me.

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

#7 lore raw

Re: [PATCH 2/4] xfstests: loop devices vs umount stupidity

In reply to Rich Johnston
Quoted 18 lines · Rich Johnston
Quoted 17 lines · Dave Chinner

From: Dave Chinner <[email protected]>

Unmounting a fileystem mounted on a loop device doesn't always tear down the loop device. Its racy, and it causes tests to randomly fail.

To avoid that, we have to use umount -d to ensure that we destroy loop devices under filesystems in case the kernel doesn't tear it down automatically to prevent the test from failing. However, if the kernel does tear it down automatically, umount now issues a warning that it couldn't tear down the loop device because it couldn't find it, and that causes the test to fail. *facepalm*

So, convert all the loop device unmounts to use -d, and direct the output of all of them to /dev/null.

.....

Quoted 2 lines

Test 250 Fails but a bug is already created for this, PV1026237.

News to me. Recording failures in non-public bug trackers, and then alluding to it via a number that nobody can look up is not very helpful. If you are going to track mainline kernel failures/regressions in a bug tracker, please use the oss.sgi.com bugzilla so that the issues are publicly visible....

Quoted 2 lines

Other than that it looks good and the bug is not related to this patch, so ...

.... what is the failure you are seeing?

Cheers,

Dave.

Signature · 7 lines
Dave Chinner
[email protected]

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
#8 lore raw

Re: [PATCH 2/4] xfstests: loop devices vs umount stupidity

Quoted 21 lines · Dave Chinner
Quoted 18 lines · Rich Johnston
Quoted 17 lines · Dave Chinner

From: Dave Chinner <[email protected]>

Unmounting a fileystem mounted on a loop device doesn't always tear down the loop device. Its racy, and it causes tests to randomly fail.

To avoid that, we have to use umount -d to ensure that we destroy loop devices under filesystems in case the kernel doesn't tear it down automatically to prevent the test from failing. However, if the kernel does tear it down automatically, umount now issues a warning that it couldn't tear down the loop device because it couldn't find it, and that causes the test to fail. *facepalm*

So, convert all the loop device unmounts to use -d, and direct the output of all of them to /dev/null.

.....

Quoted 1 line
Quoted 8 lines
Quoted 1 line

Test 250 Fails but a bug is already created for this, PV1026237.

News to me. Recording failures in non-public bug trackers, and then alluding to it via a number that nobody can look up is not very helpful. If you are going to track mainline kernel failures/regressions in a bug tracker, please use the oss.sgi.com bugzilla so that the issues are publicly visible....

Sorry new to the team.

Quoted 9 lines
Quoted 2 lines

Other than that it looks good and the bug is not related to this patch, so ...

.... what is the failure you are seeing?

Cheers,

Dave.

Here is the output from the test and I attached 250.full.

./check -xfs 250

FSTYP         -- xfs (non-debug)
PLATFORM      -- Linux/x86_64 cxfsxe4 3.6.0-rc1-0.9-default
MKFS_OPTIONS  -- -f -bsize=4096 /dev/sdc1

MOUNT_OPTIONS -- /dev/sdc1 /xfs_scratch

250 [failed, exit status 1] - output mismatch (see 250.out.bad)

250.out.bad renamed from 250.out +1 -2
@@ -11,5 +11,4 @@
 *** preallocate large file
 *** unmount loop filesystem
 *** check loop filesystem
-*** done
-
+_check_xfs_filesystem: filesystem on /xfs_test/250.fs is inconsistent (r) (see 250.full)

Ran: 250
Failures: 250
Failed 1 of 1 tests

12,881 lines not shown · raw message

Part of this message is not shown here. View the raw message.

Reviewed-by on v1 1/4
#3 lore raw

Re: [PATCH 1/4] xfstests: test 110 sometimes fails to unmount scratch dev

In reply to Dave Chinner
Quoted 5 lines · Dave Chinner

From: Dave Chinner <[email protected]>

It runs a bunch of rm processes in the background, then immediately calls _check_scratch_fs without waiting for them to complete, hence the unmount can fail with a busy filesystem error.

Looks good,

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

#4 lore raw

Re: [PATCH 1/4] xfstests: test 110 sometimes fails to unmount scratch dev

In reply to Christoph Hellwig

Hey Christoph,

Quoted 10 lines · Christoph Hellwig
Quoted 5 lines · Dave Chinner

From: Dave Chinner <[email protected]>

It runs a bunch of rm processes in the background, then immediately calls _check_scratch_fs without waiting for them to complete, hence the unmount can fail with a busy filesystem error.

Looks good,

These four are in the oss xfstests master branch... just a heads up.

Regards,
Ben

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs