All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC] common: overlay support tmpfs
@ 2022-04-24  6:37 Baokun Li
  2022-04-24 12:02 ` Amir Goldstein
  0 siblings, 1 reply; 8+ messages in thread
From: Baokun Li @ 2022-04-24  6:37 UTC (permalink / raw)
  To: zlang, guaneryu, fstests; +Cc: libaokun1, yukuai3

xfstests support overlay+tmpfs

```local.config.example
export FSTYP=tmpfs
export TEST_DEV=tmpfs_test
export TEST_DIR=/tmp/test
export TEST_FS_MOUNT_OPTS="-t tmpfs"
export SCRATCH_DEV=tmpfs_scratch
export SCRATCH_MNT=/tmp/scratch
export MOUNT_OPTIONS="-t tmpfs"
```
Run `./check -overlay tests` to execute test case on overlay+tmpfs.

Signed-off-by: Baokun Li <libaokun1@huawei.com>
---
 common/config | 4 ++--
 common/rc     | 7 ++++++-
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/common/config b/common/config
index 1033b890..3dc047e8 100644
--- a/common/config
+++ b/common/config
@@ -614,7 +614,7 @@ _overlay_config_override()
 	#    the new OVL_BASE_SCRATCH/TEST_DEV/MNT vars are set to the values
 	#    of the configured base fs and SCRATCH/TEST_DEV vars are set to the
 	#    overlayfs base and mount dirs inside base fs mount.
-	[ -b "$TEST_DEV" ] || [ -c "$TEST_DEV" ] || return 0
+	[ -b "$TEST_DEV" ] || [ -c "$TEST_DEV" ] || [ "$FSTYP" == tmpfs ] || return 0
 
 	# Config file may specify base fs type, but we obay -overlay flag
 	[ "$FSTYP" == overlay ] || export OVL_BASE_FSTYP="$FSTYP"
@@ -634,7 +634,7 @@ _overlay_config_override()
 	export TEST_DIR="$OVL_BASE_TEST_DIR/$OVL_MNT"
 	export MOUNT_OPTIONS="$OVERLAY_MOUNT_OPTIONS"
 
-	[ -b "$SCRATCH_DEV" ] || [ -c "$SCRATCH_DEV" ] || return 0
+	[ -b "$SCRATCH_DEV" ] || [ -c "$SCRATCH_DEV" ] || [ "$OVL_BASE_FSTYP" == tmpfs ] || return 0
 
 	# Store original base fs vars
 	export OVL_BASE_SCRATCH_DEV="$SCRATCH_DEV"
diff --git a/common/rc b/common/rc
index 553ae350..12498189 100644
--- a/common/rc
+++ b/common/rc
@@ -834,13 +834,18 @@ _scratch_mkfs()
 	local mkfs_status
 
 	case $FSTYP in
-	nfs*|cifs|ceph|overlay|glusterfs|pvfs2|9p|virtiofs)
+	nfs*|cifs|ceph|glusterfs|pvfs2|9p|virtiofs)
 		# unable to re-create this fstyp, just remove all files in
 		# $SCRATCH_MNT to avoid EEXIST caused by the leftover files
 		# created in previous runs
 		_scratch_cleanup_files
 		return $?
 		;;
+	overlay)
+		[ ! "$OVL_BASE_FSTYP" == tmpfs ] || return 0
+		_scratch_cleanup_files
+		return $?
+		;;
 	tmpfs)
 		# do nothing for tmpfs
 		return 0
-- 
2.31.1


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

end of thread, other threads:[~2022-04-25 13:00 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-24  6:37 [RFC] common: overlay support tmpfs Baokun Li
2022-04-24 12:02 ` Amir Goldstein
2022-04-24 13:23   ` Zorro Lang
2022-04-24 14:34     ` Amir Goldstein
2022-04-24 18:41       ` Zorro Lang
2022-04-24 20:42         ` Amir Goldstein
     [not found]   ` <eccdacb7-ae04-23fe-4657-528d1c22f801@huawei.com>
2022-04-25 10:42     ` Amir Goldstein
2022-04-25 12:59       ` libaokun (A)

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.