Skip to contentSkip to conversation

fuse: return the more nuanced writeback error on close()

PATCH In review ChenXiaoSong 2 participants 3 messages May 18, 2022 – May 23, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fuse: return the more nuanced writeback error on close()

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)
---
 fs/fuse/file.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
fs/fuse/file.c +2 -1
index f18d14d5fea1..4a0add7f0a17 100644
@@ -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)
Signature · 1 line
2.31.1
maintainer
#1 lore raw

fs/fuse/file.c static int fuse_flush(struct file *file, fl_owner_t id) · line 495

Quoted 6 lines · ChenXiaoSong
fs/fuse/file.c +2 -1
+	/* 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"?

#2 lore raw
Quoted 7 lines · Al Viro
Quoted 5 lines · ChenXiaoSong
fs/fuse/file.c +2 -1
+	/* return more nuanced writeback errors */
  	if (err)
-		return err;
+		return filemap_check_wb_err(file->f_mapping, 0);
Quoted 8 lines
Quoted 1 line
  	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.