linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Anand Jain <anand.jain@oracle.com>
To: linux-btrfs@vger.kernel.org
Cc: clm@fb.com, dsterba@suse.cz
Subject: [PATCH] fstests: btrfs: support encryption
Date: Tue, 13 Sep 2016 21:39:50 +0800	[thread overview]
Message-ID: <1473773990-3071-5-git-send-email-anand.jain@oracle.com> (raw)
In-Reply-To: <1473773990-3071-1-git-send-email-anand.jain@oracle.com>

This will help to test kernel encryption patch, and
when compiled with the below defines. So to use the
existing fstests test-cases on top of encryption.

diff --git a/fs/btrfs/encrypt.h b/fs/btrfs/encrypt.h
index 8e794da9d8f5..1ae6840d0742 100644
--- a/fs/btrfs/encrypt.h
+++ b/fs/btrfs/encrypt.h
@@ -25,9 +25,9 @@
 #ifndef BTRFS_CRYPT_SUB_FEATURES
 //testing
        //enable method
-       #define BTRFS_CRYPTO_TEST_ENABLE_BYMNTOPT       0
+       #define BTRFS_CRYPTO_TEST_ENABLE_BYMNTOPT       1
        //key choice
-       #define BTRFS_CRYPTO_TEST_BYDUMMYKEY            0 //off rest
+       #define BTRFS_CRYPTO_TEST_BYDUMMYKEY            1 //off rest
        #define BTRFS_CRYPTO_TEST_BYDUMMYENC            0 //off rest

Now use the following mount option during fstests to
exercise the extents with encryption.
  MOUNT_OPTIONS="-o compress=ctr(aes)"

As of now this mount option isn't for the end users but
for the testing only, but inspired by ecryptfs, we could
provide such an interface if useful. 

(Not sending this patch to fstests community as of now, but
it would be in the long run).

Signed-off-by: Anand Jain <anand.jain@oracle.com>
---
 common/filter.btrfs |   2 +-
 common/rc           |   2 +-
 tests/btrfs/041     |   2 +
 tests/btrfs/041.out |  13 ++++
 tests/btrfs/052     |  12 +++
 tests/btrfs/052.out | 214 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/btrfs/079     |   2 +
 tests/btrfs/125     |   2 +-
 tests/generic/297   |   6 +-
 tests/generic/298   |   2 +-
 10 files changed, 251 insertions(+), 6 deletions(-)

diff --git a/common/filter.btrfs b/common/filter.btrfs
index 9970f4d42fce..cf93f6156247 100644
--- a/common/filter.btrfs
+++ b/common/filter.btrfs
@@ -69,7 +69,7 @@ _filter_btrfs_subvol_delete()
 
 _filter_btrfs_compress_property()
 {
-	sed -e "s/compression=\(lzo\|zlib\)/COMPRESSION=XXX/g"
+	sed -e "s/compression=\(lzo\|zlib\|ctr(aes)\)/COMPRESSION=XXX/g"
 }
 
 # filter name of the property from the output, optionally verify against $1
