public inbox for fstests@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] xfstests: Split MOUNT_OPTIONS to TEST_FS_MOUNT_OPTS and MOUNT_OPTIONS
@ 2017-09-18  8:11 Gu Jinxiang
  2017-09-18  8:11 ` [PATCH 2/2] xfstests: Add echo logic to show the information of TEST_FS_MOUNT_OPTS Gu Jinxiang
  2017-09-22  8:18 ` [PATCH 1/2] xfstests: Split MOUNT_OPTIONS to TEST_FS_MOUNT_OPTS and MOUNT_OPTIONS Eryu Guan
  0 siblings, 2 replies; 3+ messages in thread
From: Gu Jinxiang @ 2017-09-18  8:11 UTC (permalink / raw)
  To: fstests; +Cc: linux-btrfs

Resovle the inconsistent of mount option.
Btrfs use MOUNT_OPTIONS for both scrath_dev and test_dev. Change to
MOUNT_OPTIONS for scratch mount, and TEST_FS_MOUNT_OPTS for test dev
mount.

Signed-off-by: Gu Jinxiang <gujx@cn.fujitsu.com>
---
As mentioned by https://patchwork.kernel.org/patch/9742039/, the usage
of MOUNT_OPTIONS is inconsistent.

 common/btrfs | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 common/rc    |  2 +-
 2 files changed, 57 insertions(+), 1 deletion(-)

diff --git a/common/btrfs b/common/btrfs
index fd762ef..2a1cfaf 100644
--- a/common/btrfs
+++ b/common/btrfs
@@ -89,6 +89,62 @@ _require_btrfs_fs_feature()
 		_notrun "Feature $feat not supported by the available btrfs version"
 }
 
+_check_test_btrfs_filesystem()
+{
+	device=$1
+
+	# If type is set, we're mounted
+	type=`_fs_type $device`
+	ok=1
+
+	if [ "$type" = "$FSTYP" ]; then
+		# mounted ...
+		mountpoint=`_umount_or_remount_ro $device`
+	fi
+
+	if [ -f ${RESULT_DIR}/require_scratch.require_qgroup_report ]; then
+		$BTRFS_UTIL_PROG check $device --qgroup-report > $tmp.qgroup_report 2>&1
+		if grep -qE "Counts for qgroup.*are different" $tmp.qgroup_report ; then
+			_log_err "_check_btrfs_filesystem: filesystem on $device has wrong qgroup numbers"
+			echo "*** qgroup_report.$FSTYP output ***"	>>$seqres.full
+			cat $tmp.qgroup_report				>>$seqres.full
+			echo "*** qgroup_report.$FSTYP output ***"	>>$seqres.full
+		fi
+		rm -f $tmp.qgroup_report
+	fi
+
+	$BTRFS_UTIL_PROG check $device >$tmp.fsck 2>&1
+	if [ $? -ne 0 ]; then
+		_log_err "_check_btrfs_filesystem: filesystem on $device is inconsistent"
+		echo "*** fsck.$FSTYP output ***"	>>$seqres.full
+		cat $tmp.fsck				>>$seqres.full
+		echo "*** end fsck.$FSTYP output"	>>$seqres.full
+
+		ok=0
+	fi
+	rm -f $tmp.fsck
+
+	if [ $ok -eq 0 ]; then
+		echo "*** mount output ***"		>>$seqres.full
+		_mount					>>$seqres.full
+		echo "*** end mount output"		>>$seqres.full
+	elif [ "$type" = "$FSTYP" ]; then
+		# was mounted ...
+		_mount_or_remount_rw "$TEST_FS_MOUNT_OPTS" $device $mountpoint
+		ok=$?
+	fi
+
+	if [ $ok -eq 0 ]; then
+		status=1
+		if [ "$iam" != "check" ]; then
+			exit 1
+		fi
+		return 1
+	fi
+
+	return 0
+}
+
 _check_btrfs_filesystem()
 {
 	device=$1
diff --git a/common/rc b/common/rc
index cd53a37..eb9c469 100644
--- a/common/rc
+++ b/common/rc
@@ -2624,7 +2624,7 @@ _check_test_fs()
 	# do nothing for now
 	;;
     btrfs)
-	_check_btrfs_filesystem $TEST_DEV
+	_check_test_btrfs_filesystem $TEST_DEV
 	;;
     tmpfs)
 	# no way to check consistency for tmpfs
-- 
1.9.1




^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] xfstests: Add echo logic to show the information of TEST_FS_MOUNT_OPTS
  2017-09-18  8:11 [PATCH 1/2] xfstests: Split MOUNT_OPTIONS to TEST_FS_MOUNT_OPTS and MOUNT_OPTIONS Gu Jinxiang
@ 2017-09-18  8:11 ` Gu Jinxiang
  2017-09-22  8:18 ` [PATCH 1/2] xfstests: Split MOUNT_OPTIONS to TEST_FS_MOUNT_OPTS and MOUNT_OPTIONS Eryu Guan
  1 sibling, 0 replies; 3+ messages in thread
