diff mbox series

[1/4] ocfs2: return real error code in ocfs2_dio_wr_get_block

Message ID 20240331111744.7224-2-l@damenly.org (mailing list archive)
State New
Headers show
Series ocfs2 bugs fixes exposed by fstests | expand

Commit Message

Su Yue March 31, 2024, 11:17 a.m. UTC
From: Su Yue <glass.su@suse.com>

ocfs2_dio_wr_get_block always returns -EIO in case of errors.
However, some programs expect right exit codes while doing dio.
For example, tools like fio treat -ENOSPC as expected code while
doing stress jobs. And quota tools expect -QUOTA when disk quota
exceededs.

-EIO is too strong return code in the dio path. I have checked
return codes from collees of ocfs2_dio_wr_get_block to make sure
the change does not hurt us.

Signed-off-by: Su Yue <glass.su@suse.com>
---
 fs/ocfs2/aops.c | 2 --
 1 file changed, 2 deletions(-)

Comments

Joseph Qi April 1, 2024, 1:44 a.m. UTC | #1
On 3/31/24 7:17 PM, Su Yue wrote:
> From: Su Yue <glass.su@suse.com>
> 
> ocfs2_dio_wr_get_block always returns -EIO in case of errors.
> However, some programs expect right exit codes while doing dio.
> For example, tools like fio treat -ENOSPC as expected code while
> doing stress jobs. And quota tools expect -QUOTA when disk quota

EDQUOT?

> exceededs.

s/exceededs/exceeds

> 
> -EIO is too strong return code in the dio path. I have checked
> return codes from collees of ocfs2_dio_wr_get_block to make sure

s/collees/callers

> the change does not hurt us.
> 
> Signed-off-by: Su Yue <glass.su@suse.com>> ---
>  fs/ocfs2/aops.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/fs/ocfs2/aops.c b/fs/ocfs2/aops.c
> index b82185075de7..f0467d3b3c88 100644
> --- a/fs/ocfs2/aops.c
> +++ b/fs/ocfs2/aops.c
> @@ -2283,8 +2283,6 @@ static int ocfs2_dio_wr_get_block(struct inode *inode, sector_t iblock,
>  	ocfs2_inode_unlock(inode, 1);
>  	brelse(di_bh);
>  out:
> -	if (ret < 0)
> -		ret = -EIO;
>  	return ret;
>  }
>
Su Yue April 1, 2024, 3:51 a.m. UTC | #2
> On Apr 1, 2024, at 09:44, Joseph Qi <joseph.qi@linux.alibaba.com> wrote:
> 
> 
> 
> On 3/31/24 7:17 PM, Su Yue wrote:
>> From: Su Yue <glass.su@suse.com>
>> 
>> ocfs2_dio_wr_get_block always returns -EIO in case of errors.
>> However, some programs expect right exit codes while doing dio.
>> For example, tools like fio treat -ENOSPC as expected code while
>> doing stress jobs. And quota tools expect -QUOTA when disk quota
> 
> EDQUOT?
> 

Right.

>> exceededs.
> 
> s/exceededs/exceeds
> 

Sorry for the typos.

>> 
>> -EIO is too strong return code in the dio path. I have checked
>> return codes from collees of ocfs2_dio_wr_get_block to make sure
> 
> s/collees/callers

The caller of ocfs2_dio_wr_get_block is __blockdev_direct_IO which
Is widely used and it handles error codes well. Here I mean the
functions called by ocfs2_dio_wr_get_block and their return codes look
good and clear. I will make it clear in next version. Thanks.

— 
Su
> 
>> the change does not hurt us.
>> 
>> Signed-off-by: Su Yue <glass.su@suse.com>> ---
>> fs/ocfs2/aops.c | 2 --
>> 1 file changed, 2 deletions(-)
>> 
>> diff --git a/fs/ocfs2/aops.c b/fs/ocfs2/aops.c
>> index b82185075de7..f0467d3b3c88 100644
>> --- a/fs/ocfs2/aops.c
>> +++ b/fs/ocfs2/aops.c
>> @@ -2283,8 +2283,6 @@ static int ocfs2_dio_wr_get_block(struct inode *inode, sector_t iblock,
>> ocfs2_inode_unlock(inode, 1);
>> brelse(di_bh);
>> out:
>> - if (ret < 0)
>> - ret = -EIO;
>> return ret;
>> }
>>
diff mbox series

Patch

diff --git a/fs/ocfs2/aops.c b/fs/ocfs2/aops.c
index b82185075de7..f0467d3b3c88 100644
--- a/fs/ocfs2/aops.c
+++ b/fs/ocfs2/aops.c
@@ -2283,8 +2283,6 @@  static int ocfs2_dio_wr_get_block(struct inode *inode, sector_t iblock,
 	ocfs2_inode_unlock(inode, 1);
 	brelse(di_bh);
 out:
-	if (ret < 0)
-		ret = -EIO;
 	return ret;
 }