[Devel] [PATCH rh7] fs: ext4: allow to throttle due to iolimit while reading directory blocks

Vladimir Davydov vdavydov at virtuozzo.com
Tue Feb 9 01:41:26 PST 2016


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>
---
 fs/ext4/namei.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
index dff134a6fac9..0adc6df24120 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) {
-- 
2.1.4



More information about the Devel mailing list