public inbox for linux-ext4@vger.kernel.org
 help / color / mirror / Atom feed
From: "Theodore Ts'o" <tytso@mit.edu>
To: Jan Kara <jack@suse.cz>
Cc: linux-ext4@vger.kernel.org
Subject: Re: [PATCH 2/2] tune2fs: Fix conversion of quota files
Date: Fri, 20 Aug 2021 18:44:56 -0400	[thread overview]
Message-ID: <YSAwaKONl7vptrX/@mit.edu> (raw)
In-Reply-To: <20210820194656.27799-3-jack@suse.cz>

On Fri, Aug 20, 2021 at 09:46:56PM +0200, Jan Kara wrote:
> 
> diff --git a/lib/support/mkquota.c b/lib/support/mkquota.c
> index fbc3833aee98..34ab632fb81c 100644
> --- a/lib/support/mkquota.c
> +++ b/lib/support/mkquota.c
> @@ -569,14 +569,14 @@ static int scan_dquots_callback(struct dquot *dquot, void *cb_data)
>   */
>  static errcode_t quota_read_all_dquots(struct quota_handle *qh,
>                                         quota_ctx_t qctx,
> -				       int update_limits EXT2FS_ATTR((unused)))
> +				       int update_limits)
>  {
>  	struct scan_dquots_data scan_data;
>  
>  	scan_data.quota_dict = qctx->quota_dict[qh->qh_type];
>  	scan_data.check_consistency = 0;
> -	scan_data.update_limits = 0;
> -	scan_data.update_usage = 1;
> +	scan_data.update_limits = update_limits;
> +	scan_data.update_usage = 0;
>  
>  	return qh->qh_ops->scan_dquots(qh, scan_dquots_callback, &scan_data);
>  }

This change, while it is correct for tune2fs, is breaking e2fsck's
f_orphquot test.  The root cause is that e2fsck_read_all_quotas() in
e2fsck/super.c is calling quota_update_limits(), where it had wanted
to be reading the quota usage data, not the limits.

I think what we need to do is to take quota_read_all_dquots(), which
is only used by quota_update_limits(), and then fodl it into
quota_update_limits().  And then add a flags parameter to indicate
whether we want to be reading the limits or the usage, and then rename
quota_update_limits() to quota_read_all_dquots().

Does that make sense to you?  (One of the reasons why the quota
functions are all in libsupport is precisely because I knew these
functions still needed more polishing.)

						- Ted

  reply	other threads:[~2021-08-20 22:45 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-20 19:46 [PATCH 0/2] Quota fixes for e2fsprogs Jan Kara
2021-08-20 19:46 ` [PATCH 1/2] quota: Add support to version 0 quota format Jan Kara
2021-08-20 19:46 ` [PATCH 2/2] tune2fs: Fix conversion of quota files Jan Kara
2021-08-20 22:44   ` Theodore Ts'o [this message]
2021-08-23 14:01     ` Jan Kara

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=YSAwaKONl7vptrX/@mit.edu \
    --to=tytso@mit.edu \
    --cc=jack@suse.cz \
    --cc=linux-ext4@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox