From a0bc45a83747afe7c82b8fda7438748fabe5a994 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Wed, 10 Apr 2024 15:30:36 +0200 Subject: [KERNEL] Fix build on CentOS 9.5-but-newer So far, breaking changes were accompanied with a bump of the minor version, but not this time. Bewetween -432 and-435, the signature of disk_force_media_change() changed (haha), but the version number stayed the same. Pick the completely arbitrary macro QUEUE_FLAG_SYNCHRONOUS which only exists in -435 to tell the versions apart. --- .github/workflows/build-kernel-modules.yml | 8 ++++---- src/kernel/xloop_main_rhel_9.0.c | 12 ++++++++++++ 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-kernel-modules.yml b/.github/workflows/build-kernel-modules.yml index 85a54cc..7d51ee2 100644 --- a/.github/workflows/build-kernel-modules.yml +++ b/.github/workflows/build-kernel-modules.yml @@ -41,14 +41,14 @@ jobs: build-os: ubuntu-22.04 kernel-type: centos-rpm kernel-source: https://vault.centos.org/8.5.2111/BaseOS/Source/SPackages/kernel-4.18.0-348.7.1.el8_5.src.rpm - - name: CentOS 9.4 [5.14.0] - build-os: ubuntu-22.04 - kernel-type: centos-tar - kernel-source: https://files.bwlp.ks.uni-freiburg.de/stuff/centos/linux-5.14.0-427.el9.tar.xz - name: CentOS 9.5 [5.14.0] build-os: ubuntu-22.04 kernel-type: centos-tar kernel-source: https://files.bwlp.ks.uni-freiburg.de/stuff/centos/linux-5.14.0-432.el9.tar.xz + - name: CentOS 9.5b [5.14.0] + build-os: ubuntu-22.04 + kernel-type: centos-tar + kernel-source: https://files.bwlp.ks.uni-freiburg.de/stuff/centos/linux-5.14.0-435.el9.tar.xz name: Build xloop ${{ matrix.config.name }} runs-on: ${{ matrix.config.build-os }} steps: diff --git a/src/kernel/xloop_main_rhel_9.0.c b/src/kernel/xloop_main_rhel_9.0.c index e35284e..f654e8e 100644 --- a/src/kernel/xloop_main_rhel_9.0.c +++ b/src/kernel/xloop_main_rhel_9.0.c @@ -471,7 +471,11 @@ static int xloop_change_fd(struct xloop_device *xlo, struct block_device *bdev, goto out_err; /* and ... switch */ +#ifdef QUEUE_FLAG_SYNCHRONOUS + disk_force_media_change(xlo->xlo_disk); +#else disk_force_media_change(xlo->xlo_disk, DISK_EVENT_MEDIA_CHANGE); +#endif blk_mq_freeze_queue(xlo->xlo_queue); mapping_set_gfp_mask(old_file->f_mapping, xlo->old_gfp_mask); xlo->xlo_backing_file = file; @@ -969,7 +973,11 @@ static int xloop_configure(struct xloop_device *xlo, fmode_t mode, goto out_unlock; } +#ifdef QUEUE_FLAG_SYNCHRONOUS + disk_force_media_change(xlo->xlo_disk); +#else disk_force_media_change(xlo->xlo_disk, DISK_EVENT_MEDIA_CHANGE); +#endif set_disk_ro(xlo->xlo_disk, (xlo->xlo_flags & XLO_FLAGS_READ_ONLY) != 0); INIT_WORK(&xlo->rootcg_work, xloop_rootcg_workfn); @@ -1129,7 +1137,11 @@ static int __xloop_clr_fd(struct xloop_device *xlo, bool release) partscan = xlo->xlo_flags & XLO_FLAGS_PARTSCAN && bdev; xlo_number = xlo->xlo_number; +#ifdef QUEUE_FLAG_SYNCHRONOUS + disk_force_media_change(xlo->xlo_disk); +#else disk_force_media_change(xlo->xlo_disk, DISK_EVENT_MEDIA_CHANGE); +#endif out_unlock: mutex_unlock(&xlo->xlo_mutex); if (partscan) { -- cgit v1.2.3-55-g7522