Donald Douwsma | 2 Mar 2007 00:26
Picon
Favicon

Re: [PATCH] repquota does't report correct space usage

Utako Kusaka wrote:
> Hi,
> 
> repquota may report incorrect space usage when the filesystem is mounted
> repeatedly with different quota options.
> The cause of the problem is that xfs_qm_quotacheck() is not called because
> the `CHKD' flag in mp->m_qflags is not cleared until it is mounted with 
> no quota option. This patch fixes it.

Good find, I've heard of some problems with quota 'corruption' that may
actually be caused by this.

> --- linux-2.6.20-orgn/fs/xfs/quota/xfs_qm.c.orgn        2007-02-22 17:30:07.000000000 +0900
> +++ linux-2.6.20/fs/xfs/xfs_qm.c        2007-02-22 17:30:58.000000000 +0900
>  <at>  <at>  -1175,8 +1175,6  <at>  <at>  xfs_qm_init_quotainfo(
>         qinf->qi_dqperchunk = BBTOB(qinf->qi_dqchunklen);
>         do_div(qinf->qi_dqperchunk, sizeof(xfs_dqblk_t));
> 
> -       mp->m_qflags |= (mp->m_sb.sb_qflags & XFS_ALL_QUOTA_CHKD);
> -
>         /*
>          * We try to get the limits from the superuser's limits fields.
>          * This is quite hacky, but it is standard quota practice.

This disables the optimization that skips the quota check for the normal case where mount
options have not been changed.

I don't have any quota check performance figures handy but I don't think we can loose this
optimization for people with large filesystems/machines.

I think instead we need to clear the individual quota bit when a filesystem is mounted
without a particular quota type. This will force a quota check but only when the filesystem
is again mounted with that quota type.

Donald


Gmane