diff --git a/WHATS_NEW b/WHATS_NEW index a8da20e49..42c0aa1f2 100644 --- a/WHATS_NEW +++ b/WHATS_NEW @@ -1,5 +1,6 @@ Version 2.02.57 - ==================================== + Do not allow creating mirrors of more than 8 images. Use locking_type 3 (compiled in cluster locking) in lvmconf. Remove duplicate dm_list macros and functions. Log failure type and recognise type 'F' (flush) in dmeventd mirror plugin. diff --git a/lib/config/defaults.h b/lib/config/defaults.h index 824fec2e0..c4a23a42f 100644 --- a/lib/config/defaults.h +++ b/lib/config/defaults.h @@ -47,6 +47,7 @@ #define DEFAULT_MIRRORLOG "disk" #define DEFAULT_MIRROR_LOG_FAULT_POLICY "allocate" #define DEFAULT_MIRROR_DEV_FAULT_POLICY "remove" +#define DEFAULT_MIRROR_MAX_IMAGES 8 /* limited by kernel DM_KCOPYD_MAX_REGIONS */ #define DEFAULT_DMEVENTD_MIRROR_LIB "libdevmapper-event-lvm2mirror.so" #define DEFAULT_DMEVENTD_MONITOR 1 diff --git a/tools/lvconvert.c b/tools/lvconvert.c index 0821c3067..b179f601a 100644 --- a/tools/lvconvert.c +++ b/tools/lvconvert.c @@ -571,6 +571,12 @@ static int _lvconvert_mirrors(struct cmd_context *cmd, struct logical_volume *lv else lp->mirrors += 1; + if (lp->mirrors > DEFAULT_MIRROR_MAX_IMAGES) { + log_error("Only up to %d images in mirror supported currently.", + DEFAULT_MIRROR_MAX_IMAGES); + return 0; + } + if (repair) { cmd->handles_missing_pvs = 1; cmd->partial_activation = 1; diff --git a/tools/lvcreate.c b/tools/lvcreate.c index f250f371d..2b2d13534 100644 --- a/tools/lvcreate.c +++ b/tools/lvcreate.c @@ -500,6 +500,12 @@ static int _lvcreate_params(struct lvcreate_params *lp, return 0; } + if (lp->mirrors > DEFAULT_MIRROR_MAX_IMAGES) { + log_error("Only up to %d images in mirror supported currently.", + DEFAULT_MIRROR_MAX_IMAGES); + return 0; + } + /* * Read ahead. */