diff mbox series

[3/4] quota: make dquot_quota_sync return errors from ->sync_fs

Message ID 164316350602.2600168.17959517250738452981.stgit@magnolia (mailing list archive)
State New, archived
Headers show
Series vfs: actually return fs errors from ->sync_fs | expand

Commit Message

Darrick J. Wong Jan. 26, 2022, 2:18 a.m. UTC
From: Darrick J. Wong <djwong@kernel.org>

Strangely, dquot_quota_sync ignores the return code from the ->sync_fs
call, which means that quotacalls like Q_SYNC never see the error.  This
doesn't seem right, so fix that.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
---
 fs/quota/dquot.c |   11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

Comments

Jan Kara Jan. 26, 2022, 10:45 a.m. UTC | #1
On Tue 25-01-22 18:18:26, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
> 
> Strangely, dquot_quota_sync ignores the return code from the ->sync_fs
> call, which means that quotacalls like Q_SYNC never see the error.  This
> doesn't seem right, so fix that.
> 
> Signed-off-by: Darrick J. Wong <djwong@kernel.org>
> ---
>  fs/quota/dquot.c |   11 ++++++++---
>  1 file changed, 8 insertions(+), 3 deletions(-)

Looks good. Feel free to add:

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

								Honza

> 
> 
> diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c
> index 22d904bde6ab..a74aef99bd3d 100644
> --- a/fs/quota/dquot.c
> +++ b/fs/quota/dquot.c
> @@ -690,9 +690,14 @@ int dquot_quota_sync(struct super_block *sb, int type)
>  	/* This is not very clever (and fast) but currently I don't know about
>  	 * any other simple way of getting quota data to disk and we must get
>  	 * them there for userspace to be visible... */
> -	if (sb->s_op->sync_fs)
> -		sb->s_op->sync_fs(sb, 1);
> -	sync_blockdev(sb->s_bdev);
> +	if (sb->s_op->sync_fs) {
> +		ret = sb->s_op->sync_fs(sb, 1);
> +		if (ret)
> +			return ret;
> +	}
> +	ret = sync_blockdev(sb->s_bdev);
> +	if (ret)
> +		return ret;
>  
>  	/*
>  	 * Now when everything is written we can discard the pagecache so
>
Christoph Hellwig Jan. 26, 2022, 5:03 p.m. UTC | #2
On Tue, Jan 25, 2022 at 06:18:26PM -0800, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
> 
> Strangely, dquot_quota_sync ignores the return code from the ->sync_fs
> call, which means that quotacalls like Q_SYNC never see the error.  This
> doesn't seem right, so fix that.

Looks good,

Reviewed-by: Christoph Hellwig <hch@lst.de>
diff mbox series

Patch

diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c
index 22d904bde6ab..a74aef99bd3d 100644
--- a/fs/quota/dquot.c
+++ b/fs/quota/dquot.c
@@ -690,9 +690,14 @@  int dquot_quota_sync(struct super_block *sb, int type)
 	/* This is not very clever (and fast) but currently I don't know about
 	 * any other simple way of getting quota data to disk and we must get
 	 * them there for userspace to be visible... */
-	if (sb->s_op->sync_fs)
-		sb->s_op->sync_fs(sb, 1);
-	sync_blockdev(sb->s_bdev);
+	if (sb->s_op->sync_fs) {
+		ret = sb->s_op->sync_fs(sb, 1);
+		if (ret)
+			return ret;
+	}
+	ret = sync_blockdev(sb->s_bdev);
+	if (ret)
+		return ret;
 
 	/*
 	 * Now when everything is written we can discard the pagecache so