Skip to contentSkip to conversation

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

PATCH New ChenXiaoSong 1 participant 1 message May 18, 2022

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

PATCH 1/1 cifs: 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/cifs/file.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
fs/cifs/file.c +4 -1
index d511a78383c3..559f59a047c2 100644
@@ -2777,8 +2777,11 @@ int cifs_flush(struct file *file, fl_owner_t id)
 		rc = filemap_write_and_wait(inode->i_mapping);
 
 	cifs_dbg(FYI, "Flush inode %p file %p rc %d\n", inode, file, rc);
-	if (rc)
+	if (rc) {
+		/* get more nuanced writeback errors */
+		rc = filemap_check_wb_err(file->f_mapping, 0);
 		trace_cifs_flush_err(inode->i_ino, rc);
+	}
 	return rc;
 }
 
Signature · 1 line
2.31.1