The commit is pushed to "branch-rh7-3.10.0-327.10.1.vz7.12.x-ovz" and will 
appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-327.10.1.vz7.12.15
------>
commit ccd5d5a157cee360300b67914bd0198671b238d0
Author: Maxim Patlasov <mpatla...@virtuozzo.com>
Date:   Fri Apr 29 18:28:19 2016 +0400

    cbt: add uuid arg to blk_cbt_map_copy_once()
    
    The caller must specify explicitly the uuid of CBT mask to copy. This will
    help to avoid collision between applications performing backup: the second
    will get EINVAL if it attempts to collide with the first.
    
    https://jira.sw.ru/browse/PSBM-45000
    
    Signed-off-by: Maxim Patlasov <mpatla...@virtuozzo.com>
---
 block/blk-cbt.c        | 10 ++++++++--
 include/linux/blkdev.h |  5 +++--
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/block/blk-cbt.c b/block/blk-cbt.c
index 850fd7e..8c52bd8 100644
--- a/block/blk-cbt.c
+++ b/block/blk-cbt.c
@@ -278,8 +278,9 @@ err_cbt:
        return ERR_PTR(-ENOMEM);
 }
 
-int blk_cbt_map_copy_once(struct request_queue *q, struct page ***map_ptr,
-                         blkcnt_t *block_max, blkcnt_t *block_bits)
+int blk_cbt_map_copy_once(struct request_queue *q, __u8 *uuid,
+                         struct page ***map_ptr, blkcnt_t *block_max,
+                         blkcnt_t *block_bits)
 {
        struct cbt_info *cbt;
        struct page **map;
@@ -293,6 +294,11 @@ int blk_cbt_map_copy_once(struct request_queue *q, struct 
page ***map_ptr,
        BUG_ON(!cbt->map);
        BUG_ON(!cbt->block_max);
 
+       if (!uuid || memcmp(uuid, cbt->uuid, sizeof(cbt->uuid))) {
+               mutex_unlock(&cbt_mutex);
+               return -EINVAL;
+       }
+
        cbt_flush_cache(cbt);
 
        npages = NR_PAGES(cbt->block_max);
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 7ae962a..56c3a08 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -1651,8 +1651,9 @@ extern void blk_cbt_update_size(struct block_device 
*bdev);
 extern void blk_cbt_release(struct request_queue *q);
 extern void blk_cbt_bio_queue(struct request_queue *q, struct bio *bio);
 extern int blk_cbt_ioctl(struct block_device *bdev, unsigned cmd, char __user 
*arg);
-extern int blk_cbt_map_copy_once(struct request_queue *q, struct page 
***map_ptr,
-                                blkcnt_t *block_max, blkcnt_t *block_bits);
+extern int blk_cbt_map_copy_once(struct request_queue *q, __u8 *uuid,
+                                struct page ***map_ptr, blkcnt_t *block_max,
+                                blkcnt_t *block_bits);
 #else /* CONFIG_BLK_DEV_CBT */
 static inline void blk_cbt_update_size(struct block_device *bdev)
 {
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

Reply via email to