diff mbox series

[1/4] quota: avoid missing put_quota_format when DQUOT_SUSPENDED is passed

Message ID 20240715130534.2112678-2-shikemeng@huaweicloud.com (mailing list archive)
State New
Headers show
Series Fix and cleanups to quota | expand

Commit Message

Kemeng Shi July 15, 2024, 1:05 p.m. UTC
Avoid missing put_quota_format when DQUOT_SUSPENDED is passed to
dquot_load_quota_sb.

Signed-off-by: Kemeng Shi <shikemeng@huaweicloud.com>
---
 fs/quota/dquot.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Joseph Qi July 16, 2024, 1:10 a.m. UTC | #1
On 7/15/24 9:05 PM, Kemeng Shi wrote:
> Avoid missing put_quota_format when DQUOT_SUSPENDED is passed to
> dquot_load_quota_sb.
> 

It seems worth a 'Fixes' tag:
Fixes: d44c57663723 ("quota: Remove BUG_ON in dquot_load_quota_sb()")

Other looks good to me. So with the above addressed, feel free to add:
Reviewed-by: Joseph Qi <joseph.qi@linux.alibaba.com>

> Signed-off-by: Kemeng Shi <shikemeng@huaweicloud.com>
> ---
>  fs/quota/dquot.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c
> index 627eb2f72ef3..23fcf9e9d6c5 100644
> --- a/fs/quota/dquot.c
> +++ b/fs/quota/dquot.c
> @@ -2408,7 +2408,7 @@ static int vfs_setup_quota_inode(struct inode *inode, int type)
>  int dquot_load_quota_sb(struct super_block *sb, int type, int format_id,
>  	unsigned int flags)
>  {
> -	struct quota_format_type *fmt = find_quota_format(format_id);
> +	struct quota_format_type *fmt;
>  	struct quota_info *dqopt = sb_dqopt(sb);
>  	int error;
>  
> @@ -2418,6 +2418,7 @@ int dquot_load_quota_sb(struct super_block *sb, int type, int format_id,
>  	if (WARN_ON_ONCE(flags & DQUOT_SUSPENDED))
>  		return -EINVAL;
>  
> +	fmt = find_quota_format(format_id);
>  	if (!fmt)
>  		return -ESRCH;
>  	if (!sb->dq_op || !sb->s_qcop ||
Jan Kara July 17, 2024, 1:09 p.m. UTC | #2
On Tue 16-07-24 09:10:18, Joseph Qi wrote:
> 
> 
> On 7/15/24 9:05 PM, Kemeng Shi wrote:
> > Avoid missing put_quota_format when DQUOT_SUSPENDED is passed to
> > dquot_load_quota_sb.
> > 
> 
> It seems worth a 'Fixes' tag:
> Fixes: d44c57663723 ("quota: Remove BUG_ON in dquot_load_quota_sb()")
> 
> Other looks good to me. So with the above addressed, feel free to add:
> Reviewed-by: Joseph Qi <joseph.qi@linux.alibaba.com>

Thanks for the patch and review. I'll add the tag on commit.

								Honza

> 
> > Signed-off-by: Kemeng Shi <shikemeng@huaweicloud.com>
> > ---
> >  fs/quota/dquot.c | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> > 
> > diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c
> > index 627eb2f72ef3..23fcf9e9d6c5 100644
> > --- a/fs/quota/dquot.c
> > +++ b/fs/quota/dquot.c
> > @@ -2408,7 +2408,7 @@ static int vfs_setup_quota_inode(struct inode *inode, int type)
> >  int dquot_load_quota_sb(struct super_block *sb, int type, int format_id,
> >  	unsigned int flags)
> >  {
> > -	struct quota_format_type *fmt = find_quota_format(format_id);
> > +	struct quota_format_type *fmt;
> >  	struct quota_info *dqopt = sb_dqopt(sb);
> >  	int error;
> >  
> > @@ -2418,6 +2418,7 @@ int dquot_load_quota_sb(struct super_block *sb, int type, int format_id,
> >  	if (WARN_ON_ONCE(flags & DQUOT_SUSPENDED))
> >  		return -EINVAL;
> >  
> > +	fmt = find_quota_format(format_id);
> >  	if (!fmt)
> >  		return -ESRCH;
> >  	if (!sb->dq_op || !sb->s_qcop ||
>
diff mbox series

Patch

diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c
index 627eb2f72ef3..23fcf9e9d6c5 100644
--- a/fs/quota/dquot.c
+++ b/fs/quota/dquot.c
@@ -2408,7 +2408,7 @@  static int vfs_setup_quota_inode(struct inode *inode, int type)
 int dquot_load_quota_sb(struct super_block *sb, int type, int format_id,
 	unsigned int flags)
 {
-	struct quota_format_type *fmt = find_quota_format(format_id);
+	struct quota_format_type *fmt;
 	struct quota_info *dqopt = sb_dqopt(sb);
 	int error;
 
@@ -2418,6 +2418,7 @@  int dquot_load_quota_sb(struct super_block *sb, int type, int format_id,
 	if (WARN_ON_ONCE(flags & DQUOT_SUSPENDED))
 		return -EINVAL;
 
+	fmt = find_quota_format(format_id);
 	if (!fmt)
 		return -ESRCH;
 	if (!sb->dq_op || !sb->s_qcop ||