Message ID | cb095532-b72b-6369-7304-3b589568f0fe@redhat.com (mailing list archive) |
---|---|
State | Superseded, archived |
Headers | show |
Series | xfs: fix project quota ENOSPC vs EDQUOT | expand |
On Thu, May 07, 2020 at 10:38:33PM -0500, Eric Sandeen wrote: > 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. Looks weird, but given that it has historical precedence, and you fix all this mess up in the next patch: Reviewed-by: Christoph Hellwig <hch@lst.de>
On Thu, May 07, 2020 at 10:38:33PM -0500, Eric Sandeen wrote: > 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: Brian Foster <bfoster@redhat.com> > > diff --git a/fs/xfs/xfs_trans_dquot.c b/fs/xfs/xfs_trans_dquot.c > index e4eca607e512..47c6e88c9db6 100644 > --- a/fs/xfs/xfs_trans_dquot.c > +++ b/fs/xfs/xfs_trans_dquot.c > @@ -757,7 +757,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; > } >
On 5/8/20 2:13 AM, Christoph Hellwig wrote: > On Thu, May 07, 2020 at 10:38:33PM -0500, Eric Sandeen wrote: >> 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. > > Looks weird, but given that it has historical precedence, and you fix > all this mess up in the next patch: > > Reviewed-by: Christoph Hellwig <hch@lst.de> Thanks. I could roll it all up into one patch if that's better, this seemed half weird / half more-obvious.... -Eric
diff --git a/fs/xfs/xfs_trans_dquot.c b/fs/xfs/xfs_trans_dquot.c index e4eca607e512..47c6e88c9db6 100644 --- a/fs/xfs/xfs_trans_dquot.c +++ b/fs/xfs/xfs_trans_dquot.c @@ -757,7 +757,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; }
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> ---