Skip to content

Commit e2b4fe6

Browse files
authored
Merge pull request ceph#58688 from idryomov/wip-67051
qa/workunits/rbd: avoid caching effects in luks-encryption.sh Reviewed-by: Mykola Golub <[email protected]>
2 parents ef1a6eb + 9e1c034 commit e2b4fe6

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

qa/workunits/rbd/luks-encryption.sh

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,12 @@ function test_encryption_format() {
4747
sudo chmod 666 $LIBRBD_DEV
4848

4949
# write via librbd && compare
50-
dd if=/tmp/testdata1 of=$LIBRBD_DEV oflag=direct bs=1M
50+
dd if=/tmp/testdata1 of=$LIBRBD_DEV conv=fsync bs=1M
5151
dd if=/dev/mapper/cryptsetupdev of=/tmp/cmpdata iflag=direct bs=4M count=4
5252
cmp -n 16MB /tmp/cmpdata /tmp/testdata1
5353

5454
# write via cryptsetup && compare
55-
dd if=/tmp/testdata2 of=/dev/mapper/cryptsetupdev oflag=direct bs=1M
55+
dd if=/tmp/testdata2 of=/dev/mapper/cryptsetupdev conv=fsync bs=1M
5656
dd if=$LIBRBD_DEV of=/tmp/cmpdata iflag=direct bs=4M count=4
5757
cmp -n 16MB /tmp/cmpdata /tmp/testdata2
5858

@@ -74,7 +74,7 @@ function test_clone_encryption() {
7474
clean_up_cryptsetup
7575

7676
# write 1MB plaintext
77-
dd if=/tmp/testdata1 of=$RAW_DEV oflag=direct bs=1M count=1
77+
dd if=/tmp/testdata1 of=$RAW_DEV conv=fsync bs=1M count=1
7878

7979
# clone (luks1)
8080
rbd snap create testimg@snap
@@ -85,9 +85,9 @@ function test_clone_encryption() {
8585
# open encryption with librbd, write one more MB, close
8686
LIBRBD_DEV=$(_sudo rbd -p rbd map testimg1 -t nbd -o encryption-format=luks1,encryption-passphrase-file=/tmp/passphrase)
8787
sudo chmod 666 $LIBRBD_DEV
88-
dd if=$LIBRBD_DEV of=/tmp/cmpdata iflag=direct bs=1M count=1
88+
dd if=$LIBRBD_DEV of=/tmp/cmpdata bs=1M count=1
8989
cmp -n 1MB /tmp/cmpdata /tmp/testdata1
90-
dd if=/tmp/testdata1 of=$LIBRBD_DEV seek=1 skip=1 oflag=direct bs=1M count=1
90+
dd if=/tmp/testdata1 of=$LIBRBD_DEV seek=1 skip=1 conv=fsync bs=1M count=1
9191
_sudo rbd device unmap -t nbd $LIBRBD_DEV
9292

9393
# second clone (luks2)
@@ -99,9 +99,9 @@ function test_clone_encryption() {
9999
# open encryption with librbd, write one more MB, close
100100
LIBRBD_DEV=$(_sudo rbd -p rbd map testimg2 -t nbd -o encryption-format=luks2,encryption-passphrase-file=/tmp/passphrase2,encryption-format=luks1,encryption-passphrase-file=/tmp/passphrase)
101101
sudo chmod 666 $LIBRBD_DEV
102-
dd if=$LIBRBD_DEV of=/tmp/cmpdata iflag=direct bs=1M count=2
102+
dd if=$LIBRBD_DEV of=/tmp/cmpdata bs=1M count=2
103103
cmp -n 2MB /tmp/cmpdata /tmp/testdata1
104-
dd if=/tmp/testdata1 of=$LIBRBD_DEV seek=2 skip=2 oflag=direct bs=1M count=1
104+
dd if=/tmp/testdata1 of=$LIBRBD_DEV seek=2 skip=2 conv=fsync bs=1M count=1
105105
_sudo rbd device unmap -t nbd $LIBRBD_DEV
106106

107107
# flatten
@@ -112,7 +112,7 @@ function test_clone_encryption() {
112112
RAW_FLAT_DEV=$(_sudo rbd -p rbd map testimg2 -t nbd)
113113
sudo cryptsetup open $RAW_FLAT_DEV --type luks cryptsetupdev -d /tmp/passphrase2
114114
sudo chmod 666 /dev/mapper/cryptsetupdev
115-
dd if=/dev/mapper/cryptsetupdev of=/tmp/cmpdata iflag=direct bs=1M count=3
115+
dd if=/dev/mapper/cryptsetupdev of=/tmp/cmpdata bs=1M count=3
116116
cmp -n 3MB /tmp/cmpdata /tmp/testdata1
117117
_sudo rbd device unmap -t nbd $RAW_FLAT_DEV
118118
}
@@ -149,7 +149,7 @@ function test_plaintext_detection {
149149
test_clone_and_load_with_a_single_passphrase true
150150

151151
# no luks header
152-
dd if=/dev/zero of=$RAW_DEV oflag=direct bs=4M count=8
152+
dd if=/dev/zero of=$RAW_DEV conv=fsync bs=4M count=8
153153
test_clone_and_load_with_a_single_passphrase false
154154
}
155155

0 commit comments

Comments
 (0)