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. --- src/kernel/xloop_main_rhel_9.0.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src') 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