[Devel] [PATCH RHEL9 COMMIT] dm-ploop: Check queue_flags size at compile time

Konstantin Khorenko khorenko at virtuozzo.com
Mon Jan 9 20:15:04 MSK 2023


The commit is pushed to "branch-rh9-5.14.0-162.6.1.vz9.18.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh9-5.14.0-162.6.1.el9
------>
commit a19710fcce7a87e1fc8fe1c9425c3e2c017b66e5
Author: Alexander Atanasov <alexander.atanasov at virtuozzo.com>
Date:   Thu Jan 5 18:50:58 2023 +0200

    dm-ploop: Check queue_flags size at compile time
    
    QUEUE_STANDBY_EN flag made the used bits more than 31 so it is now
    required that queue_flags is a 64 bits. Add compile time check to
    ensure it is.
    
    https://jira.sw.ru/browse/PSBM-144163
    Fixes: cc4feb490db5 ("ploop: port and fix the standby mode feature")
    
    Signed-off-by: Alexander Atanasov <alexander.atanasov at virtuozzo.com>
---
 drivers/md/dm-ploop-target.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/md/dm-ploop-target.c b/drivers/md/dm-ploop-target.c
index cc5dbbfa707f..647716ad47ba 100644
--- a/drivers/md/dm-ploop-target.c
+++ b/drivers/md/dm-ploop-target.c
@@ -407,6 +407,10 @@ static int ploop_ctr(struct dm_target *ti, unsigned int argc, char **argv)
 	ti->private = ploop;
 	ploop->ti = ti;
 
+	BUILD_BUG_ON_MSG(
+		sizeof(ploop_blk_queue(ploop)->queue_flags) * 8 < BITS_PER_LONG
+		|| BITS_PER_LONG < 64,
+		"queue_flags require 64 bit storage variable");
 	/*
 	 * Static branch and standby_en bit act as two fuses.
 	 * We only touch standby bit if both are set.


More information about the Devel mailing list