diff --git a/common/rc b/common/rc
index 67762a7fc834..a0e486bf55d2 100644
--- a/common/rc
+++ b/common/rc
@@ -3481,7 +3481,7 @@ _btrfs_stress_remount_compress()
 {
 	local btrfs_mnt=$1
 	while true; do
-		for algo in no zlib lzo; do
+		for algo in no zlib lzo 'ctr(aes)'; do
 			$MOUNT_PROG -o remount,compress=$algo $btrfs_mnt
 		done
 	done
diff --git a/tests/btrfs/041 b/tests/btrfs/041
index 8bb74cd2a241..be4a10fb3746 100755
--- a/tests/btrfs/041
+++ b/tests/btrfs/041
@@ -106,6 +106,8 @@ echo "Testing restore of file compressed with lzo"
 test_btrfs_restore "lzo"
 echo "Testing restore of file compressed with zlib"
 test_btrfs_restore "zlib"
+echo "Testing restore of file encrypted with ctr(aes)"
+test_btrfs_restore "ctr(aes)"
 echo "Testing restore of file without any compression"
 test_btrfs_restore
 
diff --git a/tests/btrfs/041.out b/tests/btrfs/041.out
index 9f4e53dec979..b8d5234649ef 100644
--- a/tests/btrfs/041.out
+++ b/tests/btrfs/041.out
@@ -25,6 +25,19 @@ wrote 100/100 bytes at offset 99000
 XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 67edd038aaa42adb5a1aa78f2eb1d2b6  SCRATCH_MNT/foo
 67edd038aaa42adb5a1aa78f2eb1d2b6
+Testing restore of file encrypted with ctr(aes)
+wrote 100000/100000 bytes at offset 0
+XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+wrote 100000/100000 bytes at offset 100000
+XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+wrote 2/2 bytes at offset 10000
+XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+wrote 11/11 bytes at offset 33000
+XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+wrote 100/100 bytes at offset 99000
+XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+67edd038aaa42adb5a1aa78f2eb1d2b6  SCRATCH_MNT/foo
+67edd038aaa42adb5a1aa78f2eb1d2b6
 Testing restore of file without any compression
 wrote 100000/100000 bytes at offset 0
 XXX Bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
diff --git a/tests/btrfs/052 b/tests/btrfs/052
index 599d2616f92f..94b555c4f422 100755
--- a/tests/btrfs/052
+++ b/tests/btrfs/052
@@ -186,5 +186,17 @@ _scratch_unmount
 echo "Testing with a nocow file and zlib compression"
 test_btrfs_clone_same_file "nodatacow,compress-force=zlib"
 
+_scratch_unmount
+
+echo "Testing with a cow file and ctr(aes) encryption"
+test_btrfs_clone_same_file "compress-force=ctr(aes)"
+
+_scratch_unmount
+
+echo "Testing with a nocow file and ctr(aes) encryption"
+test_btrfs_clone_same_file "nodatacow,compress-force=ctr(aes)"
+
+_scratch_unmount
+
 status=0
 exit
diff --git a/tests/btrfs/052.out b/tests/btrfs/052.out
index ac5924ecfa04..034d54fa7248 100644
--- a/tests/btrfs/052.out
+++ b/tests/btrfs/052.out
@@ -641,3 +641,217 @@ Blocks modified: [0 - 1]
 23 05 05 05 05 05 05 05 05 05 05 05 05 05 05 05 05
 *
 30
+Testing with a cow file and ctr(aes) encryption
+Blocks modified: [0 - 1]
+Blocks modified: [2 - 3]
+Blocks modified: [4 - 5]
+Blocks modified: [6 - 7]
+Blocks modified: [8 - 23]
+0 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01
+*
+2 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
+*
+4 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03
+*
+6 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04
+*
+10 05 05 05 05 05 05 05 05 05 05 05 05 05 05 05 05
+*
+30
+clone failed: Invalid argument
+0 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01
+*
+2 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
+*
+4 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03
+*
+6 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04
+*
+10 05 05 05 05 05 05 05 05 05 05 05 05 05 05 05 05
+*
+30
+clone failed: Invalid argument
+0 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01
+*
+2 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
+*
+4 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03
+*
+6 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04
+*
+10 05 05 05 05 05 05 05 05 05 05 05 05 05 05 05 05
+*
+30
+0 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04
+*
+2 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
+*
+4 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03
+*
+6 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04
+*
+10 05 05 05 05 05 05 05 05 05 05 05 05 05 05 05 05
+*
+30
+0 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04
+*
+2 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
+*
+6 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04
+*
+10 05 05 05 05 05 05 05 05 05 05 05 05 05 05 05 05
+*
+30
+0 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04
+*
+2 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
+*
+6 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04
+*
+10 05 05 05 05 05 05 05 05 05 05 05 05 05 05 05 05
+*
+20 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
+*
+21 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04
+*
+23 05 05 05 05 05 05 05 05 05 05 05 05 05 05 05 05
+*
+30
+Blocks modified: [0 - 1]
+0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
+*
+2 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
+*
+6 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04
+*
+10 05 05 05 05 05 05 05 05 05 05 05 05 05 05 05 05
+*
+20 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
+*
+21 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04
+*
+23 05 05 05 05 05 05 05 05 05 05 05 05 05 05 05 05
+*
+30
+0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
+*
+2 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
+*
+6 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04
+*
+10 05 05 05 05 05 05 05 05 05 05 05 05 05 05 05 05
+*
+20 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
+*
+21 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04
+*
+23 05 05 05 05 05 05 05 05 05 05 05 05 05 05 05 05
+*
+30
+Testing with a nocow file and ctr(aes) encryption
+Blocks modified: [0 - 1]
+Blocks modified: [2 - 3]
+Blocks modified: [4 - 5]
+Blocks modified: [6 - 7]
+Blocks modified: [8 - 23]
+0 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01
+*
+2 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
+*
+4 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03
+*
+6 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04
+*
+10 05 05 05 05 05 05 05 05 05 05 05 05 05 05 05 05
+*
+30
+clone failed: Invalid argument
+0 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01
+*
+2 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
+*
+4 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03
+*
+6 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04
+*
+10 05 05 05 05 05 05 05 05 05 05 05 05 05 05 05 05
+*
+30
+clone failed: Invalid argument
+0 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01
+*
+2 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
+*
+4 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03
+*
+6 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04
+*
+10 05 05 05 05 05 05 05 05 05 05 05 05 05 05 05 05
+*
+30
+0 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04
+*
+2 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
+*
+4 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03 03
+*
+6 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04
+*
+10 05 05 05 05 05 05 05 05 05 05 05 05 05 05 05 05
+*
+30
+0 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04
+*
+2 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
+*
+6 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04
+*
+10 05 05 05 05 05 05 05 05 05 05 05 05 05 05 05 05
+*
+30
+0 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04
+*
+2 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
+*
+6 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04
+*
+10 05 05 05 05 05 05 05 05 05 05 05 05 05 05 05 05
+*
+20 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
+*
+21 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04
+*
+23 05 05 05 05 05 05 05 05 05 05 05 05 05 05 05 05
+*
+30
+Blocks modified: [0 - 1]
+0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
+*
+2 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
+*
+6 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04
+*
+10 05 05 05 05 05 05 05 05 05 05 05 05 05 05 05 05
+*
+20 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
+*
+21 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04
+*
+23 05 05 05 05 05 05 05 05 05 05 05 05 05 05 05 05
+*
+30
+0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
+*
+2 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
+*
+6 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04
+*
+10 05 05 05 05 05 05 05 05 05 05 05 05 05 05 05 05
+*
+20 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
+*
+21 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04
+*
+23 05 05 05 05 05 05 05 05 05 05 05 05 05 05 05 05
+*
+30
diff --git a/tests/btrfs/079 b/tests/btrfs/079
index 6aee3a373f91..489cbb174c9a 100755
--- a/tests/btrfs/079
+++ b/tests/btrfs/079
@@ -48,6 +48,8 @@ _cleanup()
 	wait
 	rm -fr $testfile
 	rm -fr $tmp.* $tmp
+	# to avoid umount getting failed with error busy
+	sleep 30
 }
 
 # get standard environment, filters and checks
