[Top] [All Lists]

Re: [PATCH v2 2/3] xfs: fix infinite loop by detaching the group/project

To: Christoph Hellwig <hch@xxxxxxxxxxxxx>
Subject: Re: [PATCH v2 2/3] xfs: fix infinite loop by detaching the group/project hints from user dquot
From: Jeff Liu <jeff.liu@xxxxxxxxxx>
Date: Fri, 29 Nov 2013 17:36:01 +0800
Cc: "xfs@xxxxxxxxxxx" <xfs@xxxxxxxxxxx>
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <20131128104336.GE26927@xxxxxxxxxxxxx>
References: <5294A469.1060000@xxxxxxxxxx> <20131128104336.GE26927@xxxxxxxxxxxxx>
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.1.0
On 11/28 2013 18:43 PM, Christoph Hellwig wrote:
> On Tue, Nov 26, 2013 at 09:38:49PM +0800, Jeff Liu wrote:
>> +    if (flags & XFS_QMOPT_UQUOTA)
>> +            return xfs_qm_dqpurge(dqp, NULL);
> To me it doesn't make any sense to overload this function for the user
> quotas that don't have hints.
To me it would like a silly compromise.
> I'd suggest dropping this hunk and keeping a separate walk for
> releasing the uquots.
I thought this over and yup, that is an overload if neither group nor project
are enabled, or we don't want to turn user quota off.

But even so, we currently also have overloads by checking group/project hints
before releasing any type of quota in xfs_qm_purge().  In this point, this fix
can reduce a bit overloads by moving those checkups to xfs_qm_purge_hints() if
we want to turn group/project quotas off.

If we considering to drop above hunk to release user quota separately, we 
would have to walk through user quota to remove those hints again, i.e,

/* Remove group/project hints from user dquot */
        struct xfs_dquot        *dqp,
        void                    *data)
        uint                    flags = *((uint *)data);
        struct xfs_dquot        *gdqp;
        struct xfs_dquot        *pdqp;

        if (dqp->dq_flags & XFS_DQ_FREEING) {
                return EAGAIN;

        /* If this quota has a hint attached, prepare for releasing it now */
        gdqp = dqp->q_gdquot;
        if (gdqp)
                dqp->q_gdquot = NULL;

        pdqp = dqp->q_pdquot;
        if (pdqp)
                dqp->q_pdquot = NULL;


        if (gdqp)
        if (pdqp)

        return 0;

        xfs_qm_dquot_walk(mp, XFS_DQ_USER, xfs_qm_dqpurge_hints, NULL);

        if (flags & XFS_QMOPT_UQUOTA)
                xfs_qm_dquot_walk(mp, XFS_DQ_USER, xfs_qm_dqpurge, NULL);
        if (flags & XFS_QMOPT_GQUOTA)
                xfs_qm_dquot_walk(mp, XFS_DQ_GROUP, xfs_qm_dqpurge, NULL);
        if (flags & XFS_QMOPT_PQUOTA)
                xfs_qm_dquot_walk(mp, XFS_DQ_PROJ, xfs_qm_dqpurge, NULL);

Above code is what I can figured out as per your suggestions for now, but it
would introduce overheads for walking through user dquots to release hints
separately if we want to turn user quota off.

Any thoughts?


<Prev in Thread] Current Thread [Next in Thread>