From: Gu Jinxiang @ 2017-09-18  8:11 UTC (permalink / raw)
  To: fstests; +Cc: linux-btrfs

There is message to show user the scrath mount, but no message to
point TEST_FS_MOUNT_OPTS of test mount.
Add logic to show test mount.

Signed-off-by: Gu Jinxiang <gujx@cn.fujitsu.com>
---
 check     |  1 +
 common/rc | 13 +++++++++++++
 2 files changed, 14 insertions(+)

diff --git a/check b/check
index f8db3cd..676b16c 100755
--- a/check
+++ b/check
@@ -579,6 +579,7 @@ for section in $HOST_OPTIONS_SECTIONS; do
 	# print out our test configuration
 	echo "FSTYP         -- `_full_fstyp_details`"
 	echo "PLATFORM      -- `_full_platform_details`"
+	echo "TEST_FS_MOUNT_OPTS -- `_test_mount_options`"
 	if [ ! -z "$SCRATCH_DEV" ]; then
 	  echo "MKFS_OPTIONS  -- `_scratch_mkfs_options`"
 	  echo "MOUNT_OPTIONS -- `_scratch_mount_options`"
diff --git a/common/rc b/common/rc
index eb9c469..1e7fee2 100644
--- a/common/rc
+++ b/common/rc
@@ -312,6 +312,19 @@ _overlay_mount_options()
 	     $OVERLAY_MOUNT_OPTIONS
 }
 
+_test_mount_options()
+{
+	_test_options mount
+
+	if [ "$FSTYP" == "overlay" ]; then
+		echo `_overlay_mount_options`
+		return 0
+	fi
+
+	echo $TEST_OPTIONS $TEST_FS_MOUNT_OPTS $SELINUX_MOUNT_OPTIONS $* \
+		$TEST_DEV $TEST_DIR
+}
+
 _scratch_mount_options()
 {
 	_scratch_options mount
-- 
1.9.1




^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/2] xfstests: Split MOUNT_OPTIONS to TEST_FS_MOUNT_OPTS and MOUNT_OPTIONS
  2017-09-18  8:11 [PATCH 1/2] xfstests: Split MOUNT_OPTIONS to TEST_FS_MOUNT_OPTS and MOUNT_OPTIONS Gu Jinxiang
  2017-09-18  8:11 ` [PATCH 2/2] xfstests: Add echo logic to show the information of TEST_FS_MOUNT_OPTS Gu Jinxiang
@ 2017-09-22  8:18 ` Eryu Guan
  1 sibling, 0 replies; 3+ messages in thread
From: Eryu Guan @ 2017-09-22  8:18 UTC (permalink / raw)
  To: Gu Jinxiang; +Cc: fstests, linux-btrfs

On Mon, Sep 18, 2017 at 04:11:09PM +0800, Gu Jinxiang wrote:
> Resovle the inconsistent of mount option.
> Btrfs use MOUNT_OPTIONS for both scrath_dev and test_dev. Change to
> MOUNT_OPTIONS for scratch mount, and TEST_FS_MOUNT_OPTS for test dev
> mount.
> 
> Signed-off-by: Gu Jinxiang <gujx@cn.fujitsu.com>
> ---
> As mentioned by https://patchwork.kernel.org/patch/9742039/, the usage
> of MOUNT_OPTIONS is inconsistent.

Sorry for the late reply, because I don't think this is the right fix,
and I was trying to sort out & refactor the mount option settings
through fstests, but found that it required more time than I thought..

The new _check_test_btrfs_filesystem() you introduced here is a (almost)
complete copy of _check_btrfs_filesystem, the only difference is that
it's mounting $device with $TEST_FS_MOUNT_OPTS instead of
$MOUNT_OPTIONS. At least you could factor out a common helper so you
don't have to repeat 99% of the code.

But that only fixes _check_test_btrfs_filesystems, there're similar
problems in _check_generic_filesystems and other places that do mount
operation. I'd like to see a well-defined interface to return the correct
mount options to callers that want to do mount operations.

I'll look into this and see if I can work something out. I really
appreciate if anyone has other thoughts/suggestions!

Thanks,
Eryu

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-09-22  8:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-18  8:11 [PATCH 1/2] xfstests: Split MOUNT_OPTIONS to TEST_FS_MOUNT_OPTS and MOUNT_OPTIONS Gu Jinxiang
2017-09-18  8:11 ` [PATCH 2/2] xfstests: Add echo logic to show the information of TEST_FS_MOUNT_OPTS Gu Jinxiang
2017-09-22  8:18 ` [PATCH 1/2] xfstests: Split MOUNT_OPTIONS to TEST_FS_MOUNT_OPTS and MOUNT_OPTIONS Eryu Guan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox