Skip to content

Commit f8107c9

Browse files
bbkzzjankara
authored andcommitted
quota: fixup *_write_file_info() to return proper error code
For v1_write_file_info function, when quota_write() returns 0, it should be considered an EIO error. And for v2_write_file_info(), fix to proper error return code instead of raw number. Signed-off-by: Yangtao Li <frank.li@vivo.com> Signed-off-by: Jan Kara <jack@suse.cz> Message-Id: <20230227120216.31306-1-frank.li@vivo.com>
1 parent dced733 commit f8107c9

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

fs/quota/quota_v1.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ static int v1_write_file_info(struct super_block *sb, int type)
206206
sizeof(struct v1_disk_dqblk), v1_dqoff(0));
207207
if (ret == sizeof(struct v1_disk_dqblk))
208208
ret = 0;
209-
else if (ret > 0)
209+
else if (ret >= 0)
210210
ret = -EIO;
211211
out:
212212
up_write(&dqopt->dqio_sem);

fs/quota/quota_v2.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ static int v2_write_file_info(struct super_block *sb, int type)
212212
up_write(&dqopt->dqio_sem);
213213
if (size != sizeof(struct v2_disk_dqinfo)) {
214214
quota_error(sb, "Can't write info structure");
215-
return -1;
215+
return size < 0 ? size : -EIO;
216216
}
217217
return 0;
218218
}

0 commit comments

Comments
 (0)