Skip to content
This repository has been archived by the owner on Jan 2, 2025. It is now read-only.

Commit

Permalink
Fix for the Linux Kernel v6.2 (Fedora 37/38) (#258)
Browse files Browse the repository at this point in the history
* Enable Fedora 38
* Added compat for bio_set_op_attrs
* Fixed kernel panic on dereferencing the wrong address
* Increased volume sizes for the new mkfs.xfs (needs at least 300 MB per partition)
* Increased timeouts in CI tests

Closes #247
  • Loading branch information
skypodolsky authored May 10, 2023
1 parent 2ecc357 commit bde38ae
Show file tree
Hide file tree
Showing 9 changed files with 51 additions and 28 deletions.
4 changes: 2 additions & 2 deletions .github/buildbox/Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@ DISTRO['amd64'] = [ "debian8", "debian9", "debian10", "debian11",
"amazon2", "amazon2023",
"centos7", "centos8", "centos9",
"alma8", "alma9",
"fedora31", "fedora32", "fedora34", "fedora35", "fedora36", "fedora37",
"fedora31", "fedora32", "fedora34", "fedora35", "fedora36", "fedora37", "fedora38",
"ubuntu2004", "ubuntu2204" ]

DISTRO['arm64'] = [ "debian10", "debian11",
"amazon2", "amazon2023",
"centos8", "centos9",
"alma8", "alma9",
"fedora35", "fedora36", "fedora37",
"fedora35", "fedora36", "fedora37", "fedora38",
"ubuntu2204" ]

# NOTE: This environment variable should be set to enable triggers of the type "action".
Expand Down
42 changes: 22 additions & 20 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
amazon2, amazon2023,
centos7, centos8, centos9,
debian8, debian9, debian10, debian11,
fedora31, fedora32, fedora34, fedora35, fedora36, fedora37,
fedora31, fedora32, fedora34, fedora35, fedora36, fedora37, fedora38,
ubuntu2004, ubuntu2204
]
arch: [ amd64 ]
Expand All @@ -54,6 +54,8 @@ jobs:
arch: arm64
- distro: fedora37
arch: arm64
- distro: fedora38
arch: arm64
- distro: ubuntu2204
arch: arm64

Expand Down Expand Up @@ -186,15 +188,15 @@ jobs:
vagrant ssh ${{env.INSTANCE_NAME}} -c "cd tests && sudo ./elio-test.sh -f $fs"
done
working-directory: ${{env.BOX_DIR}}
# For now tests are taking 10-20 seconds per 1 fs on amd64 and about 2 minutes on arm64. But they can hang.
# 10 minutes seems to be reasonable timeout.
timeout-minutes: 10
# For now tests are taking up to 40 seconds per 1 fs on amd64 and about 2 minutes on arm64 or older 3.x kernels. But they can hang.
# 20 minutes seems to be reasonable timeout.
timeout-minutes: 20

- name: Show debug information
if: always()
run: vagrant ssh ${{env.INSTANCE_NAME}} -c "cat tests/dmesg.log; sudo dmesg -c; lsmod"
working-directory: ${{env.BOX_DIR}}
timeout-minutes: 1
timeout-minutes: 2

- name: Run tests on LVM (loop device)
if: "${{ matrix.distro != 'debian8'}}"
Expand All @@ -204,14 +206,14 @@ jobs:
done
working-directory: ${{env.BOX_DIR}}
# For now tests are taking 10-20 seconds per 1 fs on amd64 and about 2 minutes on arm64. But they can hang.
# 10 minutes seems to be reasonable timeout.
timeout-minutes: 10
# 20 minutes seems to be reasonable timeout.
timeout-minutes: 20

- name: Show debug information
if: always()
run: vagrant ssh ${{env.INSTANCE_NAME}} -c "cat tests/dmesg.log; sudo dmesg -c; lsmod"
working-directory: ${{env.BOX_DIR}}
timeout-minutes: 1
timeout-minutes: 2

