All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Sandeen <sandeen@sandeen.net>
To: xfs@oss.sgi.com
Subject: Re: [PATCH v3] xfs_quota: print quota id number if the name can't be found
Date: Thu, 7 Apr 2016 09:51:35 -0500	[thread overview]
Message-ID: <570673F7.3040107@sandeen.net> (raw)
In-Reply-To: <1460040514-23834-1-git-send-email-zlang@redhat.com>

On 4/7/16 9:48 AM, Zorro Lang wrote:
> When use GETNEXTQUOTA ioctl to report project quota, it always
> report an unexpected quota:
> 
>   (null) 0 0 0 00 [--------]
> 
> The ID 0 store the default quota, even if no one set default quota,
> it still have quota accounting, but not enforced. So GETNEXTQUOTA
> can find and report this undefined quota.
> 
> From this problem, I thought if others' quota name miss, (null) will
> be printed too. e.g.
> 
>   # xfs_quota -xc "limit -u bsoft=300m bhard=400m test" $mnt
>   # xfs_quota -xc "report -u" $mnt
>   User ID          Used       Soft       Hard    Warn/Grace
>   ---------- --------------------------------------------------
>   root                0          0          0     00 [--------]
>   test                0     307200     409600     00 [--------]
>   # userdel -r test
>   # xfs_quota -xc "report -u" $mnt
>   User ID          Used       Soft       Hard    Warn/Grace
>   ---------- --------------------------------------------------
>   root                0          0          0     00 [--------]
>   (null)              0     307200     409600     00 [--------]
> 
> So this problem same with above id 0's problem. For deal with this,
> this patch will print id number if the name can't be found.
> 
> But if use old GETQUOTA ioctl, it won't print project id 0 quota
> information(if it's not defined). That's different with GETNEXTQUOTA.
> For keep consistent, this patch also print project id 0 when use old
> GETQUOTA.
> 
> Signed-off-by: Zorro Lang <zlang@redhat.com>

Looks good to me, thanks Zorro!

Reviewed-by: Eric Sandeen <sandeen@redhat.com>

> ---
> 
> Hi,
> 
> This V3 patch fix some man page problems. Thanks for Eric specified my
> English syntax problems.
> 
> Thanks,
> Zorro
> 
>  man/man8/xfs_quota.8 |  4 +++-
>  quota/report.c       | 16 +++++++++++++++-
>  2 files changed, 18 insertions(+), 2 deletions(-)
> 
> diff --git a/man/man8/xfs_quota.8 b/man/man8/xfs_quota.8
> index 951252b..a14568b 100644
> --- a/man/man8/xfs_quota.8
> +++ b/man/man8/xfs_quota.8
> @@ -357,7 +357,9 @@ option outputs the report to
>  .I file
>  instead of stdout. The
>  .B \-a
> -option reports on all filesystems. The
> +option reports on all filesystems. By default, outputs the name of
> +the user/group/project. If no name is defined for a given ID, outputs
> +the numeric ID instead. The
>  .B \-n
>  option outputs the numeric ID instead of the name. The
>  .B \-L
> diff --git a/quota/report.c b/quota/report.c
> index 48a3f29..cc422d1 100644
> --- a/quota/report.c
> +++ b/quota/report.c
> @@ -389,7 +389,11 @@ report_mount(
>  					name = p->pr_name;
>  			}
>  		}
> -		fprintf(fp, "%-10s", name);
> +		/* If no name is found, print the id #num instead of (null) */
> +		if (name != NULL)
> +			fprintf(fp, "%-10s", name);
> +		else
> +			fprintf(fp, "#%-9u", d.d_id);
>  	}
>  
>  	if (form & XFS_BLOCK_QUOTA) {
> @@ -571,6 +575,16 @@ report_project_mount(
>  			id = oid + 1;
>  		}
>  	} else {
> +		if (!getprprid(0)) {
> +			/*
> +			 * Print default project quota, even if projid 0
> +			 * isn't defined
> +			 */
> +			report_mount(fp, 0, NULL, NULL, form, XFS_PROJ_QUOTA,
> +			             mount, flags);
> +			flags |= NO_HEADER_FLAG;
> +		}
> +
>  		setprent();
>  		while ((p = getprent()) != NULL) {
>  			if (report_mount(fp, p->pr_prid, p->pr_name, NULL,
> 

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

  reply	other threads:[~2016-04-07 14:51 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-07 14:48 [PATCH v3] xfs_quota: print quota id number if the name can't be found Zorro Lang
2016-04-07 14:51 ` Eric Sandeen [this message]
2016-04-07 15:45 ` Christoph Hellwig
2016-05-11  0:09 ` Dave Chinner
2016-05-11  1:28   ` Zorro Lang

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=570673F7.3040107@sandeen.net \
    --to=sandeen@sandeen.net \
    --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.