Skip to contentSkip to conversation

common: handle ceph's new mount syntax

PATCH Superseded Jeff Layton 2 participants 2 messages Jan 5, 2022 – Jan 6, 2022

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 common: handle ceph's new mount syntax

Cephfs is introducing a new mount device syntax. Fix the fstests infrastructure to handle the new syntax correctly.

---
 common/config |  2 +-
 common/rc     | 34 ++++++++++++++++++++++++++++++++--
 2 files changed, 33 insertions(+), 3 deletions(-)
common/config +1 -1
index e0a5c5df58ff..be97436b0857 100644
@@ -533,7 +533,7 @@ _check_device()
 	fi
 
 	case "$FSTYP" in
-	9p|tmpfs|virtiofs)
+	9p|tmpfs|virtiofs|ceph)
 		# 9p and virtiofs mount tags are just plain strings, so anything is allowed
 		# tmpfs doesn't use mount source, ignore
 		;;
common/rc +32 -2
index 7973ceb5fdf8..4fa0b818d840 100644
@@ -1592,7 +1592,7 @@ _require_scratch_nocheck()
 			_notrun "this test requires a valid \$SCRATCH_MNT"
 		fi
 		;;
-	nfs*|ceph)
+	nfs*)
 		echo $SCRATCH_DEV | grep -q ":/" > /dev/null 2>&1
 		if [ -z "$SCRATCH_DEV" -o "$?" != "0" ]; then
 			_notrun "this test requires a valid \$SCRATCH_DEV"
@@ -1601,6 +1601,21 @@ _require_scratch_nocheck()
 			_notrun "this test requires a valid \$SCRATCH_MNT"
 		fi
 		;;
+	ceph)
+		if [ -z "$SCRATCH_DEV" ]; then
+			_notrun "this test requires a valid \$SCRATCH_DEV"
+		fi
+		echo $SCRATCH_DEV | grep -q "=/" > /dev/null 2>&1
+		if [ "$?" != "0" ]; then
+			echo $SCRATCH_DEV | grep -q ":/" > /dev/null 2>&1
+			if [ "$?" != "0" ]; then
+				_notrun "this test requires a valid \$SCRATCH_DEV"
+			fi
+		fi
+		if [ ! -d "$SCRATCH_MNT" ]; then
+			_notrun "this test requires a valid \$SCRATCH_MNT"
+		fi
+		;;
 	pvfs2)
 		echo $SCRATCH_DEV | grep -q "://" > /dev/null 2>&1
 		if [ -z "$SCRATCH_DEV" -o "$?" != "0" ]; then
@@ -1770,7 +1785,7 @@ _require_test()
 			_notrun "this test requires a valid \$TEST_DIR"
 		fi
 		;;
-	nfs*|ceph)
+	nfs*)
 		echo $TEST_DEV | grep -q ":/" > /dev/null 2>&1
 		if [ -z "$TEST_DEV" -o "$?" != "0" ]; then
 			_notrun "this test requires a valid \$TEST_DEV"
@@ -1779,6 +1794,21 @@ _require_test()
 			_notrun "this test requires a valid \$TEST_DIR"
 		fi
 		;;
+	ceph)
+		if [ -z "$TEST_DEV" ]; then
+			_notrun "this test requires a valid \$TEST_DEV"
+		fi
+		echo $TEST_DEV | grep -q "=/" > /dev/null 2>&1
+		if [ "$?" != "0" ]; then
+			echo $TEST_DEV | grep -q ":/" > /dev/null 2>&1
+			if [ "$?" != "0" ]; then
+				_notrun "this test requires a valid \$TEST_DEV"
+			fi
+		fi
+		if [ ! -d "$TEST_DIR" ]; then
+			_notrun "this test requires a valid \$TEST_DIR"
+		fi
+		;;
 	cifs)
 		echo $TEST_DEV | grep -q "//" > /dev/null 2>&1
 		if [ -z "$TEST_DEV" -o "$?" != "0" ]; then
Signature · 1 line
2.33.1
#1 lore raw
Quoted 14 lines · Jeff Layton

Cephfs is introducing a new mount device syntax. Fix the fstests infrastructure to handle the new syntax correctly.

