--- /dev/null
+#! /bin/sh
+# FS QA Test No. 199
+#
+# Check that a filesystem first mounted read-only and then remounted
+# performs the features2 fixup properly.
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2008 Christoph Hellwig.
+#-----------------------------------------------------------------------
+#
+# creator
+owner=hch@lst.de
+
+seq=`basename $0`
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1 # failure is the default!
+
+_cleanup()
+{
+ cd /
+ umount $SCRATCH_MNT >/dev/null 2>&1
+}
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+# get standard environment, filters and checks
+. ./common.rc
+. ./common.filter
+
+# real QA test starts here
+_supported_fs xfs
+_supported_os Linux
+
+_require_scratch
+
+_scratch_mkfs_xfs >/dev/null 2>&1
+
+#
+# Print the current flags. Just a dummy so that the test breaks
+# in an obvious way when the default feature flags changed in mkfs
+#
+echo "Default feature2 flags:"
+xfs_db -x $SCRATCH_DEV -c 'sb' -c 'print features2'
+xfs_db -x $SCRATCH_DEV -c 'sb' -c 'print bad_features2'
+
+#
+# Now clear the normal flags
+#
+echo "Clearing features2:"
+xfs_db -x $SCRATCH_DEV -c 'sb' -c 'write features2 0'
+
+#
+# And print the flags after a mount ro and remount rw
+_scratch_mount -o ro
+_scratch_mount -o remount,rw
+umount $SCRATCH_MNT
+echo "Features 2 after mount ro and remount rw:"
+xfs_db -x $SCRATCH_DEV -c 'sb' -c 'print features2'
+
+# success, all done
+echo "*** done"
+rm -f $seq.full
+status=0