summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSimon Rettberg2024-04-10 15:30:36 +0200
committerSimon Rettberg2024-04-10 15:30:36 +0200
commita0bc45a83747afe7c82b8fda7438748fabe5a994 (patch)
tree36199ae2a801e9d853e5aa63f04304c5b2e6fb15 /src
parent[KERNEL] Fix build on Linux 6.8 and CentOS 9.5 (diff)
downloadxloop-a0bc45a83747afe7c82b8fda7438748fabe5a994.tar.gz
xloop-a0bc45a83747afe7c82b8fda7438748fabe5a994.tar.xz
xloop-a0bc45a83747afe7c82b8fda7438748fabe5a994.zip
[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.
Diffstat (limited to 'src')
-rw-r--r--src/kernel/xloop_main_rhel_9.0.c12
1 files changed, 12 insertions, 0 deletions
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) {