[prev in list] [next in list] [prev in thread] [next in thread] 

List:       linux-unionfs
Subject:    [PATCH 1/2] common: remove all files in $SCRATCH_DEV for overlayfs in _scratch_cleanup_files()
From:       Eryu Guan <eguan () redhat ! com>
Date:       2016-01-11 11:38:20
Message-ID: 1452512301-22145-1-git-send-email-eguan () redhat ! com
[Download RAW message or body]

All files in lower/upper dirs should be removed for overlayfs in
_scratch_cleanup_files(), not only files in merged dir, otherwise files
from lower dir won't be removed.

Signed-off-by: Eryu Guan <eguan@redhat.com>
---
 common/rc | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/common/rc b/common/rc
index e5ae1d0..e2a32da 100644
--- a/common/rc
+++ b/common/rc
@@ -701,9 +701,17 @@ _mkfs_dev()
 # remove all files in $SCRATCH_MNT, useful when testing on NFS/CIFS
 _scratch_cleanup_files()
 {
-	_scratch_mount
-	rm -rf $SCRATCH_MNT/*
-	_scratch_unmount
+	case $FSTYP in
+	overlay)
+		# $SCRATCH_DEV is a valid directory in overlay case
+		rm -rf $SCRATCH_DEV/*
+		;;
+	*)
+		_scratch_mount
+		rm -rf $SCRATCH_MNT/*
+		_scratch_unmount
+		;;
+	esac
 }
 
 _scratch_mkfs()
-- 
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-unionfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic