quota: make dquot_quota_sync return errors from ->sync_fs
authorDarrick J. Wong <djwong@kernel.org>
Sun, 30 Jan 2022 16:53:16 +0000 (08:53 -0800)
committerDarrick J. Wong <djwong@kernel.org>
Sun, 30 Jan 2022 16:59:47 +0000 (08:59 -0800)
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>
Reviewed-by: Jan Kara <jack@suse.cz>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Acked-by: Christian Brauner <brauner@kernel.org>
fs/quota/dquot.c

index 22d904bde6ab9158702e4d4d83a42ebb4056770d..a74aef99bd3d6105b07da8ee90f07f1ff15d0c69 100644 (file)
@@ -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