On Wed, Jan 13, 2010 at 05:05:50PM -0500, Christoph Hellwig wrote:
> Wire up quota_send_warning to send quota warnings over netlink. This is
> used by various desktops to show user quota warnings.
A couple of comments below.
> Tested by running the quota_nld daemon while running the xfstest quota
> tests and observing the warnings. I'll see how I can get a more formal
> testcase for it written.
Sounds like it needs something similar to the dmapi event listeners
we use for testing that the dmapi events are generated correctly....
> Signed-off-by: Christoph Hellwig <hch@xxxxxx>
> Index: xfs/fs/xfs/quota/xfs_trans_dquot.c
> --- xfs.orig/fs/xfs/quota/xfs_trans_dquot.c 2010-01-13 13:51:20.925003101
> +++ xfs/fs/xfs/quota/xfs_trans_dquot.c 2010-01-13 14:10:46.083254517
> @@ -589,6 +589,20 @@ xfs_trans_unreserve_and_mod_dquots(
> +STATIC void
> + struct xfs_mount *mp,
> + struct xfs_dquot *dqp,
> + int hard)
> + /* no warnings for project quotas - we just return ENOSPC later */
> + if (dqp->dq_flags & XFS_DQ_PROJ)
> + return;
> + quota_send_warning((dqp->dq_flags & XFS_DQ_USER) ? USRQUOTA : GRPQUOTA,
> + be32_to_cpu(dqp->q_core.d_id), mp->m_super->s_dev,
> + hard ? QUOTA_NL_BHARDWARN: QUOTA_NL_BSOFTWARN);
This appears to send "over block quota" warnings even when
the error is caused by the number of inodes going over limit.
For inode count warnings we should be sending QUOTA_NL_IHARDWARN or
QUOTA_NL_ISOFTWARN. That could be easily done if the "hard"
parameter is changed to the type of warning which is set up
in the calling function.
We could probably even return the grace limit expired versions
as well when over the soft limits with a slight change to the
soft limit warning logic as well...
> * This reserves disk blocks and inodes against a dquot.
> * Flags indicate if the dquot is to be locked here and also
> @@ -612,6 +626,7 @@ xfs_trans_dqresv(
> xfs_qcnt_t count;
> xfs_qcnt_t *resbcountp;
> xfs_quotainfo_t *q = mp->m_quotainfo;
> + int hardwarn = 0;
As mentioned above, this should probably be a "warn_type"
parameter rather than a boolean hard/soft warning flag.