diff --git a/tests/btrfs/125 b/tests/btrfs/125
index 1062b87b3eb9..eccb77b6a99e 100755
--- a/tests/btrfs/125
+++ b/tests/btrfs/125
@@ -138,7 +138,7 @@ _run_btrfs_util_prog device scan
 _scratch_mount >> $seqres.full 2>&1
 
 echo >> $seqres.full
-_run_btrfs_util_prog balance start ${SCRATCH_MNT}
+_run_btrfs_util_prog balance start --full-balance ${SCRATCH_MNT}
 
 _run_btrfs_util_prog filesystem show
 _run_btrfs_util_prog filesystem df ${SCRATCH_MNT}
diff --git a/tests/generic/297 b/tests/generic/297
index 4ae2b9c634c7..43d314710206 100755
--- a/tests/generic/297
+++ b/tests/generic/297
@@ -33,6 +33,8 @@ _cleanup()
 {
     cd /
     rm -rf $tmp.* $TEST_DIR/before $TEST_DIR/after
+    sync
+    sleep 40
 }
 
 # get standard environment, filters and checks
@@ -63,7 +65,7 @@ blksz="$(stat -f $testdir -c '%S')"
 _pwrite_byte 0x61 0 $blksz $testdir/file1 >> $seqres.full
 
 fnr=26		# 2^26 reflink extents should be enough to find a slow op?
-timeout=8	# guarantee a good long run...
+timeout=40	# guarantee a good long run...
 echo "Find a reflink size that takes a long time"
 truncate -s $(( (2 ** i) * blksz)) $testdir/file1
 for i in $(seq 0 $fnr); do
@@ -92,7 +94,7 @@ echo "reflink of $n bytes took $delta seconds" >> $seqres.full
 test $delta -gt $timeout && _fail "reflink didn't stop in time, n=$n t=$delta"
 
 echo "Check scratch fs"
-sleep 2		# give it a few seconds to actually die...
+sleep 40		# give it a few seconds to actually die...
 
 # success, all done
 status=0
diff --git a/tests/generic/298 b/tests/generic/298
index e85db1266fa9..4092efa6b961 100755
--- a/tests/generic/298
+++ b/tests/generic/298
@@ -92,7 +92,7 @@ echo "reflink of $n bytes took $delta seconds" >> $seqres.full
 test $delta -gt $timeout && _fail "reflink didn't stop in time, n=$n t=$delta"
 
 echo "Check scratch fs"