---
 common/config |  2 +-
 common/rc     | 34 ++++++++++++++++++++++++++++++++--
 2 files changed, 33 insertions(+), 3 deletions(-)
common/config +0 -0
index e0a5c5df58ff..be97436b0857 100644

common/config _check_device() · line 538

Quoted 7 lines
common/config +1 -1
@@ -533,7 +533,7 @@ _check_device()
 	fi
 
 	case "$FSTYP" in
-	9p|tmpfs|virtiofs)
+	9p|tmpfs|virtiofs|ceph)
 		# 9p and virtiofs mount tags are just plain strings, so anything is allowed
 		# tmpfs doesn't use mount source, ignore

Better to add a comment to explain why add *ceph* at here, especially others all have explanation. But I think you might still want to check if it's a network url, not only just skip the checking directly. Except it's similar with virtiofs use plain strings. As there's below checking in _check_device() function:

if [ -b "$dev" ] || ( echo $dev | grep -qE ":|//" ); then
# block device or a network url
return 0
fi

Can grep -qE ":|=|//" or something else help you through this checking? I'm not familar with cephfs, so just ask if it's as you wish.

Thanks,
Zorro

Quoted 70 lines
common/config +0 -0
 		;;
common/rc +32 -2
index 7973ceb5fdf8..4fa0b818d840 100644
@@ -1592,7 +1592,7 @@ _require_scratch_nocheck()
 			_notrun "this test requires a valid \$SCRATCH_MNT"
 		fi
 		;;
-	nfs*|ceph)
+	nfs*)
 		echo $SCRATCH_DEV | grep -q ":/" > /dev/null 2>&1
 		if [ -z "$SCRATCH_DEV" -o "$?" != "0" ]; then
 			_notrun "this test requires a valid \$SCRATCH_DEV"
@@ -1601,6 +1601,21 @@ _require_scratch_nocheck()
 			_notrun "this test requires a valid \$SCRATCH_MNT"
 		fi
 		;;
+	ceph)
+		if [ -z "$SCRATCH_DEV" ]; then
+			_notrun "this test requires a valid \$SCRATCH_DEV"
+		fi
+		echo $SCRATCH_DEV | grep -q "=/" > /dev/null 2>&1
+		if [ "$?" != "0" ]; then
+			echo $SCRATCH_DEV | grep -q ":/" > /dev/null 2>&1
+			if [ "$?" != "0" ]; then
+				_notrun "this test requires a valid \$SCRATCH_DEV"
+			fi
+		fi
+		if [ ! -d "$SCRATCH_MNT" ]; then
+			_notrun "this test requires a valid \$SCRATCH_MNT"
+		fi
+		;;
 	pvfs2)
 		echo $SCRATCH_DEV | grep -q "://" > /dev/null 2>&1
 		if [ -z "$SCRATCH_DEV" -o "$?" != "0" ]; then
@@ -1770,7 +1785,7 @@ _require_test()
 			_notrun "this test requires a valid \$TEST_DIR"
 		fi
 		;;
-	nfs*|ceph)
+	nfs*)
 		echo $TEST_DEV | grep -q ":/" > /dev/null 2>&1
 		if [ -z "$TEST_DEV" -o "$?" != "0" ]; then
 			_notrun "this test requires a valid \$TEST_DEV"
@@ -1779,6 +1794,21 @@ _require_test()
 			_notrun "this test requires a valid \$TEST_DIR"
 		fi
 		;;
+	ceph)
+		if [ -z "$TEST_DEV" ]; then
+			_notrun "this test requires a valid \$TEST_DEV"
+		fi
+		echo $TEST_DEV | grep -q "=/" > /dev/null 2>&1
+		if [ "$?" != "0" ]; then
+			echo $TEST_DEV | grep -q ":/" > /dev/null 2>&1
+			if [ "$?" != "0" ]; then
+				_notrun "this test requires a valid \$TEST_DEV"
+			fi
+		fi
+		if [ ! -d "$TEST_DIR" ]; then
+			_notrun "this test requires a valid \$TEST_DIR"
+		fi
+		;;
 	cifs)
 		echo $TEST_DEV | grep -q "//" > /dev/null 2>&1
 		if [ -z "$TEST_DEV" -o "$?" != "0" ]; then
Signature · 1 line
2.33.1