Re: [PATCH v2] xfs: improve handling of prjquot ENOSPC

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Dec 19, 2023 at 6:00 AM Dave Chinner <david@xxxxxxxxxxxxx> wrote:
>
> So, with the assumption that project quotas return EDQUOT and not
> ENOSPC, we add this helper to fs/xfs/xfs_dquot.h:
>
> static inline bool
> xfs_dquot_is_enospc(
>         struct xfs_dquot        *dqp)
> {
>         if (!dqp)
>                 return false;
>         if (!xfs_dquot_is_enforced(dqp)
>                 return false;
>         if (dqp->q_blk.hardlimit - dqp->q_blk.reserved > 0)
I need some help on how to improve the above enospc check.
It seems that we need a value that is larger than 0.

4.0K space is available.
# df -h ./
Filesystem      Size  Used Avail Use% Mounted on
/dev/vda1       100M  100M  4.0K 100% /tmp/roothome/vda

ENOSPC is expected, but gets EDQUOT.
# touch t
touch: cannot touch 't': Disk quota exceeded

>
> The buffered write code ends up as:
>
>         .....
>         do {
>                 iolock = XFS_IOLOCK_EXCL;
>                 ret = xfs_ilock_iocb(iocb, iolock);
>                 if (ret)
>                         return ret;
>
>                 ret = xfs_file_write_checks(iocb, from, &iolock);
>                 if (ret)
>                         goto out;
>
>                 trace_xfs_file_buffered_write(iocb, from);
>                 ret = iomap_file_buffered_write(iocb, from,
>                                 &xfs_buffered_write_iomap_ops);
>                 if (!(ret == -EDQUOT || ret = -ENOSPC))
>                         break;
>
>                 xfs_iunlock(ip, iolock);
xfs_iunlock() is called after the retry.
>                 xfs_blockgc_nospace_flush(ip, ret);
>         } while (retries++ == 0);
>
>         if (ret == -EDQUOT && xfs_dquot_is_enospc(ip->i_pdquot))
>                 ret = -ENOSPC;
>         .....
out:
        if (iolock)
                xfs_iunlock(ip, iolock);
Double xfs_iunlock().

Please take a look at the v3 patch.
Thanks.





[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux