[Devel] [PATCH RHEL7 COMMIT] ploop: Add check that ploop don't grow endlessly
Konstantin Khorenko
khorenko at virtuozzo.com
Mon Apr 15 16:41:56 MSK 2019
The commit is pushed to "branch-rh7-3.10.0-957.10.1.vz7.94.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-957.10.1.vz7.94.13
------>
commit 3209b332026cd631a8e7ba7557f9beca87f07638
Author: Kirill Tkhai <ktkhai at virtuozzo.com>
Date: Mon Apr 15 16:41:55 2019 +0300
ploop: Add check that ploop don't grow endlessly
Even during resize, ploop can must follow limitations.
Add a sanity check for that.
Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
drivers/block/ploop/fmt_ploop1.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/drivers/block/ploop/fmt_ploop1.c b/drivers/block/ploop/fmt_ploop1.c
index 738b96cb48f1..32c9a08e0e84 100644
--- a/drivers/block/ploop/fmt_ploop1.c
+++ b/drivers/block/ploop/fmt_ploop1.c
@@ -315,8 +315,10 @@ ploop1_allocate(struct ploop_delta * delta, struct ploop_request * preq,
struct bio_list * sbl, unsigned int size)
{
struct ploop1_private * ph = delta->priv;
- unsigned int max_size;
+ unsigned int log = delta->cluster_log;
+ struct ploop_device *plo = delta->plo;
cluster_t cluster = 0;
+ u64 max_size;
int ret;
if (delta->holes_bitmap) {
@@ -327,7 +329,13 @@ ploop1_allocate(struct ploop_delta * delta, struct ploop_request * preq,
cluster = 0; /* grow in process? */
}
- max_size = (delta->max_delta_size >> delta->cluster_log);
+ max_size = delta->max_delta_size;
+ if (plo->maintenance_type == PLOOP_MNTN_GROW) {
+ /* Even in case of resize, alloc_head can't grow endlessly */
+ max_size = min(plo->grow_new_size >> 9, max_size);
+ }
+ max_size = max_size >> log;
+
if (!cluster && delta->io.alloc_head >= max_size) {
PLOOP_FAIL_REQUEST(preq, -E2BIG);
return;
More information about the Devel
mailing list