- name: Run tests on RAID (loop device)
if: "${{ matrix.distro != 'debian8'}}"
Expand All @@ -220,9 +222,9 @@ jobs:
vagrant ssh ${{env.INSTANCE_NAME}} -c "cd tests && sudo ./elio-test.sh -f $fs --raid"
done
working-directory: ${{env.BOX_DIR}}
# For now tests are taking 10-20 seconds per 1 fs on amd64 and about 2 minutes on arm64. But they can hang.
# 10 minutes seems to be reasonable timeout.
timeout-minutes: 10
# For now tests are taking up to 40 seconds per 1 fs on amd64 and about 2 minutes on arm64 or older 3.x kernels. But they can hang.
# 20 minutes seems to be reasonable timeout.
timeout-minutes: 20

- name: Show debug information
if: always()
Expand All @@ -232,10 +234,10 @@ jobs:

- name: Attach qcow2 disks
run: |
SZ="2200M"
ARCH=$(uname -m)
TEST_IMAGES=(${TEST_IMAGES})
TEST_DRIVES=(${TEST_DRIVES})
[ ${ARCH} == "x86_64" ] && SZ="1G" || SZ="256M"
[ ${ARCH} != "x86_64" ] && VIRSH_FLAGS="--config" || true
for i in ${!TEST_IMAGES[*]}; do
qemu-img create -f qcow2 ${TEST_IMAGES[i]} $SZ
Expand All @@ -261,13 +263,13 @@ jobs:
vagrant ssh ${{env.INSTANCE_NAME}} -c "cd tests && sudo ./elio-test.sh -d /dev/vdb1 -f $fs"
done
working-directory: ${{env.BOX_DIR}}
timeout-minutes: 10
timeout-minutes: 25

- name: Show debug information
if: always()
run: vagrant ssh ${{env.INSTANCE_NAME}} -c "cat tests/dmesg.log; sudo dmesg -c; lsmod"
working-directory: ${{env.BOX_DIR}}
timeout-minutes: 1
timeout-minutes: 2

- name: Run tests on LVM (qcow2 disks)
if: "${{ matrix.distro != 'debian8'}}"
Expand All @@ -276,13 +278,13 @@ jobs:
vagrant ssh ${{env.INSTANCE_NAME}} -c "cd tests && sudo ./elio-test.sh -d /dev/vdb -d /dev/vdc -f $fs --lvm"
done
working-directory: ${{env.BOX_DIR}}
timeout-minutes: 15
timeout-minutes: 25

- name: Show debug information
if: always()
run: vagrant ssh ${{env.INSTANCE_NAME}} -c "cat tests/dmesg.log; sudo dmesg -c; lsmod"
working-directory: ${{env.BOX_DIR}}
timeout-minutes: 1
timeout-minutes: 2

- name: Run tests on RAID (qcow2 disks)
if: "${{ matrix.distro != 'debian8'}}"
Expand All @@ -294,27 +296,27 @@ jobs:
vagrant ssh ${{env.INSTANCE_NAME}} -c "cd tests && sudo ./elio-test.sh -d /dev/vdb -d /dev/vdc -f $fs --raid"
done
working-directory: ${{env.BOX_DIR}}
timeout-minutes: 15
timeout-minutes: 25

- name: Show debug information
if: always()
run: vagrant ssh ${{env.INSTANCE_NAME}} -c "cat tests/dmesg.log; sudo dmesg -c; lsmod"
working-directory: ${{env.BOX_DIR}}
timeout-minutes: 1
timeout-minutes: 2

- name: Run tests multipart (qcow2 disk)
run: |
for fs in ${FS[*]}; do
vagrant ssh ${{env.INSTANCE_NAME}} -c "cd tests && sudo ./elio-test.sh -d /dev/vdb -f $fs -t test_multipart"
done
working-directory: ${{env.BOX_DIR}}
timeout-minutes: 10
timeout-minutes: 15

- name: Show debug information
if: always()
run: vagrant ssh ${{env.INSTANCE_NAME}} -c "cat tests/dmesg.log; sudo dmesg -c; lsmod"
working-directory: ${{env.BOX_DIR}}
timeout-minutes: 1
timeout-minutes: 2

