diff mbox series

[04/11] fuse: Convert fuse_flush() to use file_check_and_advance_wb_err()

Message ID 20230109051823.480289-5-willy@infradead.org (mailing list archive)
State New
Headers show
Series Remove AS_EIO and AS_ENOSPC | expand

Commit Message

Matthew Wilcox Jan. 9, 2023, 5:18 a.m. UTC
As with fsync, use the newer file_check_and_advance_wb_err() instead
of filemap_check_errors().

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
 fs/fuse/file.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Jeff Layton Jan. 9, 2023, 3:25 p.m. UTC | #1
On Mon, 2023-01-09 at 05:18 +0000, Matthew Wilcox (Oracle) wrote:
> As with fsync, use the newer file_check_and_advance_wb_err() instead
> of filemap_check_errors().
> 
> Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
> ---
>  fs/fuse/file.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/fs/fuse/file.c b/fs/fuse/file.c
> index 875314ee6f59..7174646ddf09 100644
> --- a/fs/fuse/file.c
> +++ b/fs/fuse/file.c
> @@ -500,11 +500,10 @@ static int fuse_flush(struct file *file, fl_owner_t id)
>  	fuse_sync_writes(inode);
>  	inode_unlock(inode);
>  
> -	err = filemap_check_errors(file->f_mapping);
> +	err = file_check_and_advance_wb_err(file);
>  	if (err)
>  		return err;
> 
> 

I think it'd be best to not advance the f_wb_err here. ->flush is called
on filp_close which is mainly close() syscalls, but there are some other
callers too, and an error reported by ->flush can be discarded.



>  
> -	err = 0;
>  	if (fm->fc->no_flush)
>  		goto inval_attr_out;
>
diff mbox series

Patch

diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index 875314ee6f59..7174646ddf09 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -500,11 +500,10 @@  static int fuse_flush(struct file *file, fl_owner_t id)
 	fuse_sync_writes(inode);
 	inode_unlock(inode);
 
-	err = filemap_check_errors(file->f_mapping);
+	err = file_check_and_advance_wb_err(file);
 	if (err)
 		return err;
 
-	err = 0;
 	if (fm->fc->no_flush)
 		goto inval_attr_out;