[Devel] [PATCH rh7 26/38] ploop: warning on "disk full" condition

Andrey Smetanin asmetanin at virtuozzo.com
Fri May 15 09:48:27 PDT 2015


People complain that it's not always obvious why an app in CT gets
-ENOSPC while there remains some space on host filesystem.

The patch adds time ratelimited printk about "disk full" condition.
Maximal rate is 1 per hour.

https://bugzilla.openvz.org/show_bug.cgi?id=3045

Signed-off-by: Maxim Patlasov <MPatlasov at parallels.com>
---
 drivers/block/ploop/dev.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/block/ploop/dev.c b/drivers/block/ploop/dev.c
index 9aaab4a..ab99724 100644
--- a/drivers/block/ploop/dev.c
+++ b/drivers/block/ploop/dev.c
@@ -3533,8 +3533,18 @@ static int ploop_bd_full(struct backing_dev_info *bdi, long long nr, int root)
 
 		current->journal_info = NULL;
 		ret = sb->s_op->statfs(F_DENTRY(file), &buf);
-		if (ret || buf.f_bfree * buf.f_bsize < reserved + nr)
+		if (ret || buf.f_bfree * buf.f_bsize < reserved + nr) {
+			static unsigned long full_warn_time;
+
+			if (printk_timed_ratelimit(&full_warn_time, 60*60*HZ))
+				printk(KERN_WARNING
+				       "ploop%d: host disk is almost full "
+				       "(%llu < %llu); CT sees -ENOSPC !\n",
+				       plo->index, buf.f_bfree * buf.f_bsize,
+				       reserved + nr);
+
 			rc = 1;
+		}
 
 		fput(file);
 		current->journal_info = jctx;
-- 
1.9.3




More information about the Devel mailing list