Re: [exim] Exim, Dovecot, mdir and hardlinks - a true story

Top Page
Delete this message
Reply to this message
Author: Phil Pennock
Date:  
To: Jeremy Harris
CC: exim-users
Subject: Re: [exim] Exim, Dovecot, mdir and hardlinks - a true story
On 2019-08-14 at 12:54 +0100, Jeremy Harris via Exim-users wrote:
> Do we need a fast/poor quota method for cases where the size-file
> cannot be used?


Just to raise the possibility to see if others can spot approaches which
make this feasible rather than a giant can of worms: direct support for
filesystem quotas in Exim, using soft limits set to match Dovecot's.

Caveat in all of this: I've never played with quotas from the C APIs, so
don't know enough to speak authoritatively here; this is based on some
quick man-page and source checks, to write this email.

The portability and maintenance is going to be hell, unless I've missed
some standardization here (very possible). The only approach likely to
reliably expose usage/limits to userland is the NFS RPC server approach,
which could probably be run even without NFS. Otherwise, the issue is
that a lot of things assume that all enforcement is in the kernel and
userland only needs access to manipulate limits, not to query how close
a user is.

On FreeBSD there's quota_open/quota_read/quota_close, which are used by
repquota(8), but that's UFS only. On FreeBSD, the cases to consider
would be NFS, ZFS, UFS. Each different, AFAIK, with no standardized
access across them all. However, the oldest API is quotactl(), which
was in 4.3BSD-Reno, so is widespread. The manpage documents UFS-only.

Underneath, the UFS case uses quotactl(), which is also present on Linux
and appears to be used for other filesystem types on Linux too, albeit
perhaps requiring extra C header imports to work with those.

rc = quotactl(path, Q_GETQUOTA, uid, &result);

Since quotactl() is on, at least, Linux and *BSD, and supports at least
some FS types, it might be worth seeing what sorts of OSes/FSes people
use for delivered email with Exim and design around using this general
API, initially supporting just quotactl() unless/until volunteers
contribute code for other APIs.

That should be a "proper" solution, which is lightweight in use, if
folks already have the FS quotas turned on. Which my uninformed guess
is "yes, because that's the sanest way for Dovecot to implement quotas
with hard link support".

Exim's current approach has the benefit of working everywhere, on all
OSes which Exim supports.

I think that quotactl(), ZFS and NFS are _probably_ the only scenarios
we'd likely end up having code for.

People who actually work with quotas, please shoot holes in everything
I've just said. :)

-Phil