The commit is pushed to "branch-rh9-5.14.0-427.44.1.vz9.80.x-ovz" and will appear at g...@bitbucket.org:openvz/vzkernel.git after rh9-5.14.0-427.44.1.vz9.80.7 ------> commit c692713fc23739893b1bfa0fc6a7da514fd7b3a5 Author: Andrey Zhadchenko <andrey.zhadche...@virtuozzo.com> Date: Tue Jan 28 11:15:07 2025 +0300
block/blk-cbt: introduce ABI versioning so it will be easier to change anything in the future https://virtuozzo.atlassian.net/browse/VSTOR-96269 Signed-off-by: Andrey Zhadchenko <andrey.zhadche...@virtuozzo.com> Reviewed-by: Pavel Tikhomirov <ptikhomi...@virtuozzo.com> ====== Patchset description: blk-cbt: improvements Currently blk-cbt use UUID as a name. This is a big limitation. We are going to expose bitmap names to libvirt, so we should not expect users to follow this. Moreover, even VHI backup utilities use non-UUID names sometimes. Technically QEMU allows us bitmap names up to 1024 bytes, but 128 should be fine. Multiple simultaneous bitmaps are needed for backup plans, so allow them. Add new API to list bitmap names, adjust most of the API to make operations on bitmap with user-provided name. Andrey Zhadchenko (5): block/blk-cbt: rework uuid field block/blk-cbt: allow multiple cbts in a single queue blk-cbt: introduce ABI versioning block/blk-cbt: add BLKCBTLIST ioctl block/blk-cbt: add BLKCBTRENAME instead of BLKCBTSET flag Feature: cbt: changed block tracking (for backup) --- block/blk-cbt.c | 10 ++++++++++ include/uapi/linux/fs.h | 4 ++++ 2 files changed, 14 insertions(+) diff --git a/block/blk-cbt.c b/block/blk-cbt.c index a12d16a1ed39..2543bf1e846c 100644 --- a/block/blk-cbt.c +++ b/block/blk-cbt.c @@ -1011,9 +1011,19 @@ static int cbt_ioc_misc(struct block_device *bdev, void __user *arg) int blk_cbt_ioctl(struct block_device *bdev, unsigned cmd, char __user *arg) { struct blk_user_cbt_info __user *ucbt_ioc; + __u32 abi_version; ucbt_ioc = (struct blk_user_cbt_info __user *) arg; + if (copy_from_user(&abi_version, arg, sizeof(abi_version))) + return -EFAULT; + + if (abi_version != CBT_ABI_VERSION) { + WARN_ONCE(1, "blk-cbt ABI mimatch: kernel has %d, userspace uses %d", + CBT_ABI_VERSION, abi_version); + return -EOPNOTSUPP; + } + if (cmd == BLKCBTGET) return cbt_ioc_get(bdev, ucbt_ioc); diff --git a/include/uapi/linux/fs.h b/include/uapi/linux/fs.h index 5d7014be0139..2aaee5257477 100644 --- a/include/uapi/linux/fs.h +++ b/include/uapi/linux/fs.h @@ -128,10 +128,13 @@ struct blk_user_cbt_extent { __u64 ce_reserved64[1]; }; + +#define CBT_ABI_VERSION 2 #define CBT_NAME_LENGTH 128 #define CBT_MAX_ENTRIES 16 struct blk_user_cbt_info { + __u32 version; /* ABI version */ __u8 ci_name[CBT_NAME_LENGTH]; /* CBT name */ __u64 ci_start; /* start phisical range of mapping which userspace wants (in) */ @@ -153,6 +156,7 @@ enum CI_FLAGS /* Extension of cbt ioctls: */ struct blk_user_cbt_misc_info { + __u32 version; /* ABI version */ __u8 name[CBT_NAME_LENGTH]; /* Bitmap name */ /* Allocate and move pending map to CBT snapshot */ #define CBT_SNAP_CREATE 0 _______________________________________________ Devel mailing list Devel@openvz.org https://lists.openvz.org/mailman/listinfo/devel