All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: Alex Elder <aelder@sgi.com>
Cc: xfs@oss.sgi.com
Subject: Re: [PATCH] xfs_showargs() reports group *and* project quotas enabled
Date: Wed, 26 Aug 2009 18:14:47 -0400	[thread overview]
Message-ID: <20090826221446.GD18119@infradead.org> (raw)
In-Reply-To: <1AB9A794DBDDF54A8A81BE2296F7BDFE83ABD9@cf--amer001e--3.americas.sgi.com>

On Wed, Aug 26, 2009 at 12:46:12PM -0500, Alex Elder wrote:
> If you enable group or project quotas on an XFS file system, then the
> mount table presented through /proc/self/mounts erroneously shows
> that both options are in effect for the file system.  The root of
> the problem is some bad logic in the xfs_showargs() function, which
> is used to format the file system type-specific options in effect
> for a file system.
> 
> The problem originated in this GIT commit:
>     Move platform specific mount option parse out of core XFS code
>     Date: 11/22/07
>     Author: Dave Chinner
>     SHA1 ID: a67d7c5f5d25d0b13a4dfb182697135b014fa478
> 
> For XFS quotas, project and group quota management are mutually
> exclusive--only one can be in effect at a time.  There are two
> parts to managing quotas:  aggregating usage information; and
> enforcing limits.  It is possible to have a quota in effect
> (aggregating usage) but not enforced.
> 
> These features are recorded on an XFS mount point using these flags:
>     XFS_PQUOTA_ACCT - Project quotas are aggregated
>     XFS_GQUOTA_ACCT - Group quotas are aggregated
>     XFS_OQUOTA_ENFD - Project/group quotas are enforced
> 
> The code in error is in fs/xfs/linux-2.6/xfs_super.c:
> 
>         if (mp->m_qflags & (XFS_PQUOTA_ACCT|XFS_OQUOTA_ENFD))
>                 seq_puts(m, "," MNTOPT_PRJQUOTA);
>         else if (mp->m_qflags & XFS_PQUOTA_ACCT)
>                 seq_puts(m, "," MNTOPT_PQUOTANOENF);
> 
>         if (mp->m_qflags & (XFS_GQUOTA_ACCT|XFS_OQUOTA_ENFD))
>                 seq_puts(m, "," MNTOPT_GRPQUOTA);
>         else if (mp->m_qflags & XFS_GQUOTA_ACCT)
>                 seq_puts(m, "," MNTOPT_GQUOTANOENF);
> 
> The problem is that XFS_OQUOTA_ENFD will be set in mp->m_qflags
> if either group or project quotas are enforced, and as a result
> both MNTOPT_PRJQUOTA and MNTOPT_GRPQUOTA will be shown as mount
> options.

Indeed.  Thanks for the detailed analysis.


Reviewed-by: Christoph Hellwig <hch@lst.de>

> 
> Signed-off-by: Alex Elder <aelder@sgi.com>
> 
> ---
>  fs/xfs/linux-2.6/xfs_super.c |   20 ++++++++++++--------
>  1 file changed, 12 insertions(+), 8 deletions(-)
> 
> Index: b/fs/xfs/linux-2.6/xfs_super.c
> ===================================================================
> --- a/fs/xfs/linux-2.6/xfs_super.c
> +++ b/fs/xfs/linux-2.6/xfs_super.c
> @@ -579,15 +579,19 @@ xfs_showargs(
>  	else if (mp->m_qflags & XFS_UQUOTA_ACCT)
>  		seq_puts(m, "," MNTOPT_UQUOTANOENF);
>  
> -	if (mp->m_qflags & (XFS_PQUOTA_ACCT|XFS_OQUOTA_ENFD))
> -		seq_puts(m, "," MNTOPT_PRJQUOTA);
> -	else if (mp->m_qflags & XFS_PQUOTA_ACCT)
> -		seq_puts(m, "," MNTOPT_PQUOTANOENF);
> +	/* Either project or group quotas can be active, not both */
>  
> -	if (mp->m_qflags & (XFS_GQUOTA_ACCT|XFS_OQUOTA_ENFD))
> -		seq_puts(m, "," MNTOPT_GRPQUOTA);
> -	else if (mp->m_qflags & XFS_GQUOTA_ACCT)
> -		seq_puts(m, "," MNTOPT_GQUOTANOENF);
> +	if (mp->m_qflags & XFS_PQUOTA_ACCT) {
> +		if (mp->m_qflags & XFS_OQUOTA_ENFD)
> +			seq_puts(m, "," MNTOPT_PRJQUOTA);
> +		else
> +			seq_puts(m, "," MNTOPT_PQUOTANOENF);
> +	} else if (mp->m_qflags & XFS_GQUOTA_ACCT) {
> +		if (mp->m_qflags & XFS_OQUOTA_ENFD)
> +			seq_puts(m, "," MNTOPT_GRPQUOTA);
> +		else
> +			seq_puts(m, "," MNTOPT_GQUOTANOENF);
> +	}
>  
>  	if (!(mp->m_qflags & XFS_ALL_QUOTA_ACCT))
>  		seq_puts(m, "," MNTOPT_NOQUOTA);
> 
> _______________________________________________
> xfs mailing list
> xfs@oss.sgi.com
> http://oss.sgi.com/mailman/listinfo/xfs
---end quoted text---

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

  reply	other threads:[~2009-08-26 22:14 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-12 21:16 [PATCH 0/7] inode allocation cleanups Christoph Hellwig
2009-05-12 21:16 ` [PATCH 1/7] xfs: factor out inode initialisation Christoph Hellwig
2009-05-12 21:16 ` [PATCH 2/7] xfs: improve xfs_inobt_get_rec prototype Christoph Hellwig
2009-05-12 21:16 ` [PATCH 3/7] xfs: improve xfs_inobt_update prototype Christoph Hellwig
2009-05-12 21:16 ` [PATCH 4/7] xfs: factor out debug checks from xfs_dialloc and xfs_difree Christoph Hellwig
2009-05-12 21:16 ` [PATCH 5/7] xfs: untangle xfs_dialloc Christoph Hellwig
2009-05-12 21:16 ` [PATCH 6/7] xfs: rationalize xfs_inobt_lookup* Christoph Hellwig
2009-05-12 21:16 ` [PATCH 7/7] xfs: speed up free inode search Christoph Hellwig
2009-08-24 15:30 ` [PATCH 0/7] inode allocation cleanups Christoph Hellwig
2009-08-25 17:57   ` Alex Elder
2009-08-25 18:56     ` Christoph Hellwig
2009-08-25 19:12       ` Alex Elder
2009-08-26 17:46         ` [PATCH] xfs_showargs() reports group *and* project quotas enabled Alex Elder
2009-08-26 22:14           ` Christoph Hellwig [this message]
2009-08-27  6:53           ` Felix Blyakher
2009-08-26 17:58         ` [PATCH 0/7] inode allocation cleanups Christoph Hellwig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090826221446.GD18119@infradead.org \
    --to=hch@infradead.org \
    --cc=aelder@sgi.com \
    --cc=xfs@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.