All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH -next] fuse: return the more nuanced writeback error on close()
  2022-05-18 14:57 [PATCH -next] fuse: return the more nuanced writeback error on close() ChenXiaoSong
@ 2022-05-18 14:51 ` Al Viro
  2022-05-23  1:23   ` chenxiaosong (A)
  0 siblings, 1 reply; 3+ messages in thread
From: Al Viro @ 2022-05-18 14:51 UTC (permalink / raw)
  To: ChenXiaoSong
  Cc: miklos, linux-fsdevel, linux-kernel, liuyongqiang13, yi.zhang,
	zhangxiaoxu5

On Wed, May 18, 2022 at 10:57:29PM +0800, ChenXiaoSong wrote:

> +	/* return more nuanced writeback errors */
>  	if (err)
> -		return err;
> +		return filemap_check_wb_err(file->f_mapping, 0);
>  
>  	err = 0;

As an aside, what the hell is that err = 0 about?  Before or after
that patch, that is - "let's make err zero, in case it had somehow
magically changed ceased to be so since if (err) bugger_off just above"?

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH -next] fuse: return the more nuanced writeback error on close()
@ 2022-05-18 14:57 ChenXiaoSong
  2022-05-18 14:51 ` Al Viro
  0 siblings, 1 reply; 3+ messages in thread
From: ChenXiaoSong @ 2022-05-18 14:57 UTC (permalink / raw)
  To: miklos
  Cc: linux-fsdevel, linux-kernel, chenxiaosong2, liuyongqiang13,
	yi.zhang, zhangxiaoxu5

As filemap_check_errors() only report -EIO or -ENOSPC, we return more nuanced
writeback error -(file->f_mapping->wb_err & MAX_ERRNO).

  filemap_write_and_wait
    filemap_write_and_wait_range
      filemap_check_errors
        -ENOSPC or -EIO
  filemap_check_wb_err
    errseq_check
      return -(file->f_mapping->wb_err & MAX_ERRNO)

Signed-off-by: ChenXiaoSong <chenxiaosong2@huawei.com>
---
 fs/fuse/file.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index f18d14d5fea1..4a0add7f0a17 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -488,8 +488,9 @@ static int fuse_flush(struct file *file, fl_owner_t id)
 	inode_unlock(inode);
 
 	err = filemap_check_errors(file->f_mapping);
+	/* return more nuanced writeback errors */
 	if (err)
-		return err;
+		return filemap_check_wb_err(file->f_mapping, 0);
 
 	err = 0;
 	if (fm->fc->no_flush)
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH -next] fuse: return the more nuanced writeback error on close()
  2022-05-18 14:51 ` Al Viro
@ 2022-05-23  1:23   ` chenxiaosong (A)
  0 siblings, 0 replies; 3+ messages in thread
From: chenxiaosong (A) @ 2022-05-23  1:23 UTC (permalink / raw)
  To: Al Viro
  Cc: miklos, linux-fsdevel, linux-kernel, liuyongqiang13, yi.zhang,
	zhangxiaoxu5

在 2022/5/18 22:51, Al Viro 写道:
> On Wed, May 18, 2022 at 10:57:29PM +0800, ChenXiaoSong wrote:
> 
>> +	/* return more nuanced writeback errors */
>>   	if (err)
>> -		return err;
>> +		return filemap_check_wb_err(file->f_mapping, 0);
>>   
>>   	err = 0;
> 
> As an aside, what the hell is that err = 0 about?  Before or after
> that patch, that is - "let's make err zero, in case it had somehow
> magically changed ceased to be so since if (err) bugger_off just above"?
> 
> .
> 
err = 0 is no longer needed after if (err), I will send v2 patch to 
remove the redundant code.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-05-23  1:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-18 14:57 [PATCH -next] fuse: return the more nuanced writeback error on close() ChenXiaoSong
2022-05-18 14:51 ` Al Viro
2022-05-23  1:23   ` chenxiaosong (A)

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.