-sleep 2		# give it a few seconds to actually die...
+sleep 40		# give it a few seconds to actually die...
 
 # success, all done
 status=0
-- 
2.7.0


  parent reply	other threads:[~2016-09-13 13:38 UTC|newest]

Thread overview: 66+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-13 13:39 [RFC] Preliminary BTRFS Encryption Anand Jain
2016-09-13 13:39 ` [PATCH] btrfs: Encryption: Add btrfs encryption support Anand Jain
2016-09-13 14:12   ` kbuild test robot
2016-09-13 14:24   ` kbuild test robot
2016-09-13 16:10   ` kbuild test robot
2016-09-13 13:39 ` [PATCH 1/2] btrfs-progs: make wait_for_commit non static Anand Jain
2016-09-13 13:39 ` [PATCH 2/2] btrfs-progs: add encryption support Anand Jain
2016-09-13 13:39 ` Anand Jain [this message]
2016-09-13 16:42 ` [RFC] Preliminary BTRFS Encryption Wilson Meier
2016-09-14  7:02   ` Anand Jain
2016-09-14 18:26     ` Wilson Meier
2016-09-15  4:53 ` Alex Elsayed
2016-09-15 11:33   ` Anand Jain
2016-09-15 11:47     ` Alex Elsayed
2016-09-16 11:35       ` Anand Jain
2016-09-15  5:38 ` Chris Murphy
2016-09-15 11:32   ` Anand Jain
2016-09-15 11:37 ` Austin S. Hemmelgarn
2016-09-15 14:06   ` Anand Jain
2016-09-15 14:24     ` Austin S. Hemmelgarn
2016-09-16  8:58       ` David Sterba
2016-09-17  2:18       ` Zygo Blaxell
2016-09-16  1:12 ` Dave Chinner
2016-09-16  5:47   ` Roman Mamedov
2016-09-16  6:49   ` Alex Elsayed
2016-09-17  4:38     ` Zygo Blaxell
2016-09-17  6:37       ` Alex Elsayed
2016-09-19 18:08         ` Zygo Blaxell
2016-09-19 20:01           ` Alex Elsayed
2016-09-19 22:22             ` Zygo Blaxell
2016-09-19 22:25             ` Chris Murphy
2016-09-19 22:31               ` Zygo Blaxell
2016-09-20  1:10                 ` Zygo Blaxell
2016-09-17 18:45       ` David Sterba
2016-09-20 14:26         ` Anand Jain
2016-09-16 10:45   ` Brendan Hide
2016-09-16 11:46   ` Anand Jain
2016-09-16  8:49 ` David Sterba
2016-09-16 11:56   ` Anand Jain
2016-09-17 20:35     ` David Sterba
2016-09-18  8:34       ` RAID1 availability issue[2], Hot-spare and auto-replace Anand Jain
2016-09-18 17:28         ` Chris Murphy
2016-09-18 17:34           ` Chris Murphy
2016-09-19  2:25           ` Anand Jain
2016-09-19 12:07             ` Austin S. Hemmelgarn
2016-09-19 12:25           ` Austin S. Hemmelgarn
2016-09-18  9:54       ` [RFC] Preliminary BTRFS Encryption Anand Jain
2016-09-20  0:12   ` Chris Mason
2016-09-20  0:55     ` Anand Jain
2016-09-17  6:58 ` Eric Biggers
2016-09-17  7:13   ` Alex Elsayed
2016-09-19 18:57     ` Zygo Blaxell
2016-09-19 19:50       ` Alex Elsayed
2016-09-19 22:12         ` Zygo Blaxell
2016-09-17 16:12   ` Anand Jain
2016-09-17 18:57     ` Chris Murphy
2016-09-19 15:15 ` Experimental btrfs encryption Theodore Ts'o
2016-09-19 20:58   ` Alex Elsayed
2016-09-20  0:32     ` Chris Mason
2016-09-20  2:47       ` Alex Elsayed
2016-09-20  2:50       ` Theodore Ts'o
2016-09-20  3:05         ` Alex Elsayed
2016-09-20  4:09         ` Zygo Blaxell
2016-09-20 15:44         ` Chris Mason
2016-09-21 13:52           ` Anand Jain
2016-09-20  4:05   ` Anand Jain

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1473773990-3071-5-git-send-email-anand.jain@oracle.com \
    --to=anand.jain@oracle.com \
    --cc=clm@fb.com \
    --cc=dsterba@suse.cz \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).