- name: Detach external drives
if: always()
Expand Down
16 changes: 16 additions & 0 deletions src/configure-tests/feature-tests/bio_set_op_attrs.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// SPDX-License-Identifier: GPL-2.0-only

/*
* Copyright (C) 2023 Elastio Software Inc.
*/

// kernel_version < 6.2

#include "includes.h"
MODULE_LICENSE("GPL");

static inline void dummy(void){
struct bio bio;

bio_set_op_attrs(&bio, REQ_OP_READ, 0);
}
5 changes: 5 additions & 0 deletions src/elastio-snap.c
Original file line number Diff line number Diff line change
Expand Up @@ -298,8 +298,12 @@ typedef enum req_opf req_op_t;
#endif

static inline void elastio_snap_set_bio_ops(struct bio *bio, req_op_t op, unsigned op_flags){
#ifdef HAVE_BIO_SET_OP_ATTRS
bio->bi_opf = 0;
bio_set_op_attrs(bio, op, op_flags);
#else
bio->bi_opf = op | op_flags;
#endif
}

static inline int elastio_snap_bio_op_flagged(struct bio *bio, unsigned int flag){
Expand Down Expand Up @@ -3341,6 +3345,7 @@ static inline struct inode *page_get_inode(struct page *pg){
#endif
if(PageAnon(pg)) return NULL;
if(!pg->mapping) return NULL;
if (!virt_addr_valid(pg->mapping)) return NULL;
return pg->mapping->host;
}

Expand Down
2 changes: 1 addition & 1 deletion tests/devicetestcase.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def setUpClass(cls):
seeds = []
cls.backing_stores = []
cls.devices = []
cls.size_mb = 256
cls.size_mb = 512
cls.is_raid = False

cls.kmod = kmod.Module("../src/elastio-snap.ko")
Expand Down
2 changes: 1 addition & 1 deletion tests/devicetestcase_multipart.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def setUpClass(cls):

# We create the device big enough to perform
# representative 'test_multipart_modify_origins'
cls.size_mb = 1024
cls.size_mb = 2200

for i in range(cls.part_count):
# Unexpectedly randint can generate 2 same numbers in a row.
Expand Down
2 changes: 1 addition & 1 deletion tests/test_multipart.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def test_multipart_modify_origins(self):

# We subtract a couple of megabytes to make sure the cow
# file won't overflow during the test
file_size_mb = math.floor(dev_size_mb * 0.1) - 2
file_size_mb = math.floor(dev_size_mb * 0.1) - 20

testfile = "{}/testfile".format(self.mounts[i])
snapfile = "{}/testfile".format(self.snap_mounts[i])
Expand Down
2 changes: 1 addition & 1 deletion tests/test_snapshot.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def test_modify_origin(self):
if self.is_raid == True:
file_size_mb = math.floor(dev_size_mb * 0.06)
else:
file_size_mb = math.floor(dev_size_mb * 0.1) - 5
file_size_mb = math.floor(dev_size_mb * 0.1) - 20

testfile = "{}/testfile".format(self.mount)
snapfile = "{}/testfile".format(self.snap_mount)
Expand Down
4 changes: 2 additions & 2 deletions tests/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def unmount(path, retry_on_dev_busy=True):
cmd = ["umount", path]
# subprocess.run is introduced in Python 3.5
if not retry_on_dev_busy or sys.version_info <= (3, 5):
subprocess.check_call(cmd, timeout=10)
subprocess.check_call(cmd, timeout=20)
else:
# The retries on device busy error are necessary on Ubuntu 22.04, kernel 5.15
# for the tests test_destroy_unverified_incremental and test_destroy_unverified_snapshot.
Expand All @@ -48,7 +48,7 @@ def dd(ifile, ofile, count, **kwargs):
for k, v in kwargs.items():
cmd.append("{}={}".format(k, v))

subprocess.check_call(cmd, timeout=60)
subprocess.check_call(cmd, timeout=240)


def md5sum(path):
Expand Down

0 comments on commit bde38ae

Please sign in to comment.