[Devel] [PATCH RHEL7 COMMIT] vziolimit/fs/ext4: allow to throttle due to iolimit while reading directory blocks

Konstantin Khorenko khorenko at virtuozzo.com
Thu Feb 11 02:32:53 PST 2016


The commit is pushed to "branch-rh7-3.10.0-327.3.1-vz7.10.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-327.3.1.vz7.10.11
------>
commit d6f25b2a19445ae470e27fcb1b39904773b15e7f
Author: Vladimir Davydov <vdavydov at virtuozzo.com>
Date:   Thu Feb 11 14:32:53 2016 +0400

    vziolimit/fs/ext4: allow to throttle due to iolimit while reading directory blocks
    
    Currently, we only throttle on reading/writing page cache. As a result,
    if a user runs e.g. `find` inside a container, it will quickly consume
    all available quota, so that a following attempt to read/write a file
    will hang for an unacceptably long period of time in order to compensate
    for the burst.
    
    Fix this by adding a VIRTINFO_IO_PREPARE call to ext4_read_dirblock.
    
    Reported-by: Andrew Perepechko <panda at cloudlinux.com>
    Signed-off-by: Vladimir Davydov <vdavydov at virtuozzo.com>
    Acked-by: Dmitry Monakhov <dmonakhov at virtuozzo.com>
---
 fs/ext4/namei.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
index dff134a..0adc6df 100644
--- a/fs/ext4/namei.c
+++ b/fs/ext4/namei.c
@@ -34,6 +34,7 @@
 #include <linux/quotaops.h>
 #include <linux/buffer_head.h>
 #include <linux/bio.h>
+#include <linux/virtinfo.h>
 #include "ext4.h"
 #include "ext4_jbd2.h"
 
@@ -96,6 +97,8 @@ static struct buffer_head *__ext4_read_dirblock(struct inode *inode,
 	struct ext4_dir_entry *dirent;
 	int err = 0, is_dx_block = 0;
 
+	virtinfo_notifier_call(VITYPE_IO, VIRTINFO_IO_PREPARE, NULL);
+
 	bh = ext4_bread(NULL, inode, block, 0, &err);
 	if (!bh) {
 		if (err == 0) {


More information about the Devel mailing list