aboutsummaryrefslogtreecommitdiffstats
path: root/smtpd/queue_fs.c
diff options
context:
space:
mode:
authorEric Faurot <eric@faurot.net>2014-06-10 13:52:09 +0200
committerEric Faurot <eric@faurot.net>2014-06-10 13:52:09 +0200
commitc4a79c3606eeadbdb79cf1862595547463bba236 (patch)
tree23efcba1a93964f2c5814e0827d412054d7f5d21 /smtpd/queue_fs.c
parentVarious queue-proce related updates: (diff)
parentmissing smtp-in in log (diff)
downloadOpenSMTPD-c4a79c3606eeadbdb79cf1862595547463bba236.tar.xz
OpenSMTPD-c4a79c3606eeadbdb79cf1862595547463bba236.zip
Merge branch 'master' of ssh.poolp.org:/git/opensmtpd
Diffstat (limited to 'smtpd/queue_fs.c')
-rw-r--r--smtpd/queue_fs.c32
1 files changed, 4 insertions, 28 deletions
diff --git a/smtpd/queue_fs.c b/smtpd/queue_fs.c
index 77b35784..00c0d4d6 100644
--- a/smtpd/queue_fs.c
+++ b/smtpd/queue_fs.c
@@ -49,9 +49,8 @@
#define PATH_EVPTMP PATH_INCOMING "/envelope.tmp"
#define PATH_MESSAGE "/message"
-/* percentage of remaining space / inodes required to accept new messages */
-#define MINSPACE 5
-#define MININODES 5
+/* minimum number of free blocks on filesystem */
+#define MINFREEBLOCKS 100
struct qwalk {
FTS *fts;
@@ -385,8 +384,6 @@ static int
fsqueue_check_space(void)
{
struct statfs buf;
- uint64_t used;
- uint64_t total;
if (statfs(PATH_QUEUE, &buf) < 0) {
log_warn("warn: queue-fs: statfs");
@@ -402,29 +399,8 @@ fsqueue_check_space(void)
(int64_t)buf.f_bfree == -1 || (int64_t)buf.f_ffree == -1)
return 1;
- used = buf.f_blocks - buf.f_bfree;
- total = buf.f_bavail + used;
- if (total != 0)
- used = (float)used / (float)total * 100;
- else
- used = 100;
- if (100 - used < MINSPACE) {
- log_warnx("warn: not enough disk space: %llu%% left",
- (unsigned long long) 100 - used);
- log_warnx("warn: temporarily rejecting messages");
- return 0;
- }
-
- used = buf.f_files - buf.f_ffree;
- total = buf.f_favail + used;
- if (total != 0)
- used = (float)used / (float)total * 100;
- else
- used = 100;
- if (100 - used < MININODES) {
- log_warnx("warn: not enough inodes: %llu%% left",
- (unsigned long long) 100 - used);
- log_warnx("warn: temporarily rejecting messages");
+ if (buf.f_bavail < MINFREEBLOCKS) {
+ log_warnx("warn: disk space running low, temporarily rejecting messages");
return 0;
}