* [PATCH] quota: make dquot_set_dqinfo return errors from ->write_info
@ 2023-02-20 13:46 Yangtao Li
2023-02-27 10:26 ` Jan Kara
0 siblings, 1 reply; 2+ messages in thread
From: Yangtao Li @ 2023-02-20 13:46 UTC (permalink / raw)
To: jack; +Cc: linux-kernel, Yangtao Li
dquot_set_dqinfo() ignores the return code from the ->write_info
call, which means that quotacalls like Q_SETINFO never see the error.
This doesn't seem right, so fix that.
Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
fs/quota/dquot.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c
index f27faf5db554..be702905c74f 100644
--- a/fs/quota/dquot.c
+++ b/fs/quota/dquot.c
@@ -2819,7 +2819,6 @@ EXPORT_SYMBOL(dquot_get_state);
int dquot_set_dqinfo(struct super_block *sb, int type, struct qc_info *ii)
{
struct mem_dqinfo *mi;
- int err = 0;
if ((ii->i_fieldmask & QC_WARNS_MASK) ||
(ii->i_fieldmask & QC_RT_SPC_TIMER))
@@ -2846,8 +2845,7 @@ int dquot_set_dqinfo(struct super_block *sb, int type, struct qc_info *ii)
spin_unlock(&dq_data_lock);
mark_info_dirty(sb, type);
/* Force write to disk */
- sb->dq_op->write_info(sb, type);
- return err;
+ return sb->dq_op->write_info(sb, type);
}
EXPORT_SYMBOL(dquot_set_dqinfo);
--
2.25.1
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH] quota: make dquot_set_dqinfo return errors from ->write_info
2023-02-20 13:46 [PATCH] quota: make dquot_set_dqinfo return errors from ->write_info Yangtao Li
@ 2023-02-27 10:26 ` Jan Kara
0 siblings, 0 replies; 2+ messages in thread
From: Jan Kara @ 2023-02-27 10:26 UTC (permalink / raw)
To: Yangtao Li; +Cc: jack, linux-kernel
On Mon 20-02-23 21:46:52, Yangtao Li wrote:
> dquot_set_dqinfo() ignores the return code from the ->write_info
> call, which means that quotacalls like Q_SETINFO never see the error.
> This doesn't seem right, so fix that.
>
> Signed-off-by: Yangtao Li <frank.li@vivo.com>
Thanks for the fix. It looks good but if you have a look into
implementations you'll notice that v2_write_file_info() returns 0 or -1,
not the error code. So before doing this, you also need to fixup
v2_write_file_info() to return proper error code. What v1_write_file_info()
does looks like a good inspiration.
Honza
> ---
> fs/quota/dquot.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c
> index f27faf5db554..be702905c74f 100644
> --- a/fs/quota/dquot.c
> +++ b/fs/quota/dquot.c
> @@ -2819,7 +2819,6 @@ EXPORT_SYMBOL(dquot_get_state);
> int dquot_set_dqinfo(struct super_block *sb, int type, struct qc_info *ii)
> {
> struct mem_dqinfo *mi;
> - int err = 0;
>
> if ((ii->i_fieldmask & QC_WARNS_MASK) ||
> (ii->i_fieldmask & QC_RT_SPC_TIMER))
> @@ -2846,8 +2845,7 @@ int dquot_set_dqinfo(struct super_block *sb, int type, struct qc_info *ii)
> spin_unlock(&dq_data_lock);
> mark_info_dirty(sb, type);
> /* Force write to disk */
> - sb->dq_op->write_info(sb, type);
> - return err;
> + return sb->dq_op->write_info(sb, type);
> }
> EXPORT_SYMBOL(dquot_set_dqinfo);
>
> --
> 2.25.1
>
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-02-27 10:27 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-20 13:46 [PATCH] quota: make dquot_set_dqinfo return errors from ->write_info Yangtao Li
2023-02-27 10:26 ` Jan Kara
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®