xfs: group quota should return EDQUOT when prj quota enabled
authorEric Sandeen <sandeen@redhat.com>
Thu, 21 May 2020 20:06:59 +0000 (13:06 -0700)
committerDarrick J. Wong <darrick.wong@oracle.com>
Wed, 27 May 2020 15:49:25 +0000 (08:49 -0700)
Long ago, group & project quota were mutually exclusive, and so
when we turned on XFS_QMOPT_ENOSPC ("return ENOSPC if project quota
is exceeded") when project quota was enabled, we only needed to
disable it again for user quota.

When group & project quota got separated, this got missed, and as a
result if project quota is enabled and group quota is exceeded, the
error code returned is incorrectly returned as ENOSPC not EDQUOT.

Fix this by stripping XFS_QMOPT_ENOSPC out of flags for group
quota when we try to reserve the space.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
fs/xfs/xfs_trans_dquot.c

index d1b9869bc5fa61f723947da51199b708a809b394..2c3557a80e69945350f55bf93c91b0334e94dbbb 100644 (file)
@@ -758,7 +758,8 @@ xfs_trans_reserve_quota_bydquots(
        }
 
        if (gdqp) {
-               error = xfs_trans_dqresv(tp, mp, gdqp, nblks, ninos, flags);
+               error = xfs_trans_dqresv(tp, mp, gdqp, nblks, ninos,
+                                       (flags & ~XFS_QMOPT_ENOSPC));
                if (error)
                        goto unwind_usr;
        }