public inbox for linux-ext4@vger.kernel.org
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: Baokun Li <libaokun1@huawei.com>
Cc: linux-ext4@vger.kernel.org, tytso@mit.edu,
	adilger.kernel@dilger.ca, jack@suse.cz, ritesh.list@gmail.com,
	linux-kernel@vger.kernel.org, yi.zhang@huawei.com,
	yangerkun@huawei.com, yukuai3@huawei.com
Subject: Re: [PATCH v2 2/2] ext4: refactoring to use the unified helper ext4_quotas_off()
Date: Mon, 27 Mar 2023 11:21:46 +0200	[thread overview]
Message-ID: <20230327092146.z3zllmhry7zjca4d@quack3> (raw)
In-Reply-To: <20230327022703.576857-3-libaokun1@huawei.com>

On Mon 27-03-23 10:27:03, Baokun Li wrote:
> Rename ext4_quota_off_umount() to ext4_quotas_off(), and add type
> parameter to replace open code in ext4_enable_quotas().
> 
> Signed-off-by: Baokun Li <libaokun1@huawei.com>

Looks good. Feel free to add:

Reviewed-by: Jan Kara <jack@suse.cz>

								Honza

> ---
> V1->V2:
> 	Adapting to the changes in PATCH 1/2.
> 
>  fs/ext4/super.c | 26 +++++++-------------------
>  1 file changed, 7 insertions(+), 19 deletions(-)
> 
> diff --git a/fs/ext4/super.c b/fs/ext4/super.c
> index bd1ca1c3022e..59c5dd4dbe5a 100644
> --- a/fs/ext4/super.c
> +++ b/fs/ext4/super.c
> @@ -1157,12 +1157,12 @@ static void dump_orphan_list(struct super_block *sb, struct ext4_sb_info *sbi)
>  #ifdef CONFIG_QUOTA
>  static int ext4_quota_off(struct super_block *sb, int type);
>  
> -static inline void ext4_quota_off_umount(struct super_block *sb)
> +static inline void ext4_quotas_off(struct super_block *sb, int type)
>  {
> -	int type;
> +	BUG_ON(type > EXT4_MAXQUOTAS);
>  
>  	/* Use our quota_off function to clear inode flags etc. */
> -	for (type = 0; type < EXT4_MAXQUOTAS; type++)
> +	for (type--; type >= 0; type--)
>  		ext4_quota_off(sb, type);
>  }
>  
> @@ -1178,7 +1178,7 @@ static inline char *get_qf_name(struct super_block *sb,
>  					 lockdep_is_held(&sb->s_umount));
>  }
>  #else
> -static inline void ext4_quota_off_umount(struct super_block *sb)
> +static inline void ext4_quotas_off(struct super_block *sb, int type)
>  {
>  }
>  #endif
> @@ -1209,7 +1209,7 @@ static void ext4_put_super(struct super_block *sb)
>  			 &sb->s_uuid);
>  
>  	ext4_unregister_li_request(sb);
> -	ext4_quota_off_umount(sb);
> +	ext4_quotas_off(sb, EXT4_MAXQUOTAS);
>  
>  	flush_work(&sbi->s_error_work);
>  	destroy_workqueue(sbi->rsv_conversion_wq);
> @@ -5541,7 +5541,7 @@ static int __ext4_fill_super(struct fs_context *fc, struct super_block *sb)
>  
>  failed_mount10:
>  #ifdef CONFIG_QUOTA
> -	ext4_quota_off_umount(sb);
> +	ext4_quotas_off(sb, EXT4_MAXQUOTAS);
>  failed_mount9:
>  #endif  /* CONFIG_QUOTA */
>  	ext4_release_orphan_info(sb);
> @@ -7014,20 +7014,8 @@ int ext4_enable_quotas(struct super_block *sb)
>  					"(type=%d, err=%d, ino=%lu). "
>  					"Please run e2fsck to fix.", type,
>  					err, qf_inums[type]);
> -				for (type--; type >= 0; type--) {
> -					struct inode *inode;
> -
> -					inode = sb_dqopt(sb)->files[type];
> -					if (inode)
> -						inode = igrab(inode);
> -					dquot_quota_off(sb, type);
> -					if (inode) {
> -						lockdep_set_quota_inode(inode,
> -							I_DATA_SEM_NORMAL);
> -						iput(inode);
> -					}
> -				}
>  
> +				ext4_quotas_off(sb, type);
>  				return err;
>  			}
>  		}
> -- 
> 2.31.1
> 
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

      reply	other threads:[~2023-03-27  9:22 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-27  2:27 [PATCH v2 0/2] ext4: fix quotas leak in __ext4_fill_super() Baokun Li
2023-03-27  2:27 ` [PATCH v2 1/2] ext4: turning quotas off if mount failed after enable quotas Baokun Li
2023-03-27  9:05   ` Jan Kara
2023-03-27 12:06     ` Baokun Li
2023-03-27  2:27 ` [PATCH v2 2/2] ext4: refactoring to use the unified helper ext4_quotas_off() Baokun Li
2023-03-27  9:21   ` Jan Kara [this message]

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=20230327092146.z3zllmhry7zjca4d@quack3 \
    --to=jack@suse.cz \
    --cc=adilger.kernel@dilger.ca \
    --cc=libaokun1@huawei.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ritesh.list@gmail.com \
    --cc=tytso@mit.edu \
    --cc=yangerkun@huawei.com \
    --cc=yi.zhang@huawei.com \
    --cc=yukuai3@huawei.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox